/* ===== CSS Variables ===== */
:root {
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 20px;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.5);
    --menu-bar-height: 32px;
    --dock-icon-size: 64px;
    --dock-icon-size-hover: 86px;
    --dock-padding: 4px;
    --dock-border-radius: 16px;
    --window-border-radius: 12px;
    --control-close: #ff5f57;
    --control-minimize: #febc2e;
    --control-maximize: #28c840;
    --transition-fast: 0.15s ease;
    --transition-medium: 0.25s ease;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: #0a0a0a;
    background-image: url('assets/bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ===== Glass Effect ===== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
}

/* ===== Menu Bar ===== */
.menu-bar {
    background: rgba(255, 255, 255, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--menu-bar-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px;
    z-index: 1000;
    border: none;
    border-bottom: 1px solid var(--glass-border);
}

.menu-bar-left {
    display: flex;
    align-items: center;
    gap: 0;
    padding-left: 4px;
}

.menu-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item {
    padding: 4px 11px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), 0 36px 100px rgba(0, 0, 0, 0.7);
    transition: background var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

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

.app-name {
    cursor: default;
}

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

.app-name-light {
    font-weight: 400;
    color: var(--text-secondary);
}

.menu-bar-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-icon-wrapper {
    position: relative;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.menu-icon-wrapper svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
}

.menu-icon-svg {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.status-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 4px #22c55e;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 4px #22c55e;
    }
    50% {
        opacity: 0.5;
        box-shadow: 0 0 8px #22c55e, 0 0 12px #22c55e;
    }
}

.menu-time {
    font-weight: 600;
    font-size: 13px;
    cursor: default;
    margin-left: 11px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), 0 36px 100px rgba(0, 0, 0, 0.7);
}

/* ===== FML Dropdown Menu ===== */
.fml-dropdown {
    position: fixed;
    top: calc(var(--menu-bar-height) + 4px);
    right: 100px;
    min-width: 180px;
    border-radius: 10px;
    display: none;
    z-index: 1001;
    background: rgba(40, 40, 40, 0.6);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.fml-dropdown.active {
    display: block;
}

.dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #dfdedf;
    opacity: 0.9;
    letter-spacing: -0.25px;
    transition: background var(--transition-fast);
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}

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

.dropdown-item-left {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.dropdown-icon {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.dropdown-chevron {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

.dropdown-shortcut {
    font-weight: 400;
    color: rgba(235, 235, 245, 0.6);
    opacity: 0.76;
    font-size: 13px;
    letter-spacing: -0.25px;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
}

.dropdown-divider::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.5);
    mix-blend-mode: color-burn;
}

/* ===== Desktop ===== */
.desktop {
    position: fixed;
    top: var(--menu-bar-height);
    left: 0;
    right: 0;
    bottom: 0;
    padding: 48px;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.desktop-icons {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: flex-start;
    width: fit-content;
}

.desktop-icons-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: flex-end;
    width: fit-content;
}

.unsplash-thumb {
    width: 88px !important;
    height: 56px !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.unsplash-thumb img {
    object-fit: cover !important;
}

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

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

.desktop-icon.selected {
    background: rgba(59, 130, 246, 0.3);
}

.desktop-icon-image {
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.desktop-icon-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.desktop-icon-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.download-hint {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* ===== Dock ===== */
.dock {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px;
    border-radius: 28px;
    z-index: 100;
    height: 96px; /* fixed height: 88px icon + 8px padding */
}

.dock-items {
    display: flex;
    align-items: flex-end;
    gap: 0;
    height: 100%;
    overflow: visible;
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    z-index: 1;
    overflow: visible;
    transition: margin 0.15s ease-out;
    margin: 0;
}

/* Standard dock icon container - 88x88px fixed */
.dock-icon-container {
    width: 88px;
    height: 88px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: visible;
    position: relative;
}

.dock-icon-container img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    pointer-events: none;
    transition: transform 0.15s ease-out;
    transform-origin: bottom center;
}

/* Dot indicator - only for FML, positioned below the item */
.dock-dot {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
}

/* Dock tooltip */
.dock-item::after {
    content: attr(data-name);
    position: absolute;
    bottom: calc(100% + 38px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(30, 30, 30, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.dock-item:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Windows ===== */
.windows-container {
    position: fixed;
    top: var(--menu-bar-height);
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
}

.window {
    position: absolute;
    min-width: 400px;
    min-height: 300px;
    width: 600px;
    height: 400px;
    border-radius: var(--window-border-radius);
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    display: flex;
    flex-direction: column;
}

.window.minimized {
    transform: scale(0.1);
    opacity: 0;
    pointer-events: none;
}

.window-titlebar {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: rgba(30, 30, 30, 0.6);
    cursor: grab;
    flex-shrink: 0;
    position: relative;
}

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

.window-controls {
    display: flex;
    gap: 8px;
    z-index: 1;
}

.window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter var(--transition-fast);
}

.window-control svg {
    width: 8px;
    height: 8px;
    stroke-width: 2.5px;
    opacity: 0;
    color: rgba(0, 0, 0, 0.5);
    transition: opacity var(--transition-fast);
}

.window-controls:hover .window-control svg {
    opacity: 1;
}

.window-control.close {
    background: var(--control-close);
}

.window-control.minimize {
    background: var(--control-minimize);
}

.window-control.maximize {
    background: var(--control-maximize);
}

.window-control:hover {
    filter: brightness(0.9);
}

.window-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

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

.placeholder-content {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-content h2 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 20px;
}

.placeholder-content p {
    margin-bottom: 8px;
    line-height: 1.6;
}

.fml-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
}

/* ===== Readme Window ===== */
.readme-window {
    background: rgba(22, 22, 22, 0.6);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 542px;
    height: 600px;
}

.readme-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    padding-right: 52px;
    background: #1e1e1e;
    border-radius: 10px 10px 0 0;
    cursor: grab;
}

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

.readme-title {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 400;
    color: rgba(235, 235, 245, 0.6);
    letter-spacing: -0.052px;
}

.readme-content {
    flex: 1;
    overflow: auto;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0 0 10px 10px;
}

/* ===== Markdown Styles ===== */
.markdown {
    padding: 16px;
    font-size: 14px;
    font-weight: 400;
    color: white;
    line-height: 22px;
    letter-spacing: -0.05px;
    user-select: text;
    -webkit-user-select: text;
}

.markdown h2 {
    font-size: 16px;
    font-weight: 600;
    color: #e6e6e6;
    margin: 24px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown h2:first-child {
    margin-top: 0;
}

.markdown h3 {
    font-size: 15px;
    font-weight: 600;
    color: #d4d4d4;
    margin: 20px 0 10px 0;
}

.markdown p {
    margin: 12px 0;
    color: rgba(255, 255, 255, 0.9);
}

.markdown strong {
    font-weight: 600;
    color: #79c0ff;
}

.markdown code {
    background: rgba(110, 118, 129, 0.4);
    color: #ff7b72;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
}

.markdown a {
    color: #58a6ff;
    text-decoration: none;
}

.markdown a:hover {
    text-decoration: underline;
}

.markdown ul,
.markdown ol {
    margin: 12px 0;
    padding-left: 24px;
}

.markdown li {
    margin: 6px 0;
    color: rgba(255, 255, 255, 0.9);
}

.markdown .emoji {
    margin-right: 4px;
}

.markdown .green {
    color: #3fb950;
}

.markdown .yellow {
    color: #d29922;
}

.markdown .gray {
    color: #8b949e;
}

/* Markdown Table */
.markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}

.markdown th,
.markdown td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.markdown th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: #d4d4d4;
}

.markdown td {
    color: rgba(255, 255, 255, 0.8);
}

.markdown tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* ===== FML Browser Window ===== */
.fml-browser {
    background: rgba(22, 22, 22, 0.6);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 700px;
    height: 700px;
}

.browser-titlebar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px;
    background: #1e1e1e;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.15);
    cursor: grab;
}

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

.browser-title {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(235, 235, 245, 0.6);
    letter-spacing: -0.052px;
}

.browser-title-icon {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
}

.browser-navbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 8px;
    background: #373839;
}

.browser-nav-buttons {
    display: flex;
    gap: 8px;
}

.browser-nav-icon {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.5);
    stroke-width: 1.5;
}

.browser-url-bar {
    flex: 1;
    background: #202124;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: white;
}

.browser-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0 0 10px 10px;
}

.fml-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 48px;
    text-align: center;
}

.fml-welcome-icon {
    position: relative;
    width: 136px;
    height: 136px;
}

.fml-welcome-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
    border-radius: 28px;
}

.fml-welcome-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #84c860;
    border-radius: 50%;
    box-shadow: 0 0 8px #84c860;
}

.fml-welcome-title {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fml-welcome-name {
    font-size: 58px;
    font-weight: 600;
    color: white;
    line-height: 1;
}

.fml-welcome-tagline {
    font-size: 13px;
    font-weight: 600;
    color: #84c860;
    line-height: 16px;
}

.fml-welcome-desc {
    font-size: 20px;
    font-weight: 500;
    color: white;
    line-height: 28px;
    max-width: 480px;
    letter-spacing: -0.08px;
}

.fml-shortcut {
    color: #7d838c;
}

.fml-download-btn {
    background: white;
    color: #181818;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 24px;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    cursor: pointer;
}

.fml-download-btn:hover {
    background: #7df58e;
}

/* Window resize handle */
.window-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

.window-resize-handle::before {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(255, 255, 255, 0.2);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

/* Window focus states */
.window.focused {
    z-index: 100;
}

.window:not(.focused) .window-titlebar {
    background: rgba(50, 50, 50, 0.6);
}

.window:not(.focused) .window-control {
    background: rgba(128, 128, 128, 0.5);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Animations ===== */
@keyframes windowOpen {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.window.opening {
    animation: windowOpen 0.2s ease-out forwards;
}

@keyframes windowClose {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.window.closing {
    animation: windowClose 0.15s ease-in forwards;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .menu-item.download-link {
        display: none;
    }
    
    .menu-time {
        display: none;
    }
    
    /* Windows - full width on mobile */
    .window,
    .readme-window,
    .fml-browser {
        width: calc(100vw - 16px) !important;
        min-width: auto !important;
        max-width: none !important;
        left: 8px !important;
        max-height: calc(100vh - 150px);
    }
    
    .readme-window,
    .fml-browser {
        height: auto !important;
        max-height: calc(100vh - 150px);
    }
    
    .browser-content,
    .readme-content {
        min-height: 300px;
    }
    
    .fml-welcome {
        padding: 24px;
        gap: 24px;
    }
    
    .fml-welcome-icon {
        width: 100px;
        height: 100px;
    }
    
    .fml-welcome-name {
        font-size: 42px;
    }
    
    .fml-welcome-desc {
        font-size: 16px;
        line-height: 24px;
    }
    
    /* Dock - smaller icons on mobile */
    .dock {
        height: 64px;
        padding: 4px;
        border-radius: 18px;
    }
    
    .dock-icon-container {
        width: 56px;
        height: 56px;
    }
    
    .dock-icon-container img {
        width: 56px;
        height: 56px;
    }
    
    .dock-item::after {
        bottom: calc(100% + 8px);
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* Desktop - smaller padding and icons */
    .desktop {
        padding: 16px;
    }
    
    .desktop-icon-image {
        width: 64px;
        height: 64px;
    }
    
    .desktop-icon-label {
        font-size: 12px;
    }
    
    .unsplash-thumb {
        width: 64px !important;
        height: 40px !important;
    }
    
    /* Dropdown menu positioning */
    .fml-dropdown {
        right: 8px;
        left: 8px;
        min-width: auto;
    }
}

