/**
 * Frutiger Aero Theme Presets
 * Dark mode, light mode, and high contrast color schemes
 * @package Frutiger_Aero
 */

/* CSS Custom Properties for Theme Colors */
:root {
    /* Default (Light) Theme Colors */
    --aero-primary: #6496e0;
    --aero-secondary: #86c6e8;
    --aero-accent: #b8ddf0;
    --aero-bg-main: #9fffc5;
    --aero-bg-window: rgba(255, 255, 255, 0.25);
    --aero-bg-window-body: rgba(240, 239, 242, 0.95);
    --aero-text-primary: #234;
    --aero-text-secondary: #555;
    --aero-text-light: #fefefe;
    --aero-border: rgba(255, 255, 255, 0.4);
    --aero-shadow: rgba(0, 0, 0, 0.3);
    --aero-glass-bg: rgba(255, 255, 255, 0.25);
    --aero-glass-border: rgba(255, 255, 255, 0.4);
    --aero-taskbar-bg: rgba(0, 0, 0, 0.15);
    --aero-menu-bg: rgba(255, 255, 255, 0.2);
    --aero-menu-header-bg: rgba(255, 255, 255, 0.6);
    --aero-button-bg-start: rgba(207, 207, 207, 1);
    --aero-button-bg-end: rgba(252, 252, 252, 1);
    --aero-button-hover-bg-start: rgba(167, 217, 245, 1);
    --aero-button-hover-bg-end: rgba(234, 246, 253, 1);
    --aero-link-color: #4169e1;
    --aero-link-hover: #33aaff;
    --aero-sidebar-bg: #f1f4fa;
    --aero-sidebar-title: #33aaff;
    --aero-widget-bg: rgba(255, 255, 255, 0.25);
}

/* Dark Mode Theme (Windows 7 Dark Aero Style) */
[data-theme="dark"] {
    --aero-primary: #4a7ab8;
    --aero-secondary: #5a8fc8;
    --aero-accent: #6aa4d8;
    --aero-bg-main: #0d2b45;
    --aero-bg-window: rgba(20, 40, 60, 0.85);
    --aero-bg-window-body: rgba(15, 30, 45, 0.95);
    --aero-text-primary: #e8f4fd;
    --aero-text-secondary: #b8d8f0;
    --aero-text-light: #ffffff;
    --aero-border: rgba(100, 150, 255, 0.4);
    --aero-shadow: rgba(0, 0, 0, 0.7);
    --aero-glass-bg: rgba(20, 40, 60, 0.7);
    --aero-glass-border: rgba(100, 150, 255, 0.4);
    --aero-taskbar-bg: rgba(10, 25, 40, 0.85);
    --aero-menu-bg: rgba(20, 40, 60, 0.85);
    --aero-menu-header-bg: rgba(60, 100, 140, 0.8);
    --aero-button-bg-start: rgba(70, 100, 130, 1);
    --aero-button-bg-end: rgba(90, 120, 150, 1);
    --aero-button-hover-bg-start: rgba(100, 140, 200, 1);
    --aero-button-hover-bg-end: rgba(120, 170, 230, 1);
    --aero-link-color: #78b8ff;
    --aero-link-hover: #a8d8ff;
    --aero-sidebar-bg: #152535;
    --aero-sidebar-title: #78b8ff;
    --aero-widget-bg: rgba(20, 40, 60, 0.7);
}

/* High Contrast Theme */
[data-theme="high-contrast"] {
    --aero-primary: #000000;
    --aero-secondary: #000000;
    --aero-accent: #ffff00;
    --aero-bg-main: #ffffff;
    --aero-bg-window: rgba(255, 255, 255, 1);
    --aero-bg-window-body: rgba(255, 255, 255, 1);
    --aero-text-primary: #000000;
    --aero-text-secondary: #000000;
    --aero-text-light: #000000;
    --aero-border: #000000;
    --aero-shadow: rgba(0, 0, 0, 1);
    --aero-glass-bg: rgba(255, 255, 255, 1);
    --aero-glass-border: #000000;
    --aero-taskbar-bg: rgba(0, 0, 0, 1);
    --aero-menu-bg: rgba(255, 255, 255, 1);
    --aero-menu-header-bg: rgba(255, 255, 0, 1);
    --aero-button-bg-start: #ffffff;
    --aero-button-bg-end: #ffffff;
    --aero-button-hover-bg-start: #ffff00;
    --aero-button-hover-bg-end: #ffff00;
    --aero-link-color: #0000ee;
    --aero-link-hover: #0000ff;
    --aero-sidebar-bg: #ffffff;
    --aero-sidebar-title: #000000;
    --aero-widget-bg: rgba(255, 255, 255, 1);
}

/* Apply theme colors to elements */
body {
    background: linear-gradient(
        135deg,
        #00000066 0%,
        #ffffff1a 50%,
        #ffffff33 100%
    ) var(--aero-bg-main);
    color: var(--aero-text-primary);
}

.site {
    background: linear-gradient(
        to right,
        #ffffff66,
        #0000001a,
        #ffffff33
    ) var(--aero-primary);
    border-color: var(--aero-border);
}

.site-title a,
.site-description {
    color: var(--aero-text-light);
}

/* Aero Windows */
.aero-window {
    background: var(--aero-glass-bg);
    border-color: var(--aero-glass-border);
    box-shadow: 0 8px 32px var(--aero-shadow);
}

.aero-window-body {
    background: var(--aero-bg-window-body);
}

.title-bar {
    background: linear-gradient(180deg, var(--aero-border) 0%, var(--aero-primary) 100%);
    border-bottom-color: var(--aero-border);
}

.title-bar-text {
    color: var(--aero-text-primary);
}

/* Navigation */
.main-navigation,
.main-navigation ul {
    background: linear-gradient(
        var(--aero-border) 20%,
        var(--aero-glass-bg) 25%,
        var(--aero-glass-bg) 43%,
        var(--aero-primary) 48%,
        var(--aero-accent)
    );
}

.page_item a,
.menu-item a {
    color: var(--aero-text-primary);
}

.page_item:hover,
.current_page_item,
.menu-item:hover {
    outline-color: var(--aero-primary);
    background: linear-gradient(
        0deg,
        var(--aero-button-hover-bg-start) 0%,
        var(--aero-button-hover-bg-end) 100%
    );
}

/* Start Orb */
.start-orb {
    background: linear-gradient(135deg, var(--aero-glass-bg) 0%, var(--aero-primary) 100%);
    border-color: var(--aero-border);
    box-shadow: 0 0 15px var(--aero-primary);
}

.start-orb:hover {
    box-shadow: 0 0 25px var(--aero-primary);
}

/* Taskbar */
.aero-taskbar {
    background: linear-gradient(180deg, var(--aero-taskbar-bg) 0%, var(--aero-primary) 50%, var(--aero-taskbar-bg) 100%);
    border-top-color: var(--aero-border);
    box-shadow: 0 -2px 10px var(--aero-shadow);
}

.aero-taskbar .taskbar-icon {
    border-color: var(--aero-border);
    background: var(--aero-glass-bg);
}

.aero-taskbar .taskbar-icon:hover {
    background: var(--aero-accent);
}

/* Start Menu */
.aero-start-menu {
    background: var(--aero-menu-bg);
    border-color: var(--aero-border);
}

.aero-start-menu-header {
    background: var(--aero-menu-header-bg);
    border-bottom-color: var(--aero-border);
    color: var(--aero-text-primary);
}

.aero-start-menu-item {
    color: var(--aero-text-primary);
}

.aero-start-menu-item:hover {
    background: var(--aero-button-hover-bg-start);
    outline-color: var(--aero-primary);
}

.aero-start-menu-item-text {
    color: var(--aero-text-primary);
}

.aero-search-box {
    background: var(--aero-glass-bg);
    border-color: var(--aero-border);
}

.aero-search-box input {
    color: var(--aero-text-primary);
}

.aero-search-box input::placeholder {
    color: var(--aero-text-secondary);
}

/* Buttons */
button,
.aero-btn {
    background: linear-gradient(0deg, var(--aero-button-bg-start) 0%, var(--aero-button-bg-end) 100%);
    color: var(--aero-text-primary);
}

button:hover,
.aero-btn:hover {
    background: linear-gradient(0deg, var(--aero-button-hover-bg-start) 0%, var(--aero-button-hover-bg-end) 100%);
}

/* Links */
a {
    color: var(--aero-link-color);
}

a:hover,
a:focus,
a:active {
    color: var(--aero-link-hover);
}

/* Sidebar */
#sidebar.sidebar {
    background: var(--aero-sidebar-bg);
    border-color: var(--aero-border);
}

#sidebar.sidebar h2,
#sidebar.sidebar h3 {
    color: var(--aero-sidebar-title);
    border-bottom-color: var(--aero-accent);
}

/* Widgets */
.widget,
.aero-widget {
    background: var(--aero-widget-bg);
    border-color: var(--aero-border);
}

.aero-widget-title {
    background: var(--aero-menu-header-bg);
    border-bottom-color: var(--aero-border);
    color: var(--aero-text-primary);
}

.aero-widget-content {
    background: var(--aero-bg-window-body);
}

.aero-widget li:hover {
    background: var(--aero-button-hover-bg-start);
    outline-color: var(--aero-primary);
}

/* Comments */
.aero-comment {
    background: var(--aero-glass-bg);
    border-color: var(--aero-border);
}

.aero-comment-author {
    color: var(--aero-text-primary);
}

.aero-comment-meta {
    color: var(--aero-text-secondary);
}

.aero-comment-content {
    color: var(--aero-text-primary);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
textarea,
select {
    color: var(--aero-text-primary);
    background: var(--aero-bg-window-body);
    border-color: var(--aero-border);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--aero-primary);
}

/* Theme Preset Toggle Button */
.theme-preset-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    background: var(--aero-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid var(--aero-border);
    border-radius: 25px;
    padding: 8px;
    display: flex;
    gap: 8px;
    box-shadow: 0 4px 12px var(--aero-shadow);
    transition: all 0.3s ease;
}

.theme-preset-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px var(--aero-shadow);
}

.theme-preset-button {
    width: 36px;
    height: 36px;
    border: 2px solid var(--aero-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--aero-button-bg-start);
    position: relative;
}

.theme-preset-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px var(--aero-primary);
}

.theme-preset-button.active {
    border-color: var(--aero-primary);
    border-width: 3px;
    box-shadow: 0 0 16px var(--aero-primary);
}

.theme-preset-button[data-theme="light"]::after {
    content: '☀️';
}

.theme-preset-button[data-theme="dark"]::after {
    content: '🌙';
}

.theme-preset-button[data-theme="high-contrast"]::after {
    content: '⚡';
}

/* Tooltip for preset buttons */
.theme-preset-button::before {
    content: attr(aria-label);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: var(--aero-text-primary);
    color: var(--aero-bg-window-body);
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.theme-preset-button:hover::before {
    opacity: 1;
}

/* Dark mode specific adjustments - Keep Frutiger Aero aesthetic */
[data-theme="dark"] body {
    background: linear-gradient(
        135deg,
        #0a1828 0%,
        #0d2b45 50%,
        #153a5c 100%
    );
}

[data-theme="dark"] .site {
    background: linear-gradient(
        to right,
        rgba(60, 100, 140, 0.6),
        rgba(40, 80, 120, 0.4),
        rgba(60, 100, 140, 0.6)
    ) var(--aero-primary);
}

[data-theme="dark"] img {
    opacity: 0.9;
}

[data-theme="dark"] img:hover {
    opacity: 1;
}

/* High contrast specific adjustments */
[data-theme="high-contrast"] {
    --aero-glass-bg: #ffffff;
    --aero-bg-window: #ffffff;
}

[data-theme="high-contrast"] * {
    text-shadow: none !important;
    box-shadow: 0 0 0 2px #000000 !important;
}

[data-theme="high-contrast"] body {
    background: #ffffff !important;
}

[data-theme="high-contrast"] .site {
    background: #ffffff !important;
    border: 3px solid #000000 !important;
}

[data-theme="high-contrast"] button,
[data-theme="high-contrast"] .aero-btn {
    border: 3px solid #000000 !important;
}

[data-theme="high-contrast"] a {
    text-decoration: underline;
    font-weight: bold;
}

[data-theme="high-contrast"] *:focus {
    outline: 4px solid #ffff00 !important;
    outline-offset: 2px;
}

/* Transition for theme changes */
body,
.site,
.aero-window,
.aero-taskbar,
.start-orb,
.aero-start-menu,
button,
.widget,
a,
input,
textarea,
select {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Respect user's system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --aero-primary: #4a7ab8;
        --aero-secondary: #5a8fc8;
        --aero-accent: #6aa4d8;
        --aero-bg-main: #0d2b45;
        --aero-bg-window: rgba(20, 40, 60, 0.85);
        --aero-bg-window-body: rgba(15, 30, 45, 0.95);
        --aero-text-primary: #e8f4fd;
        --aero-text-secondary: #b8d8f0;
        --aero-border: rgba(100, 150, 255, 0.4);
        --aero-shadow: rgba(0, 0, 0, 0.7);
    }
}

/* Authentic Frutiger Aero Enhancements */

/* Glass reflection effect */
.aero-window::before,
.aero-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    pointer-events: none;
    border-radius: inherit;
}

/* Aero glow on focus */
.aero-window:focus-within,
.aero-widget:focus-within {
    box-shadow: 0 0 0 1px var(--aero-primary),
                0 0 20px var(--aero-primary),
                0 8px 32px var(--aero-shadow);
}

/* Authentic Windows 7 scrollbar (Chromium browsers) */
::-webkit-scrollbar {
    width: 17px;
    height: 17px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(90deg, #e8e8e8 0%, #f0f0f0 100%);
    border: 1px solid #c0c0c0;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #d0d0d0 0%, #e0e0e0 50%, #d0d0d0 100%);
    border: 1px solid #a0a0a0;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #a8d8ff 0%, #c8e8ff 50%, #a8d8ff 100%);
    border-color: #5890c0;
}

::-webkit-scrollbar-button {
    height: 17px;
    width: 17px;
    background: linear-gradient(180deg, #e0e0e0 0%, #d0d0d0 100%);
    border: 1px solid #a0a0a0;
}

::-webkit-scrollbar-button:hover {
    background: linear-gradient(180deg, #d0e8ff 0%, #b0d8ff 100%);
}

/* Aero selection color */
::selection {
    background: rgba(100, 150, 255, 0.4);
    color: inherit;
}

::-moz-selection {
    background: rgba(100, 150, 255, 0.4);
    color: inherit;
}

/* Authentic Aero text shadows */
.site-title,
.aero-start-menu-header,
.title-bar-text {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8),
                 0 0 40px rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .site-title,
[data-theme="dark"] .aero-start-menu-header,
[data-theme="dark"] .title-bar-text {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6),
                 0 0 20px rgba(100, 150, 255, 0.4);
}

/* Frutiger Aero light rays effect */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 255, 255, 0.15) 0%,
        transparent 60%
    );
    pointer-events: none;
    z-index: -1;
    animation: lightRays 30s ease-in-out infinite alternate;
}

@keyframes lightRays {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 0.3;
    }
    100% {
        transform: rotate(5deg) scale(1.1);
        opacity: 0.5;
    }
}

[data-theme="dark"] body::before {
    background: radial-gradient(
        ellipse at center,
        rgba(100, 150, 255, 0.1) 0%,
        transparent 60%
    );
}

/* Authentic Aero button states */
.aero-btn,
button {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8),
                inset 0 -1px 0 rgba(0, 0, 0, 0.1),
                0 1px 2px rgba(0, 0, 0, 0.2);
}

.aero-btn:hover,
button:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9),
                inset 0 -1px 0 rgba(60, 127, 177, 0.2),
                0 0 8px rgba(100, 150, 255, 0.4),
                0 2px 4px rgba(0, 0, 0, 0.2);
}

.aero-btn:active,
button:active {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
                inset 0 0 8px rgba(60, 127, 177, 0.4),
                0 0 0 1px rgba(60, 127, 177, 0.6);
}

/* Frutiger Aero shine effect on hover */
.aero-window:hover::after,
.aero-widget:hover::after,
.aero-btn:hover::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    height: 40%;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    pointer-events: none;
    border-radius: inherit;
    opacity: 0;
    animation: shineEffect 0.6s ease-out forwards;
}

@keyframes shineEffect {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(0);
    }
}

/* Authentic Aero orb pulse (only in light mode) */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]):not([data-theme="high-contrast"]) .start-orb {
        animation: aeroPulse 4s ease-in-out infinite;
    }
}

@keyframes aeroPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(100, 150, 255, 0.4),
                    inset 0 2px 4px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(100, 150, 255, 0.6),
                    0 0 50px rgba(100, 150, 255, 0.3),
                    inset 0 2px 4px rgba(255, 255, 255, 0.4);
    }
}

/* Mobile adjustments for preset toggle */
@media (max-width: 768px) {
    .theme-preset-toggle {
        top: 10px;
        right: 10px;
        padding: 6px;
        gap: 6px;
    }

    .theme-preset-button {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* Print styles - force light theme */
@media print {
    * {
        --aero-primary: #6496e0;
        --aero-text-primary: #000000;
        --aero-bg-main: #ffffff;
        --aero-bg-window: #ffffff;
        --aero-bg-window-body: #ffffff;
    }

    .theme-preset-toggle {
        display: none !important;
    }
}
