/* ==========================================================================
   CORE APPLICATION SHELL & LAYOUT MẶC ĐỊNH
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--apple-gray-bg);
    color: var(--apple-text-main);
    overflow-x: hidden;
    min-height: 100vh;
    font-size: var(--base-font-size);
    line-height: var(--base-line-height);
    letter-spacing: var(--base-letter-spacing);
}

/* Không gian Desktop */
.mac-desktop {
    padding: 40px 20px 120px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* Kiến trúc cửa sổ Window Shell */
.mac-window {
    background: var(--mac-window-bg);
    backdrop-filter: var(--mac-blur);
    -webkit-backdrop-filter: var(--mac-blur);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 900px;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.mac-titlebar {
    background: var(--mac-titlebar-bg);
    padding: 12px 16px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.mac-controls {
    display: flex;
    gap: 8px;
    position: absolute;
    left: 16px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.control.close { background: #ff5f56; border: 0.5px solid #e0443e; }
.control.minimize { background: #ffbd2e; border: 0.5px solid #dea123; }
.control.maximize { background: #27c93f; border: 0.5px solid #1aab29; }

.mac-title {
    width: 100%;
    text-align: center;
    font-size: var(--titlebar-font-size);
    font-weight: 600;
    user-select: none;
    color: var(--apple-text-main);
}

.mac-content {
    padding: 24px;
    min-height: 300px;
}

/* Màn hình chờ tải hệ thống */
.core-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    gap: 12px;
    color: var(--apple-text-secondary);
}
.core-loading i {
    font-size: 28px;
    color: var(--apple-blue);
}

/* THANH HỆ THỐNG SYSTEM DOCK */
.mac-dock-wrapper {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.mac-dock {
    background: var(--mac-dock-bg);
    backdrop-filter: var(--mac-blur);
    -webkit-backdrop-filter: var(--mac-blur);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.dock-item {
    background: none;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}
.dock-item i {
    font-size: 22px;
    color: #424245;
}
.dock-item:hover {
    transform: scale(1.15) translateY(-5px);
    background: rgba(255, 255, 255, 0.5);
}
.dock-item.active i { color: var(--apple-blue); }

.dock-dot {
    width: 4px;
    height: 4px;
    background: var(--apple-blue);
    border-radius: 50%;
    position: absolute;
    bottom: 2px;
    display: none;
}
.dock-item.active .dock-dot { display: block; }

.dock-separator {
    width: 1px;
    height: 32px;
    background: rgba(0, 0, 0, 0.15);
}

.hidden { display: none !important; }

/* ==========================================================================
   TỐI ƯU CHO IPHONE / MOBILE
   ========================================================================== */
@media (max-width: 768px) {
    .mac-desktop { padding: 10px 10px 100px 10px; }
    .mac-window { border-radius: 12px; }
    .mac-titlebar { border-top-left-radius: 12px; border-top-right-radius: 12px; padding: 14px; }
    .mac-controls { display: none; } /* Ẩn 3 nút thu nhỏ cửa sổ trên mobile cho thoáng */
    .mac-content { padding: 16px; }
    
    .mac-dock { padding: 6px; gap: 8px; border-radius: 16px; }
    .dock-item { width: 42px; height: 42px; border-radius: 10px; }
    .dock-item i { font-size: 18px; }
    .dock-separator { height: 24px; }
}