/* ========================================
   Windows 11 Simulator - Enhanced Styles
   ======================================== */

/* CSS Variables for theming */
:root {
    --accent-color: #0078d4;
    --accent-hover: #1a86d9;
    --accent-glow: rgba(0, 120, 212, 0.4);
    --taskbar-bg: rgba(243, 243, 243, 0.85);
    --taskbar-border: rgba(255, 255, 255, 0.5);
    --menu-bg: rgba(255, 255, 255, 0.9);
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-medium: 0 16px 48px rgba(0, 0, 0, 0.2);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark mode variables */
[data-theme="dark"] {
    --taskbar-bg: rgba(32, 32, 32, 0.85);
    --taskbar-border: rgba(255, 255, 255, 0.1);
    --menu-bg: rgba(44, 44, 44, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow: hidden;
    font-family: 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background-image: url('../assets/background/bg1.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    transition: background-image 0.8s ease-in-out;
    position: relative;
}

/* iOS PWA fullscreen support */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
}

html {
    height: -webkit-fill-available;
}

/* Boot animation */
body.loading {
    background: #000;
}

body.loading::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border: 4px solid transparent;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 9999;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Taskbar
   ======================================== */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--taskbar-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--taskbar-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    z-index: 1000;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.08);
}

/* Taskbar icons container */
.taskbar-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}

/* Start button */
.start-button {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.start-button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.start-button:active {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(0.96);
}

.start-button::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px;
    transition: width var(--transition-smooth);
}

.start-button.active::after {
    width: 16px;
}

.win11-img {
    width: 24px;
    height: 24px;
    transition: transform var(--transition-bounce);
}

.start-button:hover .win11-img {
    transform: scale(1.1);
}

/* Taskbar app icons */
.taskbar-app {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.taskbar-app:hover {
    background: rgba(0, 0, 0, 0.06);
}

.taskbar-app img {
    width: 24px;
    height: 24px;
}

/* ========================================
   Start Menu
   ======================================== */
.start-menu {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.95);
    width: 600px;
    max-width: calc(100vw - 32px);
    background: var(--menu-bg);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    z-index: 999;
}

.start-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.start-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.start-menu-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.start-menu-header a {
    font-size: 12px;
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.start-menu-header a:hover {
    color: var(--accent-hover);
}

/* Pinned apps grid */
.pinned-apps {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    margin-bottom: 24px;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.app-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.app-item:active {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
}

.app-item img {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
    transition: transform var(--transition-bounce);
}

.app-item:hover img {
    transform: scale(1.1);
}

.app-item span {
    font-size: 12px;
    color: var(--text-primary);
    text-align: center;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* SVG icons in app items */
.app-svg-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
    fill: var(--accent-color);
    transition: transform var(--transition-bounce);
}

.app-item:hover .app-svg-icon {
    transform: scale(1.1);
}

/* Search box */
.search-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 24px;
    transition: all var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-box svg {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
    margin-right: 12px;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

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

/* Power menu */
.power-menu {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.power-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.power-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.power-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--text-primary);
}

/* ========================================
   Clock Widget (Taskbar)
   ======================================== */
#clock {
    position: absolute;
    right: 12px;
    bottom: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    text-align: right;
    cursor: pointer;
    transition: background var(--transition-fast);
}

#clock:hover {
    background: rgba(0, 0, 0, 0.06);
}

#time {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

#date {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========================================
   Desktop Icons
   ======================================== */
.desktop-icons {
    position: fixed;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    width: 80px;
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.15);
}

.desktop-icon:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.95);
}

.desktop-icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform var(--transition-bounce);
}

.desktop-icon:hover img {
    transform: scale(1.1);
}

.desktop-icon span {
    font-size: 11px;
    color: white;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    max-width: 72px;
    word-wrap: break-word;
}

/* ========================================
   Quick Actions Panel
   ======================================== */
.quick-actions {
    position: fixed;
    bottom: 60px;
    right: 12px;
    background: var(--menu-bg);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-smooth);
    z-index: 998;
    width: 360px;
}

.quick-actions.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.quick-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.quick-btn.active {
    background: var(--accent-color);
    color: white;
}

.quick-btn svg {
    width: 20px;
    height: 20px;
    margin-bottom: 4px;
    fill: var(--text-primary);
    stroke: transparent;
}

.quick-btn span {
    font-size: 10px;
    color: var(--text-primary);
}

.quick-btn.active span {
    color: white;
}

.quick-btn.active svg,
.quick-btn.active svg path,
.quick-btn.active svg circle,
.quick-btn.active svg line,
.quick-btn.active svg polyline,
.quick-btn.active svg polygon,
.quick-btn.active svg rect {
    fill: white;
    stroke: white;
}

/* Sliders */
.slider-container {
    margin-bottom: 12px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.slider-label span {
    font-size: 12px;
    color: var(--text-primary);
}

.slider-label svg {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
}

input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ========================================
   Settings Button
   ======================================== */
.settings-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-soft);
}

.settings-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

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

.settings-toggle svg {
    width: 20px;
    height: 20px;
    fill: white;
    transition: transform 0.5s ease;
}

.settings-toggle:hover svg {
    transform: rotate(90deg);
}

/* ========================================
   Notifications
   ======================================== */
.notification {
    position: fixed;
    bottom: 60px;
    right: 12px;
    background: var(--menu-bg);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all var(--transition-smooth);
    z-index: 997;
    max-width: 350px;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    gap: 12px;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
}

.notification-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.notification-text h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-text p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========================================
   Context Menu
   ======================================== */
.context-menu {
    position: fixed;
    background: var(--menu-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 8px;
    padding: 4px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: all 0.15s ease;
    z-index: 3000;
}

.context-menu.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.context-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.context-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.context-item svg {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
}

.context-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 4px 0;
}

/* ========================================
   Window Frame (for future use)
   ======================================== */
.window {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    min-width: 400px;
    min-height: 300px;
    opacity: 0;
    transform: scale(0.9);
    transition: all var(--transition-smooth);
}

.window.show {
    opacity: 1;
    transform: scale(1);
}

.window-titlebar {
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 12px;
    user-select: none;
    cursor: move;
}

.window-title {
    font-size: 12px;
    color: var(--text-primary);
}

.window-controls {
    display: flex;
    gap: 4px;
}

.window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.window-control.close { background: #ff5f57; }
.window-control.minimize { background: #febc2e; }
.window-control.maximize { background: #28c840; }

.window-content {
    padding: 16px;
    height: calc(100% - 32px);
    overflow: auto;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .start-menu {
        width: calc(100vw - 16px);
        left: 8px;
        transform: translateX(0) translateY(20px) scale(0.95);
        padding: 20px;
    }
    
    .start-menu.show {
        transform: translateX(0) translateY(0) scale(1);
    }
    
    .pinned-apps {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .quick-actions {
        right: 8px;
        width: calc(100vw - 16px);
    }
    
    .desktop-icons {
        top: 60px;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.hidden {
    display: none !important;
}

.no-select {
    user-select: none;
}

.cursor-pointer {
    cursor: pointer;
}

/* Audio icon animation */
.audio-playing {
    animation: pulse 0.5s ease infinite;
}
