/* Core Styling Variables & System Framework */
:root {
    --bg-dark: #0a0b16; /* Premium dark slate-navy background */
    --window-bg: rgba(18, 18, 18, 0.17);
    --window-border: rgba(255, 255, 255, 0.12);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent: #00b4d8; /* Premium blue accent */
    --accent-hover: #48cae4;
    --danger: #ff5555;
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --taskbar-height: 48px;

    /* Background glow and grid variables */
    --grid-line: color-mix(in srgb, var(--accent) 8%, rgba(255, 255, 255, 0.05));
    --grid-glow: color-mix(in srgb, var(--accent) 30%, transparent);
    --taskbar-bg: rgba(10, 10, 18, 0.45);

    /* Theme-specific variables */
    --panel-bg: rgba(0, 0, 0, 0.25);
    --select-options-bg: rgba(20, 20, 20, 0.95);
    --dialog-bg: rgba(20, 20, 20, 0.95);
    --dialog-overlay: rgba(0, 0, 0, 0.65);
    --context-menu-bg: rgba(15, 15, 15, 0.95);
    --shadow-color: rgba(0, 0, 0, 0.6);
    --shadow-inset: rgba(255, 255, 255, 0.1);
    --item-bg: rgba(255, 255, 255, 0.03);
    --item-hover: rgba(255, 255, 255, 0.08);
    --item-border: rgba(255, 255, 255, 0.05);
    --titlebar-bg: rgba(255, 255, 255, 0.03);
}

html {
    font-size: 16px;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
}

html.font-small {
    font-size: 14px;
}

html.font-large {
    font-size: 18px;
}

html.font-family-inter {
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html.font-family-poppins {
    --font-stack: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html.font-family-mono {
    --font-stack: 'JetBrains Mono', monospace;
}

html.theme-light {
    --bg-dark: #f4f5f8; /* Soft premium light-gray background */
    --window-bg: rgba(255, 255, 255, 0.17);
    --window-border: rgba(0, 0, 0, 0.08);
    --text-primary: #121212;
    --text-secondary: #55555d;
    --grid-line: color-mix(in srgb, var(--accent) 8%, rgba(0, 0, 0, 0.04));
    --grid-glow: color-mix(in srgb, var(--accent) 18%, transparent);
    --taskbar-bg: rgba(245, 246, 250, 0.45);
    --panel-bg: rgba(0, 0, 0, 0.04);
    --select-options-bg: rgba(255, 255, 255, 0.96);
    --dialog-bg: rgba(255, 255, 255, 0.96);
    --dialog-overlay: rgba(0, 0, 0, 0.35);
    --context-menu-bg: rgba(255, 255, 255, 0.96);
    --shadow-color: rgba(0, 0, 0, 0.15);
    --shadow-inset: rgba(255, 255, 255, 0.6);
    --item-bg: rgba(0, 0, 0, 0.02);
    --item-hover: rgba(0, 0, 0, 0.05);
    --item-border: rgba(0, 0, 0, 0.05);
    --titlebar-bg: rgba(0, 0, 0, 0.03);
}

html.theme-light .icon-label {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

html.theme-dark {
    --bg-dark: #0a0b16;
    --window-bg: rgba(18, 18, 18, 0.17);
    --window-border: rgba(255, 255, 255, 0.12);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --grid-line: color-mix(in srgb, var(--accent) 8%, rgba(255, 255, 255, 0.05));
    --grid-glow: color-mix(in srgb, var(--accent) 30%, transparent);
    --taskbar-bg: rgba(10, 10, 18, 0.45);
    --panel-bg: rgba(0, 0, 0, 0.25);
    --select-options-bg: rgba(20, 20, 20, 0.95);
    --dialog-bg: rgba(20, 20, 20, 0.95);
    --dialog-overlay: rgba(0, 0, 0, 0.65);
    --context-menu-bg: rgba(15, 15, 15, 0.95);
    --shadow-color: rgba(0, 0, 0, 0.6);
    --shadow-inset: rgba(255, 255, 255, 0.1);
    --item-bg: rgba(255, 255, 255, 0.03);
    --item-hover: rgba(255, 255, 255, 0.08);
    --item-border: rgba(255, 255, 255, 0.05);
    --titlebar-bg: rgba(255, 255, 255, 0.03);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: 
        radial-gradient(ellipse at 50% 0%, var(--grid-glow) 0%, transparent 70%) no-repeat,
        radial-gradient(circle at 10% 90%, color-mix(in srgb, var(--accent) 20%, transparent) 0%, transparent 55%) no-repeat,
        radial-gradient(circle at 90% 40%, color-mix(in srgb, var(--accent) 15%, transparent) 0%, transparent 50%) no-repeat,
        var(--bg-dark);
    background-attachment: fixed;
    color: var(--text-primary);
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    font-family: var(--font-stack);
    position: relative;
    user-select: none;
    transition: background 0.4s ease, background-color 0.4s ease;
}

body::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    z-index: -1;
    background-image:
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
        linear-gradient(0deg, var(--grid-line) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    transform: rotate(135deg);
    animation: gridScroll 7s linear infinite;
    will-change: background-position;
}

@keyframes gridScroll {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 0 -60px;
    }
}

/* Desktop Canvas */
.desktop {
    width: 100%;
    height: calc(100vh - var(--taskbar-height, 48px));
    height: calc(100dvh - var(--taskbar-height, 48px));
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

/* Desktop Icon (Folder) */
.desktop-icon {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100px;
    padding: 12px 6px;
    border-radius: 8px;
    cursor: grab;
    border: 1px solid transparent;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.desktop-icon:active {
    cursor: grabbing;
}

.desktop-icon.snapping {
    transition: left 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), 
                top 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
                background-color 0.2s, 
                transform 0.1s;
}

.desktop-icon.dragging {
    opacity: 0.65;
    z-index: 999;
}

.desktop-icon:hover {
    background-color: var(--item-hover);
    border-color: var(--window-border);
    transform: translateY(-2px);
}

.icon-svg {
    width: 48px;
    height: 48px;
    background-color: var(--accent);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    display: inline-block;
    filter: drop-shadow(0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent));
}

.icon-svg.size-sm {
    width: 16px;
    height: 16px;
    filter: none;
}

.icon-svg.size-md {
    width: 24px;
    height: 24px;
    filter: none;
}

.icon-label {
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Pop-up Window (Modal) */
.window {
    position: absolute;
    top: 60px;
    left: calc(50vw - 240px); /* Centers the 480px window */
    transform: scale(0.95);
    width: 480px;
    max-width: 90%;
    max-height: calc(100% - 100px);
    background: color-mix(in srgb, var(--accent) 8%, var(--window-bg));
    border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--window-border));
    border-radius: 12px;
    box-shadow: 0 15px 35px var(--shadow-color), 
                inset 0 1px 1px var(--shadow-inset);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.38s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.38s cubic-bezier(0.16, 1, 0.3, 1),
                top 0.38s cubic-bezier(0.16, 1, 0.3, 1),
                border-radius 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.window.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

/* Disable transitions entirely during live drag or resize cycles */
.window.window-dragging,
.window.window-resizing {
    transition: none !important;
}

/* Window Titlebar */
.window-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--titlebar-bg);
    border-bottom: 1px solid var(--window-border);
    cursor: grab;
}

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

.window-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.window-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    position: relative;
    background-color: rgba(255, 255, 255, 0.2);
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn::before {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    line-height: 1;
    color: rgba(0, 0, 0, 0.75);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.control-btn:hover::before {
    opacity: 1;
}

.control-btn.close {
    background-color: var(--danger);
}

.control-btn.close:hover {
    background-color: #ff3333;
}

.control-btn.close::before {
    content: "×";
    font-size: 9px;
    margin-top: -2px;
}

.control-btn.minimize::before {
    content: "−";
    font-size: 10px;
    margin-top: -2px;
}

.control-btn.maximize {
    background-color: #28c940;
}

.control-btn.maximize:hover {
    background-color: #1f9c32;
}

.control-btn.maximize::before {
    content: "+";
    font-size: 9px;
    margin-top: -2px;
}

/* Maximized Window state */
.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    transform: none !important;
}

/* Ensure maximized titlebar has a distinct solid glass background and is clearly defined */
.window.maximized .window-titlebar {
    background: color-mix(in srgb, var(--accent) 15%, rgba(15, 15, 15, 0.9));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

/* Window Body */
.window-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.window-body h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.window-body p {
    margin-bottom: 16px;
}

.window-body p:last-child {
    margin-bottom: 0;
}

/* Global Scrollbar Styling */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Specific Default Positions for Desktop Icons */
#about-folder {
    left: 20px;
    top: 20px;
}

#settings-folder {
    left: 20px;
    top: 120px;
}

#taskmanager-folder {
    left: 20px;
    top: 220px;
}

#contact-folder {
    left: 20px;
    top: 320px;
}

#browser-folder {
    left: 20px;
    top: 420px;
}

#calendar-folder {
    left: 20px;
    top: 520px;
}

#calculator-folder {
    left: 20px;
    top: 620px;
}

#notepad-folder {
    left: 20px;
    top: 720px;
}

#music-folder {
    left: 20px;
    top: 820px;
}

#paint-folder {
    left: 20px;
    top: 920px;
}

#explorer-folder {
    left: 130px;
    top: 20px;
}

/* Selection Marquee */
.selection-marquee {
    position: absolute;
    background-color: color-mix(in srgb, var(--accent) 15%, transparent);
    border: 1px solid var(--accent);
    border-radius: 2px;
    z-index: 99;
    pointer-events: none;
    display: none;
}

.desktop-icon.selected {
    background-color: color-mix(in srgb, var(--accent) 18%, transparent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Desktop Context Menu */
.ctx-menu {
    position: fixed;
    z-index: 90000;
    min-width: 180px;
    padding: 6px;
    background: var(--select-options-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--window-border);
    border-radius: 8px;
    box-shadow: 0 8px 32px var(--shadow-color);
    transform-origin: top left;
    display: none;
    animation: ctxOpen 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes ctxOpen {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.ctx-item:hover {
    background: var(--item-hover);
    color: var(--text-primary);
}

.ctx-divider {
    height: 1px;
    margin: 6px 8px;
    background: var(--window-border);
}

/* --- TASKBAR STYLES --- */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--taskbar-height, 48px);
    background: var(--taskbar-bg);
    border-top: 1px solid var(--window-border);
    box-shadow: 0 -4px 20px var(--shadow-color);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    user-select: none;
}

.start-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--window-border);
    border-radius: 6px;
    padding: 6px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.start-btn:hover {
    background: var(--item-hover);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (hover: hover) {
    .start-btn:hover {
        transform: translateY(-1px);
    }
    .start-btn:active {
        transform: translateY(0);
    }
}

.start-btn-icon {
    color: var(--accent);
    font-size: 0.9rem;
    filter: drop-shadow(0 0 4px var(--accent));
}

.taskbar-tabs {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 16px;
    overflow-x: auto;
    height: 100%;
}

.taskbar-tabs::-webkit-scrollbar {
    display: none;
}

.taskbar-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--window-border);
    border-radius: 6px;
    padding: 6px 14px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.taskbar-tab:hover {
    background: var(--item-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.taskbar-tab.active-tab {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--accent) 15%, var(--item-hover));
    border-color: var(--accent);
}

.taskbar-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: transparent;
    border-radius: 2px;
    transition: background 0.2s;
}

.taskbar-tab.active-tab::after {
    background: var(--accent);
}

.taskbar-tab.minimized-tab {
    opacity: 0.6;
}

.taskbar-tray {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--window-border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* --- START MENU STYLES --- */
.start-menu {
    position: fixed;
    bottom: calc(var(--taskbar-height, 48px) + 8px);
    left: 8px;
    width: 320px;
    background: 
        radial-gradient(ellipse at 50% 0%, var(--grid-glow) 0%, transparent 70%) no-repeat,
        radial-gradient(circle at 10% 90%, color-mix(in srgb, var(--accent) 20%, transparent) 0%, transparent 55%) no-repeat,
        radial-gradient(circle at 90% 40%, color-mix(in srgb, var(--accent) 15%, transparent) 0%, transparent 50%) no-repeat,
        var(--bg-dark);
    background-attachment: fixed;
    border: 1px solid var(--window-border);
    border-radius: 12px;
    box-shadow: 0 15px 35px var(--shadow-color), 
                inset 0 1px 1px var(--shadow-inset);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.start-menu.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.start-menu-header {
    padding: 16px 16px 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-mask {
    display: block;
    width: 100%;
    height: 100%;
    background-color: var(--accent);
    -webkit-mask: url('../assets/tblogo.png') no-repeat center / contain;
    mask: url('../assets/tblogo.png') no-repeat center / contain;
    transition: background-color 0.4s ease;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-status {
    font-size: 0.7rem;
    color: #2ecc71;
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #2ecc71;
    border-radius: 50%;
}

/* ─── Search Bar ─── */
.start-menu-search {
    padding: 0 16px;
    margin-bottom: 12px;
    position: relative;
    flex-shrink: 0;
}

.start-search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0.5;
    line-height: 1;
}

#start-search {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--window-border);
    border-radius: 8px;
    background: var(--item-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    outline: none;
    transition: all 0.15s ease;
}

#start-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
    background: var(--item-hover);
}

#start-search::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ─── Sections ─── */
.start-section {
    padding: 0 16px;
    flex-shrink: 0;
}

.start-section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 4px 8px;
    opacity: 0.8;
}

.start-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 4px;
}

.start-toggle-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.start-toggle-btn:hover {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.start-divider {
    height: 1px;
    margin: 10px 16px;
    background: var(--window-border);
    flex-shrink: 0;
}

/* ─── Pinned Apps Grid ─── */
.start-pinned-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-bottom: 6px;
}

.start-pin {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px 10px;
    border: 1px solid var(--item-border);
    border-radius: 8px;
    background: var(--item-bg);
    cursor: pointer;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
}

.start-pin:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--accent) 20%, transparent);
    transform: translateY(-1px);
}

@media (hover: hover) {
    .start-pin:active {
        transform: scale(0.95);
    }
}

.start-pin span {
    font-size: 1.4rem;
    line-height: 1;
}

.start-pin small {
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.start-pin:hover small {
    color: var(--text-primary);
}

/* ─── App List (All Apps + Search Results) ─── */
.start-menu-list {
    list-style: none;
    padding: 4px 0;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.start-menu-list::-webkit-scrollbar {
    width: 4px;
}

.start-menu-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.start-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.start-menu-item:hover {
    background: var(--item-hover);
    border-color: var(--item-border);
}

.start-menu-item span.icon-svg {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.start-no-results {
    text-align: center;
    padding: 20px 16px;
    color: var(--text-secondary);
    opacity: 0.6;
    font-size: 0.8rem;
}

.start-menu-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--window-border);
}

.mono-sm {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.shutdown-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.shutdown-btn:hover {
    background: var(--item-hover);
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.1);
}

.shutdown-icon {
    width: 16px;
    height: 16px;
}

/* --- SHUTDOWN OVERLAY STYLES --- */
.shutdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    opacity: 0;
    transition: opacity 0.8s ease;
    background: 
        radial-gradient(ellipse at 50% 0%, var(--grid-glow) 0%, transparent 70%) no-repeat,
        radial-gradient(circle at 10% 90%, color-mix(in srgb, var(--accent) 20%, transparent) 0%, transparent 55%) no-repeat,
        radial-gradient(circle at 90% 40%, color-mix(in srgb, var(--accent) 15%, transparent) 0%, transparent 50%) no-repeat,
        var(--bg-dark);
    background-attachment: fixed;
}

/* --- WINDOW MINIMIZE STYLES --- */
.control-btn.minimize {
    background-color: #ffbd2e;
}

.control-btn.minimize:hover {
    background-color: #e0a320;
}

.window.minimized {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(40px);
}

/* --- WINDOW RESIZE HANDLES --- */
.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    z-index: 9999;
    background: transparent;
}
.resize-handle.tl {
    top: -6px;
    left: -6px;
    cursor: nwse-resize;
}
.resize-handle.tr {
    top: -6px;
    right: -6px;
    cursor: nesw-resize;
}
.resize-handle.bl {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}
.resize-handle.br {
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
}

/* --- DESKTOP REFRESH ANIMATION --- */
@keyframes refreshIcon {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    40% {
        opacity: 0;
        transform: scale(0.82);
    }
    60% {
        opacity: 0;
        transform: scale(0.82);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.desktop-icon.refresh-animate {
    animation: refreshIcon 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* ==========================================
   RESPONSIVE DESIGN (MOBILE & TABLET SUPPORT)
   ========================================== */
@media (max-width: 600px) {
    /* ─── Taskbar Responsiveness ─── */
    .start-btn-text {
        display: none !important;
    }
    .start-btn {
        padding: 6px 10px !important;
    }
    .taskbar-tabs {
        margin: 0 8px !important;
        gap: 4px !important;
    }
    .taskbar-tab {
        padding: 6px 8px !important;
        width: 32px !important;
        justify-content: center !important;
    }
    .taskbar-tab .tab-title {
        display: none !important;
    }
    .tray-clock {
        font-size: 0.72rem !important;
    }

    /* ─── Window Responsiveness on Mobile (Force Fullscreen / Maximized Layout) ─── */
    .window {
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        transform: scale(1) !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    .window.minimized {
        display: none !important;
    }
    
    .resize-handle {
        display: none !important;
    }

    /* ─── Start Menu Responsiveness on Mobile ─── */
    .start-menu {
        width: calc(100% - 16px) !important;
        left: 8px !important;
        bottom: calc(var(--taskbar-height, 48px) + 8px) !important;
    }
}

/* ─── Screen Height Constraints (Prevents bottom cutoff on low-height screens) ─── */
@media (max-height: 720px) and (min-width: 601px) {
    .window:not(.maximized) {
        top: 30px !important;
        max-height: calc(100% - var(--taskbar-height, 48px) - 40px) !important;
    }
}

/* ─── Screen Width Constraints for Medium Viewports (Tablets / Resized Desktop Windows) ─── */
@media (max-width: 800px) and (min-width: 601px) {
    .window:not(.maximized) {
        left: 20px !important;
        width: calc(100% - 40px) !important;
        max-width: calc(100% - 40px) !important;
    }
}
