/*
 * Wortuhr Web-App — Styles außerhalb der Tailwind-Utility-Builds
 * - tailwind.css: nur von `npm run build:css` erzeugte Utilities (siehe web/input.css)
 * - style.css: tailwind.css + diese Datei (ein Bundle für wordclock.neetze.eu)
 * - Layout-Klassen wc-*: feste Maße / komplexe Regeln (unabhängig von Tailwind-Purge)
 */

/* ── Layout (vorher Inline-Styles in index.html, pixelgleich) ─────────────── */
.wc-pull-refresh {
    position: fixed;
    top: 96px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px) scale(0.85);
    opacity: 0;
    z-index: 100;
    background: #1d4ed8;
    padding: 10px 22px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    min-width: 190px;
    justify-content: center;
    pointer-events: none;
}

.wc-pull-refresh-arrow {
    font-size: 17px;
    display: inline-block;
    color: white;
    line-height: 1;
}

.wc-pull-refresh-spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.wc-pull-refresh-text {
    color: white;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.wc-sticky-header {
    transition: box-shadow 0.3s ease;
}

.wc-header-inner {
    max-width: 800px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.wc-page-container {
    max-width: 800px;
}

.wc-mobile-menu-bleed {
    margin-left: -1rem;
    margin-right: -1rem;
    margin-bottom: -0.5rem;
}

.wc-mobile-menu-pad {
    padding: 20px 16px 16px 16px;
}

.wc-card {
    background: #1e293b;
    border-radius: 1.5rem;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow:
        0 10px 25px -5px rgba(0, 0, 0, 0.35),
        0 8px 10px -6px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.wc-card .border-t {
    border-color: rgba(55, 65, 81, 0.5);
}

.wc-lang-dropdown {
    position: relative;
    display: inline-block;
}

.wc-lang-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 6px;
    padding: 4px 7px 4px 5px;
    cursor: pointer;
    line-height: 0;
}

.wc-lang-trigger:hover { background: #4b5563; }
.wc-lang-trigger svg { display: block; shape-rendering: crispEdges; }

.wc-lang-trigger-lg {
    padding: 6px 10px 6px 8px;
}

.wc-lang-chevron {
    font-size: 10px;
    line-height: 1;
    color: rgba(255,255,255,0.6);
}

.wc-lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    background: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 8px;
    padding: 6px;
    z-index: 200;
    flex-direction: row;
    gap: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

.wc-lang-menu.open { display: flex; }

.wc-lang-menu-up {
    top: auto;
    bottom: calc(100% + 5px);
}

.wc-lang-opt {
    background: none;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s, border-color 0.15s;
    line-height: 0;
}

.wc-lang-opt:hover { opacity: 0.85; }

.wc-lang-opt.active {
    border-color: #3b82f6;
    opacity: 1;
}

.wc-lang-opt svg {
    display: block;
    shape-rendering: crispEdges;
}

/* ── Desktop nav-style Sprach-Button ──────────────────────────────────────── */
.wc-lang-nav-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0.5rem 0.875rem;
    border-radius: 0.375rem;
    font-weight: 600;
    background: #374151;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.25rem;
    white-space: nowrap;
    transition: background 0.15s;
}
.wc-lang-nav-btn:hover { background: #4b5563; }
.wc-lang-nav-btn svg { shape-rendering: crispEdges; }

.wc-lang-code {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.9);
}

.wc-lang-chevron-svg {
    color: rgba(255,255,255,0.45);
    flex-shrink: 0;
    transition: transform 0.2s;
}
.wc-lang-dropdown.open .wc-lang-chevron-svg {
    transform: rotate(180deg);
}

/* Vertikale Dropdown-Liste für Desktop */
.wc-lang-menu-list {
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 140px;
    padding: 6px !important;
}

.wc-lang-opt-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    width: 100%;
    border-radius: 5px;
    font-size: 0.825rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    opacity: 1 !important;
}
.wc-lang-opt-row:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}
.wc-lang-opt-row.active {
    background: rgba(59,130,246,0.15);
    color: #fff;
    border-left: 2px solid #3b82f6;
    padding-left: 8px;
}
.wc-lang-opt-row span { flex: 1; }

.wc-lang-menu-full {
    left: 0;
    right: 0;
    width: 100%;
}

.wc-color-ring-host {
    position: relative;
    width: 112px;
    height: 112px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 50%;
}

.wc-color-ring-svg {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
}

.wc-brightness-pct-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 1), 0 0 8px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.8);
}

.wc-color-input-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
    margin: 0;
    clip: rect(0, 0, 0, 0);
    overflow: hidden;
    top: 0;
    left: 0;
}

.wc-color-ring-hit {
    position: absolute;
    top: 0;
    left: 0;
    width: 112px;
    height: 112px;
    cursor: pointer;
    display: block;
    font-size: 0;
}

.wc-rainbow-row-spacer {
    width: 112px;
    min-width: 112px;
    flex-shrink: 0;
    margin-right: 16px;
}

.wc-matrix-page {
    max-width: 800px;
    margin: 0 auto;
}

.wc-settings-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px 24px 16px;
}

.wc-footer-version {
    text-align: center;
    color: #475569;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 0.75rem 0 1rem;
}

body {
    background: #0f172a;
}

.wc-matrix-minute-dot {
    width: 1.5%;
    height: 1.5%;
}

.wc-matrix-minute-dot--tl {
    top: 2.5%;
    left: 2.5%;
}

.wc-matrix-minute-dot--tr {
    top: 2.5%;
    right: 2.5%;
}

.wc-matrix-minute-dot--br {
    bottom: 2.5%;
    right: 2.5%;
}

.wc-matrix-minute-dot--bl {
    bottom: 2.5%;
    left: 2.5%;
}

.wc-word-matrix-grid {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    grid-template-rows: repeat(10, minmax(0, 1fr));
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    width: 75%;
    height: 75%;
    gap: 0.25rem 0.35rem;
}

.wc-input-time-native {
    max-width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    min-width: 0;
}

.wc-ota-last-check {
    margin-left: 8px;
}

/* Abstand nach Regenbogen-Effekt */
#rainbow-mode-container {
    margin-top: 2rem;  /* Größerer Abstand nach unten */
}

/* Mobile-freundliche Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #0f172a;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    margin-top: -8px;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: #0f172a;
    border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Aktiver Slider */
input[type="range"]:active::-webkit-slider-thumb {
    background: #2563eb;
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.7);
}

input[type="range"]:active::-moz-range-thumb {
    background: #2563eb;
    transform: scale(1.08);
}

/* Plus/Minus Buttons für Slider */
.slider-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Range in Flex-Zeilen schrumpfen lassen (sonst WebKit min-width → Plus ragt nach rechts) */
.slider-control input[type="range"] {
    min-width: 0;
    flex: 1 1 0%;
}

/* Nur Symbole, kein Kasten — kompakt (transparent, kein Browser-Button-Padding) */
.slider-control .slider-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    min-width: 26px;
    padding: 0;
    margin: 0;
    background: transparent !important;
    border: 0 !important;
    border-style: none !important;
    border-radius: 0;
    color: #e5e7eb;
    -webkit-text-fill-color: #e5e7eb;
    font-size: 19px;
    font-weight: 600;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s, opacity 0.15s, transform 0.15s;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    box-shadow: none !important;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.slider-control button.slider-btn {
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
}

.slider-control .slider-btn:active {
    background: transparent !important;
    transform: scale(0.92);
    opacity: 0.85;
}

.slider-control .slider-btn:hover {
    background: transparent !important;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
}

/* Radio Button Styling */
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border: 2px solid #4b5563;
    border-radius: 50%;
    background: #1f2937;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

input[type="radio"]:checked {
    border-color: #3b82f6;
    background: #1f2937;
}

input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3b82f6;
}

input[type="radio"]:hover {
    border-color: #6b7280;
}

/* Color Input Styling */
input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    height: 80px;
    padding: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Letter Styling */
.letter {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2d3748; /* Darker gray for better contrast */
    transition: color 0.3s ease;
}

.letter.active {
    color: white;
}

/* Matrix Container - Aspect Ratio */
.matrix-container {
    position: relative;
    width: 100%;
    height: 0;
    max-width: min(calc(100vw - 32px), 700px);
    padding-bottom: 100%;
    margin: 0 auto;
}

.matrix-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* System-Fonts für Matrix - rund und fett */
.word-matrix-font {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI Rounded', 'Segoe UI', 'Roboto', 'Arial Rounded MT Bold', 'Arial', sans-serif;
    font-weight: 900;
    letter-spacing: -0.02em;
}

/* Sticky Save Button mit Overlay - nur Mobile, optimierte Höhe */
#sticky-save-overlay {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 80px;
    background: rgba(0, 0, 0, 0.4);
    z-index: 39;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#sticky-save-overlay.show {
    opacity: 1;
}

/* Alternative: Gradient-Overlay für bessere UX */
@media (max-width: 639px) {
    #sticky-save-overlay {
        background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
        height: 120px;
    }
}

/* Desktop: kein Overlay */
@media (min-width: 640px) {
    #sticky-save-overlay {
        display: none;
    }
}

/* Sticky Save Container - rechtsbündig, ursprüngliches Design */
#sticky-save-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 40;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(100px);
    pointer-events: none;
    transition: all 0.3s ease;
}

#sticky-save-container.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Buttons im Container - kompaktes Design */
#sticky-cancel-btn,
#sticky-save-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

#sticky-cancel-btn {
    background: #4b5563;
    color: white;
}

#sticky-cancel-btn:hover {
    background: #6b7280;
}

#sticky-save-btn {
    background: #3b82f6;
    color: white;
}

#sticky-save-btn:hover {
    background: #2563eb;
}

/* Verstecke normalen Speichern-Button */
#settings-save-btn {
    display: none;
}

/* Mobile Menu - innerhalb des sticky Headers */
#mobile-menu {
    width: 100vw;
    max-width: none;
}

/* Header bleibt sticky und scrollt mit Menu */
#sticky-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    background: #111827 !important;
}

/* Mobile: Verbessertes Sticky-Verhalten für virtuelle Tastatur */
@media (max-width: 639px) {
    /* Root-Element für bessere Viewport-Behandlung */
    html {
        height: 100%;
        height: 100vh;
        height: 100dvh; /* Dynamic Viewport Height - ignoriert virtuelle Tastatur */
    }
    
    body {
        height: 100%;
        height: 100vh;
        height: 100dvh;
    }
    
    #sticky-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 50 !important;
        background: #111827 !important;
        /* Hardware-Beschleunigung für bessere Performance */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
        /* Verhindere Layout-Shifts */
        contain: layout style paint;
    }
}

/* Hamburger Menu */
.hamburger {
    width: 32px;
    height: 28px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    height: 4px;
    width: 100%;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(12px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
    visibility: hidden;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-12px) rotate(-45deg);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: 0.3s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #3b82f6;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* ── Timezone Picker (JS baut Klassen dynamisch) ─────────────────────────── */
.tz-picker {
    position: relative;
}

.tz-picker__input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tz-picker__search {
    flex: 1;
    padding: 10px 12px;
    background: #374151;
    color: #f9fafb;
    border: 1px solid #4b5563;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.tz-picker__search:focus {
    border-color: #3b82f6;
    background: #1f2937;
}

.tz-picker__search::placeholder {
    color: #6b7280;
}

.tz-picker__detect {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.tz-picker__detect:hover {
    background: #1e40af;
}

.tz-picker__detect svg {
    flex-shrink: 0;
}

.tz-picker__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-height: 260px;
    overflow-y: auto;
    z-index: 200;
    overscroll-behavior: contain;
}

.tz-picker__dropdown.hidden {
    display: none;
}

.tz-picker__group {
    padding: 6px 12px 2px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    border-top: 1px solid #374151;
    margin-top: 2px;
}

.tz-picker__group:first-child {
    border-top: none;
    margin-top: 0;
}

.tz-picker__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #e5e7eb;
    transition: background 0.1s;
}

.tz-picker__item:hover,
.tz-picker__item.tz-active {
    background: #2563eb22;
    color: #fff;
}

.tz-picker__item.tz-selected {
    color: #60a5fa;
}

.tz-picker__item.tz-selected.tz-active {
    background: #2563eb44;
}

.tz-item-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tz-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
}

.tz-offset-badge {
    font-size: 11px;
    font-family: ui-monospace, monospace;
    color: #9ca3af;
    background: #374151;
    padding: 2px 6px;
    border-radius: 4px;
}

.tz-dst-badge {
    font-size: 10px;
    color: #34d399;
    background: #064e3b44;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 600;
}

.tz-check {
    color: #60a5fa;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.tz-no-results {
    padding: 16px 12px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}
