/* Komponenty: Przyciski, Modale, Tabele, Alerty */

/* --- Przyciski --- */
.retry-button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    /* Pełna pigułka */
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    margin-top: 20px;
    box-shadow: 0 4px 10px rgba(0, 100, 0, 0.2);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 100, 0, 0.3);
}

/* --- Alerty / Status --- */
.error-message {
    color: #721c24;
    background-color: #f8d7da;
    border-left: 5px solid #f5c6cb;
    border-radius: var(--radius-sm);
    padding: 15px 20px;
    margin: 20px 0;
    font-weight: 500;
}

.loading-indicator {
    text-align: center;
    padding: 40px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
}

/* --- Modale (Ogólne) --- */
.modal-overlay,
#password-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    /* Nowoczesny efekt szkła */
    z-index: var(--z-modal); /* F4.22 (=9999) */
    /* Dostosowany z-index dla nakładki modalu */
    align-items: center;
    /* Dla #password-modal */
    justify-content: center;
    /* Dla #password-modal */
}


/* ==================================================================
   F4.13 (2026-07-23): WSPÓLNA klasa kart modali generowanych z JS.
   Zamiast inline background:white (dark-mode-overrides łatał to kruchymi
   hackami [style*="background: white"]) — generatory dodają .gf-modal-card,
   a tokeny robią resztę w obu motywach. NOWY modal z JS: użyj tej klasy.
   ================================================================== */
.gf-modal-card {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lg);
    overscroll-behavior: contain; /* F4.32: scroll modala nie „ucieka" do body */
}

/* Popup Instalacji (Specyficzny Modal) */
#installation-popup {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior: contain; /* F4.32 */

    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 30px;
    color: var(--text-color);

    box-shadow: var(--shadow-lg);
    z-index: var(--z-modal-raised); /* F4.22 (=10000) */
    display: none;
    /* F4.17: unikalna nazwa — wcześniej „fadeIn" kolidowało z @keyframes w index.php
       (translate-center-scale), przez co popup instalacji „podskakiwał" przy otwarciu */
    animation: installationPopupFadeIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* F4.8 (2026-07-23): telefon w landscape (niski ekran) — popup startował na
   top:120px z max-height:80vh i wystawał poza ekran. dvh = realna wysokość
   viewportu na iOS (pasek przeglądarki). */
@media (max-height: 500px) and (orientation: landscape) {
    #installation-popup {
        top: 10px;
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        padding: 16px;
    }
}

#close-popup {
    background: #ff4d4f;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    position: sticky;
    /* Sticky - zawsze widoczny przy scrollu */
    top: 0;
    float: right;
    transition: transform 0.2s;
    z-index: var(--z-drawer); /* F4.22 (=1000) */
}

#close-popup:hover {
    transform: scale(1.1);
}

@keyframes installationPopupFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* --- Tabele --- */
#service-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    color: var(--text-color);
}

#service-table th {
    background-color: var(--secondary-color);
    padding: 15px 20px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

#service-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--card-border);
    font-size: 14px;
}

#service-table tr:last-child td {
    border-bottom: none;
}

#service-table tbody tr:hover {
    background-color: var(--accent-light);
}

#service-table td:not(:first-child),
#service-table th:not(:first-child) {
    text-align: center;
}

/* --- Spinnery Ładowania --- */
.loading-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    min-height: 200px;
    /* Zapewnij widoczność */
}

.loading-spinner {
    width: 40px;
    height: 40px;
    /* F4.15: token — tor spinnera podąża za motywem (dark = ciemny) */
    border: 4px solid var(--card-border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner-large {
    width: 60px;
    height: 60px;
    border: 6px solid var(--card-border);
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
/* Popup map vertical layout */
.popup-stats-vertical { display: flex; flex-direction: column; gap: 0; }
.popup-stats-vertical .stat-box { background: #fff; border-bottom: 1px solid #e8e8e8; border-radius: 0; box-shadow: none; padding: 12px 0; margin: 0; text-align: center; }
.popup-stats-vertical .stat-title { color: #228B22; font-size: 15px; font-weight: 600; }
.popup-stats-vertical .stat-value { color: #1a1a1a; font-size: 18px; font-weight: 700; margin-top: 4px; }
