/* Theme Toggle Component */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-primary);
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--rounded-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
    margin: 0 var(--space-2);
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-focus);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle .icon {
    width: 24px;
    height: 24px;
    background-color: currentColor;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
}

.theme-toggle .icon-sun {
    mask-image: url('/static/img/sun.svg');
    -webkit-mask-image: url('/static/img/sun.svg');
    display: none;
}

.theme-toggle .icon-moon {
    mask-image: url('/static/img/moon.svg');
    -webkit-mask-image: url('/static/img/moon.svg');
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}


/* If system prefers dark and no manual override yet, show sun icon because it would toggle to light */
@media (prefers-color-scheme: dark) {
    body:not([data-theme]) .theme-toggle .icon-sun {
        display: block;
    }
    body:not([data-theme]) .theme-toggle .icon-moon {
        display: none;
    }
}

@media (max-width: 767px) {
    .theme-toggle {
        margin: var(--space-2) 0;
    }
}
