/* Alias variabel: beberapa halaman (login, register, dashboard, admin, index)
   memakai var(--primary)/var(--secondary) yang sebelumnya TIDAK pernah
   didefinisikan -> tombol "primary" transparan/tak terlihat. */
:root {
    --primary: var(--primary-color);
    --secondary: var(--secondary-color);
}

/* ============================================================
   FILE: theme.css - HANYA UNTUK THEME TOGGLE
   ============================================================ */

/* ============================================================
   THEME TOGGLE WRAP
   ============================================================ */
.theme-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
}

.theme-toggle-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

/* ============================================================
   PERBAIKAN/BARU: SEGMENTED CONTROL 3 TEMA (Light/Dark/Glass)
   ============================================================
   Toggle switch lama cuma 2 posisi (checkbox on/off) - tidak cukup
   untuk 3 pilihan tema. Diganti jadi segmented control: 3 tombol
   berdampingan dalam satu wadah, tombol aktif ditandai class .active.
   Class .theme-toggle/.theme-toggle-checkbox/.theme-toggle-slider LAMA
   sengaja tetap dipertahankan di bawah (jangan dihapus) untuk kompatibilitas
   mundur kalau ada halaman lama yang belum di-refresh cache-nya.
   ============================================================ */
.theme-segmented {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.theme-segment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.theme-segment-btn:hover {
    color: var(--text-dark);
    background: rgba(128, 128, 128, 0.12);
}

.theme-segment-btn.active {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

body.glass-on .theme-segmented {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

body.glass-on .theme-segment-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
}

@media (max-width: 600px) {
    .theme-segment-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
    .theme-segment-btn .segment-label {
        display: none;
    }
}

/* ============================================================
   TOGGLE SWITCH LAMA (dipertahankan untuk kompatibilitas mundur)
   ============================================================ */
.theme-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.theme-toggle-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 26px;
    transition: .3s;
}

.theme-toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.theme-toggle-checkbox:checked + .theme-toggle-slider {
    background: var(--primary-color);
}

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

/* BARU: tombol Glass terpisah (✨), independen dari Light/Dark - style
   mengikuti pola .theme-auto-btn supaya konsisten secara visual. */
.theme-glass-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    flex-shrink: 0;
}

.theme-glass-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border-color: transparent;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

.theme-glass-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

/* Auto mode button */
.theme-auto-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    flex-shrink: 0;
}

.theme-auto-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.theme-auto-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.theme-auto-btn .auto-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Clock Widget */
.theme-clock-widget {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    min-width: 90px;
    justify-content: center;
}

.theme-clock-widget .clock-time {
    letter-spacing: 0.5px;
}

.theme-clock-widget .clock-zone {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    margin-top: 1px;
}

/* ============================================================
   TEMA GLASSMORPHISM OVERRIDES (BARU)
   ============================================================ */
body.glass-on .theme-auto-btn,
body.glass-on .theme-clock-widget {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
}

body.glass-on .theme-auto-btn:hover,
body.glass-on .theme-auto-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
}

body.glass-on .loading-overlay {
    background: rgba(26, 16, 53, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

body.glass-on input,
body.glass-on textarea,
body.glass-on select,
body.glass-on .filter-select {
    color: var(--text-dark) !important;
}

body.glass-on input::placeholder,
body.glass-on textarea::placeholder {
    color: var(--text-light) !important;
    opacity: 0.8 !important;
}

/* ============================================================
   DARK THEME OVERRIDES
   ============================================================ */
html.theme-dark body .loading-overlay, body.theme-dark .loading-overlay{
    background: rgba(11, 15, 28, 0.88);
}

html.theme-dark body .loading-overlay .spinner, body.theme-dark .loading-overlay .spinner{
    border-color: #1e293b;
    border-top-color: var(--primary-color);
}

html.theme-dark body input:disabled, body.theme-dark input:disabled,
html.theme-dark body .filter-select:disabled, body.theme-dark .filter-select:disabled{
    background-color: #141f36 !important;
    opacity: 0.55;
}

html.theme-dark body input, body.theme-dark input,
html.theme-dark body textarea, body.theme-dark textarea,
html.theme-dark body select, body.theme-dark select,
html.theme-dark body .filter-select, body.theme-dark .filter-select,
html.theme-dark body input[type="text"], body.theme-dark input[type="text"],
html.theme-dark body input[type="number"], body.theme-dark input[type="number"],
html.theme-dark body input[type="tel"], body.theme-dark input[type="tel"],
html.theme-dark body input[type="email"], body.theme-dark input[type="email"],
html.theme-dark body input[type="password"], body.theme-dark input[type="password"],
html.theme-dark body input[type="date"], body.theme-dark input[type="date"]{
    color: var(--text-dark) !important;
}

html.theme-dark body input::placeholder, body.theme-dark input::placeholder,
html.theme-dark body textarea::placeholder, body.theme-dark textarea::placeholder,
html.theme-dark body .filter-select::placeholder, body.theme-dark .filter-select::placeholder{
    color: #94a3b8 !important;
    opacity: 1 !important;
}

html.theme-dark body input:disabled::placeholder, body.theme-dark input:disabled::placeholder,
html.theme-dark body textarea:disabled::placeholder, body.theme-dark textarea:disabled::placeholder{
    color: #94a3b8 !important;
}

/* ============================================================
   RESPONSIVE THEME TOGGLE
   ============================================================ */
@media (max-width: 600px) {
    .theme-toggle-wrap {
        gap: 6px;
        padding: 6px 10px;
    }
    .theme-toggle-label {
        font-size: 11px;
    }
    .theme-toggle {
        width: 42px;
        height: 22px;
    }
    .theme-toggle-slider::before {
        height: 16px;
        width: 16px;
        left: 3px;
        bottom: 3px;
    }
    .theme-toggle-checkbox:checked + .theme-toggle-slider::before {
        transform: translateX(20px);
    }
    .theme-auto-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    .theme-glass-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    .theme-clock-widget {
        padding: 3px 8px;
        font-size: 11px;
        min-width: 75px;
    }
}