/* ============================================================
   THEME COMPONENTS
   ============================================================
   - Scrollbar theming
   - Theme toggle switch component
   - Floating theme toggle (FAB)
   ============================================================ */

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar {
    background: var(--scrollbar-track);
    width: 8px !important;
    height: 8px !important;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    height: 8px !important;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

/* Firefox scrollbar support */
/* * {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
} */

/* ============================================================
   THEME TOGGLE SWITCH COMPONENT
   ============================================================ */
.theme-toggle-menu-item {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.theme-toggle {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    user-select: none;
}

.theme-toggle__track {
    position: relative;
    width: 44px;
    height: 22px;
    background-color: var(--surface-5);
    border-radius: 11px;
    border: 1px solid var(--border-input);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle__track:hover {
    border-color: var(--border-hover);
}

.theme-toggle__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.theme-toggle__icon--dark {
    color: var(--color-primary);
}

.theme-toggle__icon--light {
    color: var(--text-tertiary);
}

.theme-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: var(--color-primary);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Light mode: move thumb to right, swap icon prominence */
[data-theme="light"] .theme-toggle__thumb {
    transform: translateX(22px);
}

[data-theme="light"] .theme-toggle__icon--dark {
    color: var(--text-tertiary);
}

[data-theme="light"] .theme-toggle__icon--light {
    color: var(--color-primary);
}

[data-theme="light"] .theme-toggle__track {
    background-color: var(--surface-4);
}

/* ============================================================
   FLOATING THEME TOGGLE (Bottom-Right)
   ============================================================ */
.theme-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-input);
    background-color: var(--surface-5);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-fab:hover {
    background-color: var(--surface-6);
    border-color: var(--color-primary);
    transform: scale(1.08);
    box-shadow: var(--shadow-xl);
}

.theme-fab:active {
    transform: scale(0.95);
}

.theme-fab:focus {
    outline: none;
}

.theme-fab__icon {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

/* Dark mode: show moon, hide sun */
.theme-fab__icon--moon {
    display: block;
}

.theme-fab__icon--sun {
    display: none;
}

/* Light mode: show sun, hide moon */
[data-theme="light"] .theme-fab__icon--moon {
    display: none;
}

[data-theme="light"] .theme-fab__icon--sun {
    display: block;
}

[data-theme="light"] .theme-fab {
    background-color: #ffffff;
    border-color: var(--border-input);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .theme-fab:hover {
    border-color: var(--color-primary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
