/* ==========================================================
   macOS Desktop Interface Styles
   ========================================================== */

/* Desktop Container */
.macos-desktop {
    position: fixed;
    inset: 0;
    overflow: hidden;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
}

/* Wallpaper */
.desktop-wallpaper {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        #1a1a2e 0%, 
        #16213e 25%, 
        #0f3460 50%, 
        #1a1a2e 75%, 
        #0f0f1a 100%);
    background-size: 400% 400%;
    animation: wallpaper-shift 30s ease infinite;
    z-index: 0;
}

.desktop-wallpaper::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(239, 68, 68, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

@keyframes wallpaper-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Windows Area */
.windows-area {
    position: absolute;
    top: 28px;
    left: 0;
    right: 0;
    bottom: 80px;
    z-index: 1;
}

/* ==========================================================
   Menu Bar
   ========================================================== */
.macos-menubar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10000;
    font-size: 13px;
    color: #ffffff;
    user-select: none;
}

.menubar-left,
.menubar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menubar-left { gap: 16px; }

.menubar-logo {
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.menubar-logo:hover { background: rgba(255, 255, 255, 0.1); }

.menubar-app-name { font-weight: 600; }

.menubar-menu-items {
    display: flex;
    gap: 4px;
}

.menu-item {
    padding: 2px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.menu-item:hover { background: rgba(255, 255, 255, 0.1); }

.menubar-icon {
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.menubar-icon:hover { background: rgba(255, 255, 255, 0.1); }

.notification-icon.has-notifications { color: #ef4444; }

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menubar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.menubar-user:hover { background: rgba(255, 255, 255, 0.1); }

.user-name { font-size: 12px; opacity: 0.9; }
.user-avatar { font-size: 14px; }

.menubar-clock {
    display: flex;
    gap: 8px;
    padding-left: 8px;
    font-weight: 500;
}

.clock-day { opacity: 0.8; text-transform: capitalize; }
.clock-time { font-variant-numeric: tabular-nums; }

/* ==========================================================
   Window
   ========================================================== */
.macos-window {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 30, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 10px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

.macos-window.minimized {
    opacity: 0;
    transform: scale(0.5) translateY(100%);
    pointer-events: none;
}

.macos-window.maximized { border-radius: 0; }

.window-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 38px;
    padding: 0 12px;
    background: rgba(50, 50, 50, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.window-titlebar:active { cursor: grabbing; }

/* Traffic Light Buttons */
.traffic-lights {
    display: flex;
    gap: 8px;
    align-items: center;
}

.traffic-lights-spacer { width: 68px; }

.traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.traffic-light .icon {
    opacity: 0;
    font-size: 8px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.6);
    line-height: 1;
    transition: opacity 0.15s;
}

.traffic-lights:hover .traffic-light .icon { opacity: 1; }

.traffic-light.red {
    background: linear-gradient(180deg, #ff5f57 0%, #e0443e 100%);
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

.traffic-light.yellow {
    background: linear-gradient(180deg, #ffbd2e 0%, #dea123 100%);
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

.traffic-light.green {
    background: linear-gradient(180deg, #28c940 0%, #1aab29 100%);
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

.traffic-light.red:hover { background: linear-gradient(180deg, #ff6961 0%, #ff5f57 100%); }
.traffic-light.yellow:hover { background: linear-gradient(180deg, #ffc845 0%, #ffbd2e 100%); }
.traffic-light.green:hover { background: linear-gradient(180deg, #3dd452 0%, #28c940 100%); }

.window-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.window-icon { font-size: 16px; }

.window-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.window-content {
    flex: 1;
    overflow: auto;
    background: rgba(20, 20, 20, 0.98);
}

.window-content::-webkit-scrollbar { width: 8px; height: 8px; }
.window-content::-webkit-scrollbar-track { background: transparent; }
.window-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }
.window-content::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

.resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, 
        transparent 0%, transparent 50%,
        rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.1) 100%);
}

.resize-handle:hover {
    background: linear-gradient(135deg, 
        transparent 0%, transparent 50%,
        rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 100%);
}

/* ==========================================================
   Dock
   ========================================================== */
.macos-dock {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.dock-container {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(40, 40, 40, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.4),
        0 0 0 0.5px rgba(255, 255, 255, 0.05) inset;
}

.dock-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dock-item:hover {
    transform: translateY(-10px) scale(1.4);
}

.dock-item:hover + .dock-item,
.dock-item:has(+ .dock-item:hover) {
    transform: scale(1.15);
}

.dock-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: linear-gradient(145deg, rgba(80, 80, 80, 0.9) 0%, rgba(50, 50, 50, 0.9) 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.dock-item:hover .dock-icon {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dock-icon.minimized-icon {
    width: 42px;
    height: 42px;
    font-size: 26px;
    opacity: 0.7;
}

.running-indicator {
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    margin-top: 4px;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

.dock-separator {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 6px;
    align-self: center;
}

/* Dock Tooltip */
.dock-item::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(30, 30, 30, 0.95);
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dock-item:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Bounce animation */
@keyframes dock-bounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-12px); }
    50% { transform: translateY(-6px); }
    75% { transform: translateY(-10px); }
}

.dock-item.bouncing { animation: dock-bounce 0.5s ease-in-out; }

.dock-item.minimized-window .dock-icon {
    background: linear-gradient(145deg, rgba(90, 90, 90, 0.9) 0%, rgba(60, 60, 60, 0.9) 100%);
}

/* ==========================================================
   Spotlight
   ========================================================== */
.spotlight-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    padding-top: 15vh;
    z-index: 20000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-out;
}

.spotlight-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.spotlight-container {
    width: 600px;
    max-width: 90vw;
    background: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    animation: spotlight-appear 0.15s ease-out;
    max-height: 60vh;
}

@keyframes spotlight-appear {
    from {
        transform: scale(0.95) translateY(-10px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.spotlight-search {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spotlight-icon {
    font-size: 20px;
    margin-right: 12px;
    opacity: 0.6;
}

.spotlight-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 20px;
    font-weight: 300;
}

.spotlight-input::placeholder { color: rgba(255, 255, 255, 0.4); }

.spotlight-results {
    max-height: 400px;
    overflow-y: auto;
}

.spotlight-result {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.1s;
}

.spotlight-result:hover,
.spotlight-result.selected {
    background: rgba(239, 68, 68, 0.3);
}

.result-icon {
    font-size: 24px;
    margin-right: 14px;
    width: 32px;
    text-align: center;
}

.result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.result-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.result-subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-top: 2px;
}

.result-category {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.spotlight-no-results {
    padding: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.spotlight-results::-webkit-scrollbar { width: 6px; }
.spotlight-results::-webkit-scrollbar-track { background: transparent; }
.spotlight-results::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }

/* ==========================================================
   Window App Content
   ========================================================== */
.window-app-content {
    color: #ffffff;
    min-height: 100%;
}

.window-app-content .glass-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .windows-area { bottom: 70px; }
    .dock-icon { width: 44px; height: 44px; font-size: 28px; }
    .menubar-menu-items { display: none; }
}
