/* Theme Toggle Styles */

.theme-toggle-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    border: none;
    text-decoration: none;
    transition: all var(--transition-speed) var(--transition-timing);
    cursor: pointer;
}

.theme-toggle-item a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.theme-toggle-item .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 16px;
    color: var(--primary-color);
}

.theme-toggle-item .theme-toggle-text {
    white-space: nowrap;
}

/* Animated Theme Toggle Switch (Alternative Style) */
.theme-toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background-color: var(--bg-secondary);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-speed) var(--transition-timing);
}

.theme-toggle-switch:hover {
    background-color: var(--bg-secondary);
    transform: scale(1.05);
}

.theme-toggle-switch i {
    font-size: 16px;
    color: var(--primary-color);
    transition: all var(--transition-speed) var(--transition-timing);
}

.theme-toggle-switch.dark i {
    color: #ffd700;
}

.theme-toggle-switch.light i {
    color: #ff8c00;
}

/* Theme Toggle Checkbox Style */
.theme-toggle-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 50px;
    height: 28px;
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    border: 2px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-speed) var(--transition-timing);
}

.theme-toggle-checkbox::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--text-inverse);
    top: 1px;
    left: 1px;
    transition: all var(--transition-speed) var(--transition-timing);
    box-shadow: 0 2px 4px var(--shadow-medium);
}

.theme-toggle-checkbox:checked::before {
    transform: translateX(22px);
    left: auto;
    right: 1px;
}

.theme-toggle-checkbox:checked {
    background: linear-gradient(to right, #333d4a, #4a525f);
}

/* Enhanced Button Toggle */
.theme-toggle-btn {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-speed) var(--transition-timing);
}

.theme-toggle-btn:hover {
    background-color: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.theme-toggle-btn i {
    font-size: 16px;
    transition: all 0.5s ease;
}

.theme-toggle-btn:hover i {
    transform: rotate(180deg);
}

/* RTL Adjustments for Theme Toggle */
html[dir="rtl"] .theme-toggle-item a {
    flex-direction: row-reverse;
}

html[dir="rtl"] .theme-toggle-switch {
    flex-direction: row-reverse;
}

html[dir="rtl"] .theme-toggle-btn {
    flex-direction: row-reverse;
}

/* Theme Loading Animation */
@keyframes themeLoading {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.5;
    }
}

body.theme-transitioning {
    animation: themeLoading var(--transition-speed) var(--transition-timing);
}

/* Smooth Transition on Page Load */
html:not([data-theme]) body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Accessibility - Focus Styles */
.theme-toggle-item a:focus,
.theme-toggle-btn:focus,
.theme-toggle-checkbox:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .theme-toggle-item a {
        padding: 12px 16px;
    }

    .theme-toggle-switch {
        width: 45px;
        height: 26px;
    }

    .theme-toggle-checkbox {
        width: 45px;
        height: 26px;
    }

    .theme-toggle-checkbox::before {
        width: 20px;
        height: 20px;
    }

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

    .theme-toggle-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .theme-toggle-btn i {
        font-size: 14px;
    }
}

/* Print Styles - Always use light theme for printing */
@media print {
    * {
        background-color: white !important;
        color: black !important;
        border-color: black !important;
    }
}
