/* macOS Desktop Styles */
:root {
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.3);
    --dock-bg: rgba(255, 255, 255, 0.2);
    --window-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

body {
    overflow: hidden; /* Prevent body scroll, desktop metaphor */
    background-size: cover;
    background-position: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Desktop Icon Grid */
.desktop-icons {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    height: calc(100vh - 4rem); /* Subtract top bar and dock area */
    padding: 10px;
    gap: 10px;
}

.desktop-icon {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 5px;
    border-radius: 5px;
    cursor: default;
    border: 1px solid transparent;
    transition: background 0.2s;
}

.desktop-icon:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.desktop-icon.selected {
    background-color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.icon-image {
    font-size: 40px;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.2));
    margin-bottom: 5px;
}

.icon-label {
    color: white;
    text-align: center;
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    line-height: 1.2;
    padding: 2px 4px;
    border-radius: 3px;
}

.desktop-icon.selected .icon-label {
    background-color: #0063e1;
}

/* Window Styles */
.window {
    position: absolute;
    background: #f5f5f5;
    border-radius: 10px;
    box-shadow: var(--window-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 300px;
    min-height: 200px;
    resize: both;
    /* border: 1px solid rgba(0,0,0,0.1); */
    transition: transform 0.2s, opacity 0.2s;
}

.window.minimized {
    transform: scale(0) translate(0, 100vh);
    opacity: 0;
    pointer-events: none;
}

.window-header {
    height: 28px;
    background: #e3e3e3; /* Light grey header */
    border-bottom: 1px solid #d1d1d1;
    display: flex;
    align-items: center;
    padding: 0 10px;
    cursor: default;
    user-select: none;
}

.window.active .window-header {
    background: #efefef; /* Slightly lighter when active */
}

.window-controls {
    display: flex;
    gap: 6px;
    margin-right: 10px;
}

.control-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 0.5px solid rgba(0,0,0,0.1);
    position: relative;
}

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

/* Hover effects for buttons (symbols) */
.window-controls:hover .close-btn::before { content: '×'; position: absolute; top: -2px; left: 2px; font-size: 10px; color: rgba(0,0,0,0.5); }
.window-controls:hover .minimize-btn::before { content: '−'; position: absolute; top: -2px; left: 2px; font-size: 10px; color: rgba(0,0,0,0.5); }
.window-controls:hover .maximize-btn::before { content: '+'; position: absolute; top: -1px; left: 2px; font-size: 10px; color: rgba(0,0,0,0.5); }


.window-title {
    flex-grow: 1;
    text-align: center;
    font-size: 13px;
    color: #333;
    font-weight: 500;
    margin-right: 40px; /* Balance the controls */
}

.window-content {
    flex-grow: 1;
    overflow: auto;
    position: relative;
    background: white;
}

.window iframe {
    width: 100%;
    height: 100%;
    border: none;
}

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

.dock {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 8px;
    display: flex;
    gap: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    height: 64px;
    align-items: center;
}

.dock-item {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, margin 0.2s;
    position: relative;
    cursor: pointer;
}

.dock-item:hover {
    transform: scale(1.1) translateY(-10px);
    background: rgba(255, 255, 255, 0.3);
    margin: 0 5px;
}

.dock-item.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    width: 4px;
    height: 4px;
    background: black; /* Or white depending on theme */
    border-radius: 50%;
}

.dock-tooltip {
    position: absolute;
    top: -40px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.dock-item:hover .dock-tooltip {
    opacity: 1;
}

/* Menu Bar */
.top-bar {
    height: 28px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    font-size: 13px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    position: relative;
    box-shadow: 0 1px 0 rgba(255,255,255,0.1);
}

.top-bar-left, .top-bar-right {
    display: flex;
    gap: 16px;
    align-items: center;
}

.apple-logo {
    font-size: 16px;
}

/* Clock Dropdown */
#top-bar-clock {
    position: relative;
    cursor: pointer;
    display: inline-block; /* Ensure it takes width */
    min-width: 150px;      /* Give it enough space */
    text-align: right;
}

#clock-dropdown {
    position: absolute;
    top: 28px;
    right: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0 0 8px 8px;
    padding: 10px;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: none;
    color: #333;
    border: 1px solid rgba(0,0,0,0.1);
    border-top: none;
}

#clock-dropdown.show {
    display: block;
}

.clock-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: 4px;
}

.clock-item:hover {
    background: rgba(0,0,0,0.05);
}

.clock-city {
    font-weight: 600;
}

.clock-time {
    font-variant-numeric: tabular-nums;
}
