/* ═══════════════════════════════════════════════════════════
   Godnat – App Stylesheet  (siehe STYLEGUIDE.md)
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */

:root {
    /* Hintergrundfarben */
    --bg:               #0d1b2a;
    --bg-card:          #16232f;
    --bg-card-hover:    #1d2d3f;
    --bg-input:         rgba(255, 255, 255, 0.08);
    --bg-input-focus:   rgba(255, 255, 255, 0.12);
    --header-bg:        #0d1b2a;
    --tile-bg:          #0f1e2d;

    /* Rahmen */
    --border:           rgba(255, 255, 255, 0.10);
    --border-focus:     #3b82f6;
    --border-dashed:    rgba(255, 255, 255, 0.20);

    /* Text */
    --text:             #e8edf2;
    --text-dim:         rgba(255, 255, 255, 0.45);
    --text-muted:       rgba(255, 255, 255, 0.25);
    --text-inverse:     #0d1b2a;

    /* Akzentfarben */
    --accent:           #3b82f6;
    --overlay:          rgba(0, 0, 0, 0.35);
    --overlay-dark:     rgba(0, 0, 0, 0.55);

    /* Buttons */
    --btn-primary:      #2563eb;
    --btn-primary-h:    #1d4ed8;
    --btn-danger:       rgba(220, 38, 38, 0.80);
    --btn-danger-h:     rgba(185, 28, 28, 0.90);

    /* Statusfarben */
    --error-bg:         rgba(220, 38, 38, 0.15);
    --error-border:     rgba(248, 113, 113, 0.35);
    --error-text:       #fca5a5;
    --success-bg:       rgba(22, 163, 74, 0.15);
    --success-border:   rgba(74, 222, 128, 0.35);
    --success-text:     #86efac;

    /* Geometrie */
    --radius-sm:        8px;
    --radius:           12px;
    --radius-lg:        16px;
    --header-h:         52px;
}

/* ── Reset ── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

/* Hintergrundbild-Muster (Admin → Darstellung) */
body.app-bg--pattern {
    background-color: var(--bg);
    background-image: var(--app-bg-pattern);
    background-repeat: repeat;
    background-size: auto;
    background-position: 0 0;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   Verwendung: .btn-primary | .btn-secondary | .btn-danger | .btn-icon
   Modifikator: .btn--full  (width: 100%)
   ═══════════════════════════════════════════════════════════ */

.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--btn-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.30);
}
.btn-primary:hover  { background: var(--btn-primary-h); box-shadow: 0 4px 14px rgba(37,99,235,.4); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.btn-secondary:hover  { background: rgba(255,255,255,0.07); color: var(--text); border-color: rgba(255,255,255,0.25); }
.btn-secondary:active { transform: scale(0.97); }

.btn-danger {
    background: var(--btn-danger);
    color: #fca5a5;
    border: 1px solid rgba(248,113,113,0.25);
}
.btn-danger:hover  { background: var(--btn-danger-h); color: #fff; }
.btn-danger:active { transform: scale(0.97); }

/* Vollbreite-Modifikator */
.btn--full {
    width: 100%;
    padding: 14px 18px;
}

/* Icon-Button (quadratisch, transparent) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.70);
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover  { background: rgba(255,255,255,0.10); color: #fff; }
.btn-icon:active { transform: scale(0.93); }
.btn-icon.btn-icon--danger { color: rgba(248,113,113,0.7); }
.btn-icon.btn-icon--danger:hover { background: rgba(220,38,38,0.18); color: #f87171; }

/* ═══════════════════════════════════════════════════════════
   FORMULAR-FELDER  .form-field
   ═══════════════════════════════════════════════════════════ */

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-field label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.055em;
    color: var(--text-dim);
}

.form-field input,
.form-field input[type="file"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 14px;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-muted); }

.form-field input:hover,
.form-field select:hover  { border-color: rgba(255,255,255,0.20); }

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.20);
}

.form-field input[type="file"] {
    padding: 11px 14px;
    cursor: pointer;
    color: var(--text-dim);
}

.form-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Checkbox */
.form-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}

/* ── Meldungsboxen ── */

.form-alert {
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.4;
}

.form-alert--error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.form-alert--success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

/* ═══════════════════════════════════════════════════════════
   FORMULAR-KARTE  .form-card  (Upload / Create / Edit)
   Immer mit App-Header – KEIN flex-Centering auf body
   ═══════════════════════════════════════════════════════════ */

.form-page-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px;
    padding-bottom: max(36px, env(safe-area-inset-bottom, 36px));
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 18px 26px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}

.form-card-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

/* Cover-Preview */
.form-card-preview {
    width: 76px;
    height: 76px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
    border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   LOGIN-BOX  .auth-box  (nur Login / Passwort-Reset / Profil)
   Helle Karte auf dunklem Hintergrund – kein Header vorhanden
   ═══════════════════════════════════════════════════════════ */

body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(24px, env(safe-area-inset-top))
             max(20px, env(safe-area-inset-right))
             max(24px, env(safe-area-inset-bottom))
             max(20px, env(safe-area-inset-left));
    background-color: #0a121c;
}

.auth-box {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #fafaf9;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 24px 48px -12px rgba(0,0,0,0.38);
    padding: 36px 32px 28px;
}

/* Felder in .auth-box sind hell (weißer Hintergrund) */
.auth-box .auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #18181b;
}

.auth-box .auth-email  { font-size: 14px; color: #71717a; margin-top: -8px; }

.auth-box .auth-field         { display: flex; flex-direction: column; gap: 6px; }
.auth-box .auth-field label   { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #71717a; }
.auth-box .auth-hint          { font-size: 11px; color: #a1a1aa; font-weight: 400; text-transform: none; letter-spacing: 0; }

.auth-box .auth-field input {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 1rem;
    line-height: 1.4;
    color: #18181b;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}
.auth-box .auth-field input::placeholder { color: #a1a1aa; }
.auth-box .auth-field input:hover        { border-color: #d4d4d8; }
.auth-box .auth-field input:focus        { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.18); }

.auth-box .auth-error   { padding: 12px 14px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; font-size: 13px; font-weight: 500; color: #b91c1c; }
.auth-box .auth-success { padding: 12px 14px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; font-size: 13px; font-weight: 500; color: #15803d; }

.auth-box .auth-btn {
    width: 100%;
    padding: 14px 18px;
    background: var(--btn-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(37,99,235,.25), inset 0 1px 0 rgba(255,255,255,.12);
    transition: background 0.15s, transform 0.1s;
    margin-top: 4px;
}
.auth-box .auth-btn:hover  { background: var(--btn-primary-h); }
.auth-box .auth-btn:active { transform: scale(0.98); }

.auth-box .auth-logout           { text-align: center; padding-top: 4px; border-top: 1px solid #e4e4e7; }
.auth-box .auth-logout a         { font-size: 13px; color: #71717a; text-decoration: none; }
.auth-box .auth-logout a:hover   { color: #18181b; }

.auth-box .auth-profile-header   { display: flex; align-items: center; gap: 12px; }
.auth-box .auth-back             { display: flex; align-items: center; color: #71717a; transition: color 0.15s; flex-shrink: 0; }
.auth-box .auth-back:hover       { color: #18181b; }
.auth-box .auth-box--wide        { max-width: 420px; }

/* Legacy container für Login-Seiten */
.auth-container {
    display: flex;
    justify-content: center;
    padding: 24px 16px;
    padding-bottom: env(safe-area-inset-bottom, 80px);
}
.auth-container .auth-box { max-width: 440px; }

/* ═══════════════════════════════════════════════════════════
   HEADER  –  3-Slot-Grid: [Zurück] [Titel] [Profil]
   Überall identisches Aussehen. Titel ist immer ein Link auf "/".
   ═══════════════════════════════════════════════════════════ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    height: var(--header-h);
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    padding: 0 4px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
}

/* Mittlerer Slot: App-Name als Link */
.app-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.app-title:hover { color: #fff; }

/* Linker Slot: Zurück-Pfeil (.btn-icon) – leer auf Startseite */
.back-btn {
    justify-self: start;
}

/* Rechter Slot: Profil-Icon */
.header-profile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    opacity: 0.65;
    transition: opacity 0.15s, background 0.12s;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    justify-self: end;
}
.header-profile:hover { opacity: 1; background: rgba(255,255,255,0.09); }

/* ═══════════════════════════════════════════════════════════
   TRACK-GRID  (Flex: 2 / 5 / 7 / 9 Spalten, 15px Rand & Zwischenräume)
   ═══════════════════════════════════════════════════════════ */

.track-grid {
    --tile-gap: 15px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--tile-gap);
    padding: 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

/* n Spalten: Breite = (100% − (n−1)·gap) / n */
.track-grid > .track-card {
    flex: 0 0 calc((100% - (1 * var(--tile-gap))) / 2);
    max-width: calc((100% - (1 * var(--tile-gap))) / 2);
    min-width: 0;
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .track-grid > .track-card {
        flex: 0 0 calc((100% - (4 * var(--tile-gap))) / 5);
        max-width: calc((100% - (4 * var(--tile-gap))) / 5);
    }
}

@media (min-width: 1100px) {
    .track-grid > .track-card {
        flex: 0 0 calc((100% - (6 * var(--tile-gap))) / 7);
        max-width: calc((100% - (6 * var(--tile-gap))) / 7);
    }
}

@media (min-width: 1600px) {
    .track-grid > .track-card {
        flex: 0 0 calc((100% - (8 * var(--tile-gap))) / 9);
        max-width: calc((100% - (8 * var(--tile-gap))) / 9);
    }
}

/* ── Track-Card ── */

.track-card {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--tile-bg);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.track-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--tile-bg);
    background-size: cover;
    background-position: center;
}

a.track-thumb {
    display: block;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

.track-thumb-nocover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #333;
    z-index: 1;
}

.track-thumb-duration {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 4;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: #fff;
    background: rgba(0, 0, 0, 0.62);
    line-height: 1.2;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.track-thumb-scheduled {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 5px 8px;
    border-radius: 6px;
    color: #fff;
    background: rgba(217, 119, 6, 0.92);
    line-height: 1.2;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    max-width: calc(100% - 56px);
}

.track-thumb-scheduled__label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.track-thumb-scheduled__date {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.track-thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--overlay);
    transition: background 0.2s;
}
.track-card.playing .track-thumb::before { background: var(--overlay-dark); }

.play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.play-btn svg {
    width: 44px;
    height: 44px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
    transition: transform 0.15s, opacity 0.15s;
}
.track-card:active .play-btn svg { transform: scale(0.88); opacity: 0.7; }

.icon-pause { display: none; }
.icon-play  { display: block; }
.track-card.playing .icon-pause { display: block; }
.track-card.playing .icon-play  { display: none; }

.track-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: #fff;
    z-index: 3;
    transition: width 0.5s linear;
}
.track-card.playing { outline: 2px solid rgba(255,255,255,0.4); outline-offset: -2px; }

/* ── Track-Info-Bar (Titel + Edit/Delete) ── */

.track-info-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 4px 4px;
    min-width: 0;
}

.track-info-title {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

a.track-info-title {
    text-decoration: none;
    color: var(--text-dim);
}

a.track-info-title:hover {
    color: var(--text);
}

.track-info-actions {
    display: flex;
    gap: 1px;
    flex-shrink: 0;
}

/* Album-Übersicht: Track-Anzahl in der Info-Zeile (Zwischen Titel und Aktionen) */
.track-info-bar .album-tile-count {
    font-size: 0.625rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.28);
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 38%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── "Titel hinzufügen"-Kachel (letzte im Grid) – weiß, Blau für Rahmen & + ── */

.track-card--add {
    display: block;
    text-decoration: none;
    background: #fff;
    border: 2px solid var(--btn-primary);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(37, 99, 235, 0.12);
    -webkit-tap-highlight-color: transparent;
}
.track-card--add::before { display: none; }

.track-thumb-add-inner {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--btn-primary);
    background: #fff;
    transition: color 0.15s, background 0.15s;
}
.track-info-bar--add {
    background: #fff;
    border-top: 1px solid rgba(37, 99, 235, 0.22);
}
.track-info-bar--add .track-info-title {
    color: var(--btn-primary);
    font-weight: 600;
}

@media (hover: hover) {
    .track-card--add:hover {
        border-color: var(--btn-primary-h);
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    }
    .track-card--add:hover .track-thumb-add-inner {
        color: var(--btn-primary-h);
    }
    .track-card--add:hover .track-info-bar--add .track-info-title {
        color: var(--btn-primary-h);
    }
}
.track-card--add:active {
    background: #f8fafc;
    border-color: var(--btn-primary-h);
}
.track-card--add:active .track-thumb-add-inner,
.track-card--add:active .track-info-bar--add { background: #f8fafc; }

/* (Album-Kacheln nutzen dieselbe Struktur wie .track-card – siehe index.php.) */

/* ═══════════════════════════════════════════════════════════
   ALBUM-SEITE  (album.php) – Titelzeile unter dem Header
   ═══════════════════════════════════════════════════════════ */

.album-page-title-bar {
    padding: 12px 16px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
}

.album-page-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
    word-break: break-word;
}

/* Pull-to-refresh: unter Header + Titelzeile (eine Zeile; bei Umbruch leicht versetzt) */
.page-album {
    --album-title-bar-block: calc(12px + 14px + (1.125rem * 1.35));
}

.page-album .ptr-indicator {
    top: calc(var(--header-h) + var(--album-title-bar-block) + 1px + 8px);
}

/* ═══════════════════════════════════════════════════════════
   ALBUM-SEITE  (album.php) – Leiste unten fixiert
   ═══════════════════════════════════════════════════════════ */

.page-album main.track-grid {
    padding-bottom: calc(15px + 12px + 52px + 12px + env(safe-area-inset-bottom, 0px));
}

.album-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--header-bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.22);
}

.album-action-bar__form {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    display: flex;
}

.album-action-bar__btn {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    min-height: 52px;
    padding-left: 12px;
    padding-right: 12px;
    font-size: 0.875rem;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   PULL-TO-REFRESH
   ═══════════════════════════════════════════════════════════ */

.ptr-indicator {
    position: fixed;
    top: calc(var(--header-h) + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-72px);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0;
    pointer-events: none;
}
.ptr-indicator.ptr-visible  { opacity: 1; transition: none; }
.ptr-indicator.ptr-releasing { transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s; }
.ptr-indicator.ptr-loading  { transform: translateX(-50%) translateY(0px); opacity: 1; transition: none; }

.ptr-arrow {
    width: 18px; height: 18px;
    color: var(--text);
    transition: transform 0.2s;
    transform-origin: center;
}
.ptr-indicator.ptr-ready .ptr-arrow { transform: rotate(180deg); }

.ptr-spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.ptr-indicator.ptr-loading .ptr-arrow   { display: none; }
.ptr-indicator.ptr-loading .ptr-spinner { display: block; }

/* ═══════════════════════════════════════════════════════════
   ZUSTÄNDE: Laden / Leer / Fehler
   ═══════════════════════════════════════════════════════════ */

.loading-state {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 14px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   FAB  (Floating Action Button – nur noch auf Index)
   ═══════════════════════════════════════════════════════════ */

.fab {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    right: 20px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--btn-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37,99,235,0.45);
    text-decoration: none;
    z-index: 30;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.fab:hover  { background: var(--btn-primary-h); box-shadow: 0 6px 22px rgba(37,99,235,.55); transform: translateY(-1px); }
.fab:active { transform: scale(0.94); }

/* ═══════════════════════════════════════════════════════════
   PROFILE-SEITE  (auth-page mit header-ähnlichem Layout)
   ═══════════════════════════════════════════════════════════ */

.auth-container { display: flex; justify-content: center; padding: 24px 16px; padding-bottom: env(safe-area-inset-bottom, 80px); }
.auth-container .auth-box { max-width: 440px; }

/* ═══════════════════════════════════════════════════════════
   CONFIRMATION MODAL  (Bottom Sheet)
   ═══════════════════════════════════════════════════════════ */

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.confirm-overlay--visible {
    opacity: 1;
    pointer-events: all;
}
.confirm-sheet {
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    border-radius: 20px 20px 0 0;
    padding: 28px 20px 16px;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
.confirm-overlay--visible .confirm-sheet {
    transform: translateY(0);
}
.confirm-message {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    margin: 0 0 24px;
    line-height: 1.45;
}
.confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.confirm-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.confirm-btn:active { opacity: 0.75; }
.confirm-btn--danger {
    background: #ef4444;
    color: #fff;
}
.confirm-btn--cancel {
    background: var(--surface);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   RECORDER MODAL  –  Direktaufnahme im Browser
   ═══════════════════════════════════════════════════════════ */

/* Overlay: Vollbild-Hintergrund */
.recorder-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.recorder-overlay--visible {
    opacity: 1;
    pointer-events: all;
}

/* Verhindert Scrollen des Hintergrunds */
body.modal-open {
    overflow: hidden;
}

/* Zentrierte Modal-Karte */
.recorder-modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    box-sizing: border-box;
    max-height: calc(100dvh - 32px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

.recorder-overlay--visible .recorder-modal {
    transform: translateY(0) scale(1);
}

/* Header-Zeile: Titel + Schließen-Button */
.recorder-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.recorder-modal__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

/* Timer – immer mittig, fette Schrift */
#rec-timer {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    text-align: center;
    color: var(--text);
    margin: 12px 0 16px;
    transition: color 0.3s;
}

#rec-timer.rec-timer--warn-orange { color: #f59e0b; }
#rec-timer.rec-timer--warn-red    { color: #ef4444; }

/* ── Schritt-Anzeige ── */

.rec-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
}

.rec-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 64px;
}

.rec-step__dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    position: relative;
}

.rec-step__check { display: none; }

.rec-step--active .rec-step__dot {
    background: var(--btn-primary);
    border-color: var(--btn-primary);
    color: #fff;
}

.rec-step--done .rec-step__dot {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.6);
    color: #4ade80;
}

.rec-step--done .rec-step__num   { display: none; }
.rec-step--done .rec-step__check { display: inline; }

.rec-step__label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-dim);
    white-space: nowrap;
}

.rec-step--active .rec-step__label { color: var(--text); font-weight: 700; }
.rec-step--done   .rec-step__label { color: var(--text-dim); }
.rec-step--future .rec-step__label { color: rgba(255,255,255,0.25); }

.rec-step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin-bottom: 20px;
    min-width: 16px;
}

/* Inhalts-Panel je Zustand */
.recorder-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

/* Verhindert, dass display:flex das hidden-Attribut überschreibt */
.recorder-state[hidden],
.recorder-state[style*="display: none"] {
    display: none !important;
}

/* Mikrofon-Icon (idle-Zustand) */
.rec-mic-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--btn-primary);
    margin-bottom: 4px;
}

/* Beschreibungstext im Idle-Zustand */
.rec-idle-hint {
    font-size: 0.875rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
}

/* Aufnahme-Indikator: Pulsierender Punkt + Label */
.rec-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Roter Punkt im Recording-Zustand */
.rec-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
}

.recorder-modal.is-recording .rec-dot {
    animation: rec-pulse 1.2s ease-in-out infinite;
}

@keyframes rec-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(0.8); }
}

.recorder-modal.is-recording .rec-indicator { color: #ef4444; }
.recorder-modal.is-paused    .rec-indicator { color: #f59e0b; }

/* Unterelemente im Active-Panel: Recording vs. Paused */
.rec-indicator-label-paused { display: none; }

.recorder-modal.is-recording .rec-indicator-label-recording { display: inline; }
.recorder-modal.is-recording .rec-indicator-label-paused    { display: none; }
.recorder-modal.is-paused    .rec-indicator-label-recording { display: none; }
.recorder-modal.is-paused    .rec-indicator-label-paused    { display: inline; }

/* Im Paused-Zustand: Punkt durch Pause-Symbol ersetzen */
.recorder-modal.is-paused .rec-dot { display: none; }
.rec-pause-icon { display: none; }
.recorder-modal.is-paused .rec-pause-icon { display: inline; font-size: 1rem; }

/* Schaltflächen-Gruppe im Modal */
.rec-controls {
    display: flex;
    gap: 10px;
    width: 100%;
}

.rec-controls .btn-primary,
.rec-controls .btn-secondary,
.rec-controls .btn-danger {
    flex: 1;
}

/* Im Active-Panel: Pause- vs. Weiter-Button per CSS steuern */
#rec-btn-resume { display: none; }
.recorder-modal.is-paused    #rec-btn-pause  { display: none; }
.recorder-modal.is-paused    #rec-btn-resume { display: block; flex: 1; }
.recorder-modal.is-recording #rec-btn-pause  { display: block; }
.recorder-modal.is-recording #rec-btn-resume { display: none; }

/* Audio-Vorschau-Player */
#rec-preview {
    width: 100%;
    border-radius: var(--radius-sm);
    accent-color: var(--btn-primary);
}

/* "Direkt aufnehmen"-Kachel: gleiche Basis wie track-card--add */
.track-card--record {
    border: none;
    padding: 0;
    width: 100%;
    text-align: left;
    font: inherit;
}
