/**
 * /css/track-dashboard.css
 * Arkusz stylów dla modułu TrackDashboard (AMFR 3.1)
 * Wspiera platformy: WWW, PWA, Mobile, Tablet, Car Audio
 */

/* =================================================
   1. GŁÓWNY KONTENER DASHBOARDU
   ==================================================== */

.amfr-track-dashboard {
    width: 100%;
    margin: 16px 0;
    box-sizing: border-box;
    font-family: inherit;
}

/* =================================================
   2. UKŁAD KAFELKÓW (GRID / FLEXBOX)
   ==================================================== */

.dashboard-tiles {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* =================================================
   3. STYL POJEDYNCZEGO KAFELKA
   ==================================================== */

.dashboard-tiles .tile {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 16px;
    background: linear-gradient(145deg, rgba(15, 15, 18, 0.90), rgba(5, 5, 8, 0.95));
    color: #ffffff;
    border: 1px solid rgba(215, 166, 60, 0.22);
    border-radius: 16px;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(215, 166, 60, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    position: relative;
    overflow: hidden;
}

/* Wariant interaktywny dla kafelków z akcjami */
.dashboard-tiles .tile.tile-action {
    cursor: pointer;
}

/* Stany interaktywne kafelka */
.dashboard-tiles .tile:hover {
    background: linear-gradient(145deg, rgba(25, 22, 14, 0.95), rgba(10, 9, 6, 0.98));
    border-color: #f1ca72;
    transform: translateY(-4px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6), 0 0 20px rgba(215, 166, 60, 0.25), inset 0 0 15px rgba(215, 166, 60, 0.08);
}

.dashboard-tiles .tile:focus-visible {
    border-color: #f1ca72;
    box-shadow: 0 0 0 3px rgba(215, 166, 60, 0.35), 0 0 20px rgba(215, 166, 60, 0.25);
}

.dashboard-tiles .tile:active {
    transform: translateY(-1px);
}

/* =================================================
   4. ETYKIETY ORAZ WARTOŚCI LICZBOWE I IKONY
   ==================================================== */

/* Kontener zawartości kafelka oraz ikony i etykiety */
.tile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 8px;
}

.tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 2px;
    filter: drop-shadow(0 0 8px rgba(215, 166, 60, 0.3));
}

.tile-label {
    display: block;
    width: 100%;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    color: #d9b45f;
    text-shadow: 0 0 6px rgba(215, 166, 60, 0.2);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.2;
}

/* Nagłówek / etykieta kafelka (w razie użycia h3 w HTML) */
.dashboard-tiles .tile h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    color: #d9b45f;
    text-shadow: 0 0 6px rgba(215, 166, 60, 0.2);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    width: 100%;
    line-height: 1.2;
}

/* Wartość liczbowa w kafelku */
.dashboard-tiles .tile .tile-value {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    color: #f1ca72;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(241, 202, 114, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Klasa używana podczas animacji zmiany wartości */
.dashboard-tiles .tile .tile-value.updated {
    transform: scale(1.15);
    color: #ffffff;
    text-shadow: 0 0 15px rgba(215, 166, 60, 0.8);
}

/* =================================================
   5. STANY SPECJALNE KAFELKÓW (LOADING, SUCCESS, ERROR, DISABLED)
   ==================================================== */

.dashboard-tiles .tile.loading {
    opacity: 0.7;
    pointer-events: none;
    animation: amfr-pulse 1.5s infinite ease-in-out;
}

.dashboard-tiles .tile.success {
    border-color: rgba(46, 204, 113, 0.5);
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.2);
}

.dashboard-tiles .tile.error {
    border-color: rgba(231, 76, 60, 0.5);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.2);
}

.dashboard-tiles .tile.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

@keyframes amfr-pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* =================================================
   6. RESPONSYWNOŚĆ (MEDIA QUERIES)
   ==================================================== */

/* Układ Tablet: 2 rzędy po 2 kafelki */
@media screen and (max-width: 1024px) {
    .dashboard-tiles {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .dashboard-tiles .tile {
        aspect-ratio: auto;
        min-height: 110px;
        min-width: 0;
        padding: 14px;
    }

    .tile-label, .dashboard-tiles .tile h3 {
        font-size: 0.85rem;
    }

    .dashboard-tiles .tile .tile-value {
        font-size: 1.4rem;
    }
}

/* Układ Telefon / Car Audio: 2×2 lub optymalna czytelność */
@media screen and (max-width: 600px) {
    .dashboard-tiles {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .dashboard-tiles .tile {
        min-height: 100px;
        min-width: 0;
        padding: 12px;
    }

    .tile-label, .dashboard-tiles .tile h3 {
        font-size: 0.8rem;
    }

    .dashboard-tiles .tile .tile-value {
        font-size: 1.25rem;
    }
}

/* Bardzo małe ekrany (PWA / małe telefony) */
@media screen and (max-width: 360px) {
    .dashboard-tiles {
        grid-template-columns: 1fr;
    }

    .dashboard-tiles .tile {
        aspect-ratio: 2.5 / 1;
        min-height: 70px;
        min-width: 0;
    }
}

/* =================================================
   7. DOSTĘPNOŚĆ (PREFERS-REDUCED-MOTION)
   ==================================================== */
@media (prefers-reduced-motion: reduce) {
    .dashboard-tiles .tile,
    .dashboard-tiles .tile .tile-value,
    .dashboard-tiles .tile.loading {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}
```[cite: 13, 14]