/* ==================== THEME TOGGLE BUTTON STYLES ==================== */

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 8px;
    margin: 0 8px;
    font-size: 1.25rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition, 250ms ease-in-out);
    color: var(--text-primary);
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
}

.theme-toggle-btn:hover {
    background: var(--primary, #007bff);
    border-color: var(--primary, #007bff);
    color: white;
    transform: scale(1.1);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.theme-toggle-btn:focus {
    outline: 2px solid var(--primary, #007bff);
    outline-offset: 2px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .theme-toggle-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        margin: 0 6px;
    }
}

@media (max-width: 480px) {
    .theme-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        margin: 0 4px;
    }
}

/* Navbar integration */
.navbar-menu .theme-toggle-btn {
    background: transparent;
    border: 1px solid transparent;
    margin: 0 4px;
}

.navbar-menu .theme-toggle-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary, #007bff);
}

.navbar .theme-toggle-btn {
    position: relative;
}

.navbar .theme-toggle-btn::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary, #007bff);
    border-radius: 50%;
    bottom: 4px;
    right: 4px;
    opacity: 0;
    transition: opacity var(--transition, 250ms ease-in-out);
}

html.dark-mode .navbar .theme-toggle-btn::after {
    opacity: 1;
}

html[data-theme="dark"] .navbar .theme-toggle-btn::after {
    opacity: 1;
}

/* Animation for theme change */
@keyframes themeFlip {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

.theme-toggle-btn.switching {
    animation: themeFlip 0.6s ease-in-out;
}

/* Fixed positioning for pages without navbar */
body .theme-toggle-btn[style*="position: fixed"] {
    padding: 12px;
    font-size: 1.3rem;
    background: rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

body .theme-toggle-btn[style*="position: fixed"]:hover {
    background: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

html.dark-mode body .theme-toggle-btn[style*="position: fixed"],
html[data-theme="dark"] body .theme-toggle-btn[style*="position: fixed"] {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

html.dark-mode body .theme-toggle-btn[style*="position: fixed"]:hover,
html[data-theme="dark"] body .theme-toggle-btn[style*="position: fixed"]:hover {
    background: rgba(255, 255, 255, 0.25);
}
