/* ==========================================================================
   BEPO – Berliner Prüfungs-Optimierer
   public/assets/css/parts/core.css – Reset, Layout & Responsive
   🌍 MENSCH: Basis-Styling für das gesamte Dashboard. Definiert CSS-Variablen,
   Schriftart, Header, Grid-Layout und responsive Anpassungen.
   🤖 KI-CONTEXT: @ui-render @config
   ========================================================================== */

/* 1. RESET & VARIABLEN
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Farbschema: x030-Dunkelblau + BEPO-Akzente */
    --color-bg:          #0f172a;
    --color-surface:     #1e293b;
    --color-surface-alt: #334155;
    --color-text:        #f1f5f9;
    --color-text-dim:    #94a3b8;

    /* Kachel-Farben */
    --color-clean:      #10b981;
    --color-warning:    #f59e0b;
    --color-fail:       #ef4444;
    --color-unbewertet: #6b7280;
    --color-abwesend:   #374151;
    --color-passive:    #a16207;

    /* Timer */
    --color-timer-bg:         #1e293b;
    --color-timer-fill:       #10b981;
    --color-timer-fill-warn:  #f59e0b;
    --color-timer-fill-danger:#ef4444;

    /* Abstände */
    --gap: 8px;
    --padding: 16px;

    /* Schrift */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
                 Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    color: var(--color-text);
    background: var(--color-bg);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    padding: var(--padding);
    gap: var(--gap);
    -webkit-tap-highlight-color: transparent;
}

/* user-select: text für interaktive/formular-bereiche */
input, select, textarea, label, .setup-error, .setup-error-db,
.modal-label, .header-meta, .tile-name {
    user-select: text;
}

/* 2. HEADER: Prüfungs-Info + Timer
   ========================================================================== */
.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
    border-radius: 12px;
    padding: 12px 16px;
    gap: 8px;
}

.header-info h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
}

.header-meta {
    font-size: 0.85rem;
    color: var(--color-text-dim);
}

/* 3. PRÜFUNG BEENDEN BUTTON
   ========================================================================== */
.beenden-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid var(--color-fail);
    border-radius: 10px;
    background: transparent;
    color: var(--color-fail);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-width: 48px;
    min-height: 48px;
}
.beenden-btn:hover:not(:disabled) {
    background: var(--color-fail);
    color: #fff;
}
.beenden-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 4. TIMER
   ========================================================================== */
.timer-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.timer-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-width: 48px;
    min-height: 48px;
    color: #fff;
}

.timer-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.timer-btn-start {
    background: var(--color-clean);
}
.timer-btn-start:hover:not(:disabled) {
    background: #059669;
}

.timer-btn-pause {
    background: var(--color-warning);
}
.timer-btn-pause:hover:not(:disabled) {
    background: #d97706;
}

.timer-btn-reset {
    background: var(--color-surface-alt);
}
.timer-btn-reset:hover:not(:disabled) {
    background: #475569;
}

.timer-progress-wrapper {
    position: relative;
    width: 200px;
    min-width: 120px;
    height: 32px;
}

.timer-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--color-surface-alt);
    border-radius: 16px;
    overflow: hidden;
}

.timer-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--color-timer-fill);
    border-radius: 16px;
    transition: width 0.3s linear, background 0.5s ease;
}

.bike-icon {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    transition: left 0.3s linear;
    pointer-events: none;
}

.timer-display {
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
    text-align: center;
    color: var(--color-text);
    letter-spacing: 1px;
}

/* 4. GRID: 8 Spalten × 4 Zeilen
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--gap);
    flex: 1;
    align-content: start;
}

/* 5. X030-SIGNATUR-FOOTER
   ========================================================================== */
.dashboard-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 0 4px;
    font-size: 0.75rem;
    color: var(--color-text-dim);
}

.dashboard-footer a {
    color: var(--color-text-dim);
    text-decoration: none;
    transition: color 0.2s ease;
}
.dashboard-footer a:hover {
    color: var(--color-text);
}

.version-badge {
    background: var(--color-surface-alt);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-dim);
}

/* 7. RESPONSIVE: Tablet & Mobile
   ========================================================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .dashboard-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .timer-container {
        width: 100%;
        justify-content: center;
    }

    .timer-progress-wrapper {
        width: 160px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (orientation: portrait), (max-width: 768px) {
    html, body {
        overflow: auto;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .timer-container {
        width: 100%;
        justify-content: center;
    }

    .timer-progress-wrapper {
        width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .timer-container {
        flex-wrap: wrap;
    }

    .timer-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}