:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --dock-bg: rgba(255, 255, 255, 0.1);
    --dock-border: rgba(255, 255, 255, 0.2);
    --window-bg: rgba(30, 30, 30, 0.85);
    --window-header-bg: rgba(40, 40, 40, 0.95);
    --accent-color: #0a84ff;
    --glass-blur: blur(20px);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Desktop Wallpaper */
.desktop {
    width: 100%;
    height: 100%;
    background: url('../assets/macos-dark-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Fallback background if image missing */
.desktop::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #502c4e 0%, #2a1f3d 100%);
    z-index: -1;
}

/* Top Bar */
.top-bar {
    height: 30px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-size: 14px;
    z-index: 10000;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.apple-logo {
    font-weight: bold;
    font-size: 16px;
}

.menu-item {
    font-weight: 500;
    opacity: 0.9;
}

.menu-item:hover {
    opacity: 1;
}

/* Dock */
.dock-container {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    z-index: 10000;
}

.dock {
    background: var(--dock-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--dock-border);
    border-radius: 24px;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
}

.dock-item {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.dock-item:hover {
    transform: scale(1.2) translateY(-10px);
    margin: 0 10px;
}

.dock-item.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

.dock-tooltip {
    position: absolute;
    top: -40px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dock-item:hover .dock-tooltip {
    opacity: 1;
}

/* Windows */
.window {
    position: absolute;
    background: var(--window-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 300px;
    min-height: 200px;
    transition: transform 0.1s, opacity 0.2s;
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.window.open {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

.window.minimized {
    opacity: 0;
    transform: scale(0) translateY(100%);
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.window-header {
    height: 38px;
    background: var(--window-header-bg);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    cursor: default;
    /* Changed from move to handle drag area specifically */
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    position: relative;
}

.close-btn {
    background: #ff5f56;
}

.minimize-btn {
    background: #ffbd2e;
}

.maximize-btn {
    background: #27c93f;
}

.control-btn:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(0, 0, 0, 0.5);
    font-size: 8px;
    font-weight: bold;
}

.close-btn:hover::before {
    content: 'x';
}

.minimize-btn:hover::before {
    content: '-';
}

.maximize-btn:hover::before {
    content: '+';
}

.window-title {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.window-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    color: #eee;
    user-select: text;
    -webkit-user-select: text;
}

/* Scrollbar Styling */
.window-content::-webkit-scrollbar {
    width: 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);
}

/* Typography inside windows */
.window-content h1,
.window-content h2,
.window-content h3 {
    margin-top: 0;
}

.window-content a {
    color: var(--accent-color);
    text-decoration: none;
}

.window-content a:hover {
    text-decoration: underline;
}

/* Specific App Styles */
.terminal-app {
    background: rgba(20, 20, 20, 0.95);
    font-family: 'Courier New', Courier, monospace;
}

.terminal-text {
    color: #33ff00;
}

/* Particles Background */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .desktop {
        background: #000;
        /* Ensure dark background for particles */
    }

    .hide-on-mobile {
        display: none;
    }

    .dock-container {
        width: 100%;
        padding: 0 10px;
    }

    .dock {
        padding: 8px;
        gap: 8px;
        width: 100%;
        justify-content: space-around;
        border-radius: 16px;
    }

    .dock-item {
        width: 45px;
        height: 45px;
        margin: 0 !important;
        /* Override hover margin */
        font-size: 20px;
    }

    .dock-item:hover {
        transform: none;
        /* Disable magnification on mobile */
    }

    .dock-tooltip {
        display: none;
        /* Hide tooltips on mobile */
    }

    .window {
        width: 100% !important;
        height: calc(100% - 85px) !important;
        /* Top bar + Dock space */
        top: 30px !important;
        left: 0 !important;
        border-radius: 0;
        border: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .window.maximized {
        height: calc(100% - 85px) !important;
    }

    .window-content {
        padding: 15px;
    }
}