/* ═══════════════════════════════════════════════════════════════════════════
   SBF Phone Max — Lock Screen Editor
   Vollbild-Overlay über dem ECHTEN #lock-screen.
   Liquid-Glass 1:1 angelehnt an [PROJECT STORAGE]/ui_overview/category/category.css
═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS-Variablen für die Glas-Optik (entspricht category.css) ─────────── */
.lockscreen-edit-screen {
    --lse-glass:        #bbbbbc;
    --lse-light:        #ffffff;
    --lse-dark:         #000000;
    --lse-reflex-light: 1;
    --lse-reflex-dark:  1;
    --lse-saturation:   1.5;
}

/* ── Editor-Modus Schalter (am body) ─────────────────────────────────────
   Wenn aktiv, blenden wir alle Lockscreen-Deko-Elemente aus, damit nur die
   Uhr (mit Auswahl-Rahmen) und unsere Editor-Controls sichtbar bleiben.
─────────────────────────────────────────────────────────────────────────── */
body.lse-editing .status-bar,
body.lse-editing .dynamic-island,
body.lse-editing #lock-screen .bottom-icons,
body.lse-editing #lock-screen #swipe-hint,
body.lse-editing #lock-screen #home-indicator,
body.lse-editing #lock-screen .swipe-hint,
body.lse-editing #lock-screen .home-indicator {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transition: opacity 0.2s ease;
}

/* Sicherstellen, dass der Lockscreen vorne ist (auch wenn aus Settings geöffnet) */
body.lse-editing #lock-screen {
    display: flex !important;
    z-index: 1840 !important;
    opacity: 1 !important;
    transform: none !important;
    /* Wallpaper vom .phone-frame (Parent-Element) erben */
    background-image: inherit !important;
    background-size: cover !important;
    background-position: center !important;
    /* Vollen Bereich abdecken (inkl. status-bar-Bereich, der sowieso versteckt ist) */
    top: 0 !important;
}

/* Settings-App / geöffnete Apps ausblenden damit das Wallpaper sauber sichtbar ist */
body.lse-editing #app-container,
body.lse-editing #home-screen {
    display: none !important;
}

/* Glas-Auswahl-Rahmen um die Uhr (.time-display enthält #main-date + #main-time) */
body.lse-editing #lock-screen .time-display {
    position: relative;
    padding: 6px 14px 10px 14px;
    border-radius: 18px;
    background-color: color-mix(in srgb, #ffffff 6%, transparent);
    backdrop-filter: blur(4px) saturate(1.3);
    -webkit-backdrop-filter: blur(4px) saturate(1.3);
    box-shadow:
        inset 0 0 0 1.2px rgba(255, 255, 255, 0.34),
        inset 0 0 0 2.4px rgba(255, 255, 255, 0.12),
        0 4px 14px rgba(0, 0, 0, 0.18);
    transition: box-shadow 220ms ease, background-color 220ms ease;
}

/* Resize-Handle (DOM-Element, draggable) ─────────────────────────────── */
.lse-resize-handle {
    position: absolute;
    right: -9px;
    bottom: -9px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.70);
    box-shadow:
        0 0 0 1.5px rgba(255, 255, 255, 0.50),
        0 2px 8px rgba(0, 0, 0, 0.30);
    cursor: se-resize;
    touch-action: none;
    z-index: 2;
    transition: transform 160ms ease, background 160ms ease;
}
.lse-resize-handle:hover  { transform: scale(1.25); background: rgba(255,255,255,0.95); }
.lse-resize-handle:active { transform: scale(1.10); }

/* ── Editor-Overlay (transparent, nur Topbar + Bottom-Card) ─────────────── */
.lockscreen-edit-screen {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 1860;
    color: #ffffff;
    background: transparent;
    box-sizing: border-box;
    overflow: hidden;
    pointer-events: none;  /* Inhalte schalten pointer-events selbst wieder ein */
}

.lockscreen-edit-screen.active {
    display: block;
}

/* ── Top Bar: Abbrechen / Fertig ──────────────────────────────────────── */
.lockscreen-edit-screen .lse-topbar {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 220ms ease, transform 220ms ease;
}

.lockscreen-edit-screen.open .lse-topbar {
    opacity: 1;
    transform: translateY(0);
}

.lockscreen-edit-screen .lse-pill-btn {
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    border: none;
    cursor: pointer;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    padding: 9px 16px;
    min-width: 70px;
    border-radius: 99em;
    background-color: color-mix(in srgb, var(--lse-glass) 16%, transparent);
    backdrop-filter: blur(10px) saturate(var(--lse-saturation));
    -webkit-backdrop-filter: blur(10px) saturate(var(--lse-saturation));
    box-shadow:
        inset 0 0 0 1px            color-mix(in srgb, var(--lse-light) calc(var(--lse-reflex-light) * 12%), transparent),
        inset 1.5px 2.5px 0 -2px   color-mix(in srgb, var(--lse-light) calc(var(--lse-reflex-light) * 80%), transparent),
        inset -1.5px -1.5px 0 -2px color-mix(in srgb, var(--lse-light) calc(var(--lse-reflex-light) * 70%), transparent),
        inset 0 -2px 3px -1px      color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 16%), transparent),
        0 2px 8px 0                color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 14%), transparent),
        0 4px 14px 0               color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 10%), transparent);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    transition: transform 160ms ease, background-color 160ms ease;
}

.lockscreen-edit-screen .lse-pill-btn:hover  { transform: scale(1.00); }
.lockscreen-edit-screen .lse-pill-btn:active { transform: scale(0.96); }

/* ── Bottom Card: Schrift & Farbe ─────────────────────────────────────── */
.lockscreen-edit-screen .lse-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 16px;
    z-index: 4;
    pointer-events: auto;
    border-radius: 26px;
    padding: 14px 0 16px 0;
    color: #ffffff;
    background-color: color-mix(in srgb, var(--lse-glass) 14%, transparent);
    backdrop-filter: blur(20px) saturate(var(--lse-saturation));
    -webkit-backdrop-filter: blur(20px) saturate(var(--lse-saturation));
    box-shadow:
        inset 0 0 0 1px            color-mix(in srgb, var(--lse-light) calc(var(--lse-reflex-light) * 10%), transparent),
        inset 1.8px 3px 0 -2px     color-mix(in srgb, var(--lse-light) calc(var(--lse-reflex-light) * 80%), transparent),
        inset -2px -2px 0 -2px     color-mix(in srgb, var(--lse-light) calc(var(--lse-reflex-light) * 70%), transparent),
        inset -3px -8px 1px -6px   color-mix(in srgb, var(--lse-light) calc(var(--lse-reflex-light) * 55%), transparent),
        inset -0.3px -1px 4px 0    color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 12%), transparent),
        inset -1.5px 2.5px 0 -2px  color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 18%), transparent),
        inset 0 3px 4px -2px       color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 18%), transparent),
        inset 2px -6.5px 1px -4px  color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 10%), transparent),
        0 4px 14px 0               color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 16%), transparent),
        0 10px 26px 0              color-mix(in srgb, var(--lse-dark)  calc(var(--lse-reflex-dark)  * 12%), transparent);
    transform: translateY(120%);
    opacity: 0;
    transition: transform 280ms cubic-bezier(0.22, 0.61, 0.36, 1),
                opacity   220ms ease;
}

.lockscreen-edit-screen.open .lse-card {
    transform: translateY(0);
    opacity: 1;
}

.lockscreen-edit-screen .lse-card-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.30);
    padding: 0 14px 12px 14px;
}

/* ── Horizontal scrollende Font-Liste ─────────────────────────────────── */
.lockscreen-edit-screen .lse-font-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.lockscreen-edit-screen .lse-font-scroll::-webkit-scrollbar { display: none; }

.lockscreen-edit-screen .lse-font-list {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 2px 14px 4px 14px;
    width: max-content;
}

/* Einzelne Font-Kachel — enthält <canvas> + <span> */
.lockscreen-edit-screen .lse-font-tile {
    flex: 0 0 auto;
    width: 72px;
    height: 74px;
    padding: 5px 0 6px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    border-radius: 14px;
    color: #ffffff;
    background-color: color-mix(in srgb, var(--lse-light) 4%, transparent);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
    transition: transform 160ms ease, box-shadow 220ms ease, background-color 220ms ease;
}

.lockscreen-edit-screen .lse-font-tile:hover  { transform: translateY(-1px); }
.lockscreen-edit-screen .lse-font-tile:active { transform: scale(0.96); }

.lockscreen-edit-screen .lse-font-tile.active {
    background-color: color-mix(in srgb, var(--lse-light) 10%, transparent);
    box-shadow:
        inset 0 0 0 1.6px rgba(255, 255, 255, 0.85),
        inset 0 0 0 3.2px rgba(255, 255, 255, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.18);
}

/* Canvas für das Liquid-Glass "12" pro Font */
.lockscreen-edit-screen .lse-font-canvas {
    display: block;
    width: 72px;
    height: 48px;
    pointer-events: none;
    background: transparent;
    flex-shrink: 0;
}

.lockscreen-edit-screen .lse-font-label {
    font-size: 8px;
    font-weight: 600;
    line-height: 1;
    color: rgba(255, 255, 255, 0.65);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.02em;
    pointer-events: none;
}

/* ── Glas-Regler (Helligkeit, Stärke, Transparenz) ───────────────────── */
.lockscreen-edit-screen .lse-sliders {
    padding: 12px 18px 6px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lockscreen-edit-screen .lse-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lockscreen-edit-screen .lse-slider-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    width: 82px;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

/* Custom range — Track */
.lockscreen-edit-screen .lse-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 99em;
    background: rgba(255, 255, 255, 0.20);
    outline: none;
    cursor: pointer;
    box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.30);
}

/* Custom range — Thumb */
.lockscreen-edit-screen .lse-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
        0 0 0 1.5px rgba(255, 255, 255, 0.40),
        0 2px 8px  rgba(0, 0, 0, 0.30);
    cursor: pointer;
    transition: transform 130ms ease, background 130ms ease;
}
.lockscreen-edit-screen .lse-slider::-webkit-slider-thumb:hover  { transform: scale(1.20); background: #ffffff; }
.lockscreen-edit-screen .lse-slider::-webkit-slider-thumb:active { transform: scale(1.00); }
