/* ================================================================
   STC ALLCONTROL — DESKTOP OS (Windows 11 Style)
   Glassmorphism + Taskbar + Start Menu + Window Manager
   ================================================================ */

/* ======================== VARIABLES ======================== */
:root {
    --desk-taskbar-h: 52px;
    --desk-glass-bg: rgba(20, 20, 22, 0.55);
    --desk-glass-border: rgba(255, 255, 255, 0.15);
    --desk-glass-blur: 60px;
    --desk-accent: #3b82f6;
    --desk-accent-bg: rgba(59, 130, 246, 0.12);
    --desk-text: #ffffff;
    --desk-text-secondary: rgba(255, 255, 255, 0.75);
    --desk-text-muted: rgba(255, 255, 255, 0.45);
    --desk-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    --desk-radius: 14px;
    --desk-win-radius: 10px;
}

/* ======================== WALLPAPER ======================== */
.desktop-wallpaper {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.6s ease;
}

/* ======================== DESKTOP SURFACE ======================== */
.desktop-surface {
    position: fixed;
    inset: 0;
    bottom: 0;
    z-index: 1;
    overflow: hidden;
}

/* Desktop icons grid */
.desktop-icons {
    position: absolute;
    top: 16px;
    left: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 80px);
    grid-auto-rows: 90px;
    gap: 4px;
    max-width: 400px;
    z-index: 2;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border: 1px solid transparent;
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.desktop-icon.selected {
    background: rgba(96, 205, 255, 0.15);
    border-color: rgba(96, 205, 255, 0.3);
}

.desktop-icon-img {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 18px;
    color: #fff;
}

.desktop-icon-label {
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Desktop icons — free position (draggable) */
.desk-icon {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border: 1px solid transparent;
    width: 76px;
    z-index: 2;
}

.desk-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.desk-icon .desk-icon-img {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 20px;
    color: #fff;
}

.desk-icon .desk-icon-label {
    font-size: 10px;
    font-weight: 500;
    color: #fff;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    line-height: 1.2;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ======================== TASKBAR (Windows 11 centered) ======================== */
.desktop-taskbar {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 16px);
    max-width: 1200px;
    height: var(--desk-taskbar-h);
    background: rgba(20, 20, 22, 0.5);
    backdrop-filter: blur(var(--desk-glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--desk-glass-blur)) saturate(180%);
    border: 1px solid var(--desk-glass-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.taskbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.taskbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    margin-left: 4px;
}

.taskbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 240px;
    justify-content: flex-end;
}

/* Start button */
.taskbar-start-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: transparent;
}

.taskbar-start-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.taskbar-start-btn img {
    width: 24px;
    height: 24px;
}

.taskbar-start-btn i {
    font-size: 20px;
    color: var(--desk-accent);
}

/* Search bar in taskbar */
.taskbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 160px;
}

.taskbar-search:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.taskbar-search i {
    font-size: 12px;
    color: var(--desk-text-secondary);
}

.taskbar-search span {
    font-size: 12px;
    color: var(--desk-text-muted);
}

/* Taskbar app icons (pinned + open) */
.taskbar-app {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: none;
    background: transparent;
}

.taskbar-app:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 8px rgba(255,255,255,0.05);
}

.taskbar-app.active {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.taskbar-app i {
    font-size: 18px;
    color: var(--desk-text);
}

/* Active indicator dot */
.taskbar-app::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    border-radius: 2px;
    background: var(--desk-accent);
    transition: width 0.2s;
}

.taskbar-app.open::after {
    width: 6px;
}

.taskbar-app.active::after {
    width: 16px;
}

.taskbar-app.minimized::after {
    width: 6px;
    background: rgba(255, 255, 255, 0.5);
}

/* Taskbar separator */
.taskbar-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 6px;
}

/* Taskbar Preview (thumbnail on hover) */
.taskbar-preview {
    position: fixed;
    width: 280px;
    background: rgba(30, 30, 34, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    z-index: 999990;
    overflow: hidden;
    animation: previewFadeIn 0.15s ease;
    cursor: pointer;
}

@keyframes previewFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.taskbar-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.taskbar-preview-title {
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskbar-preview-close {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.1s;
}

.taskbar-preview-close:hover {
    background: #dc2626;
    color: #fff;
}

.taskbar-preview-thumb {
    width: 100%;
    height: 160px;
    overflow: hidden;
    position: relative;
    background: #f8fafc;
}

.taskbar-preview-content {
    transform: scale(0.28);
    transform-origin: top left;
    width: 357%;
    height: 357%;
    pointer-events: none;
    overflow: hidden;
}

/* System tray */
.taskbar-tray {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.taskbar-tray:hover {
    background: rgba(255, 255, 255, 0.08);
}

.taskbar-tray-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--desk-text-secondary);
}

/* Clock */
.taskbar-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    line-height: 1.3;
}

.taskbar-clock:hover {
    background: rgba(255, 255, 255, 0.08);
}

.taskbar-clock-time {
    font-size: 12px;
    font-weight: 500;
    color: var(--desk-text);
}

.taskbar-clock-date {
    font-size: 10px;
    color: var(--desk-text-secondary);
}

/* ======================== START MENU ======================== */
.start-menu {
    position: fixed;
    bottom: calc(var(--desk-taskbar-h) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: 640px;
    max-height: 680px;
    background: rgba(20, 20, 22, 0.55);
    backdrop-filter: blur(var(--desk-glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--desk-glass-blur)) saturate(180%);
    border: 1px solid var(--desk-glass-border);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    z-index: 99999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.start-menu.visible {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Start menu search */
.start-search {
    padding: 16px 20px 12px;
}

.start-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 13px;
    color: var(--desk-text);
    outline: none;
    transition: all 0.2s;
}

.start-search input::placeholder {
    color: var(--desk-text-muted);
}

.start-search input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--desk-accent);
    box-shadow: 0 0 0 2px rgba(96, 205, 255, 0.15);
}

.start-search-icon {
    position: absolute;
    left: 34px;
    top: 26px;
    font-size: 13px;
    color: var(--desk-text-muted);
    pointer-events: none;
}

/* Pinned section */
.start-section {
    padding: 0 20px 12px;
}

.start-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.start-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--desk-text);
}

.start-section-btn {
    font-size: 11px;
    color: var(--desk-text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.start-section-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--desk-text);
}

/* Pinned apps grid */
.start-pinned-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.start-app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}

.start-app:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.start-app-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 17px;
    color: #fff;
}

.start-app-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--desk-text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

/* Start Menu Drag & Drop */
.start-dragging {
    opacity: 0.4;
    transform: scale(0.9);
}

.start-dragover {
    outline: 2px dashed rgba(96, 205, 255, 0.6);
    outline-offset: -2px;
    border-radius: 8px;
    background: rgba(96, 205, 255, 0.08) !important;
}

.start-group-target {
    outline: 2px solid rgba(96, 205, 255, 0.8) !important;
    outline-offset: -2px;
    border-radius: 8px;
    background: rgba(96, 205, 255, 0.12) !important;
    transform: scale(1.05);
    transition: transform 0.15s, background 0.15s;
}

.start-gap-indicator {
    width: 3px;
    background: #60cdff;
    border-radius: 2px;
    min-height: 60px;
    align-self: center;
    animation: gapPulse 0.8s ease infinite alternate;
}

@keyframes gapPulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* Start Menu Groups */
.start-group-icon {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 6px !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.start-group-mini {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Group expanded modal */
.start-group-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    background: rgba(20, 20, 24, 0.75);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 100000;
    padding: 16px;
    animation: grpPopupIn 0.2s ease;
}

@keyframes grpPopupIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.start-group-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.start-group-name-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    outline: none;
    padding: 4px 0;
    font-family: inherit;
    width: 240px;
    transition: border-color 0.2s;
}

.start-group-name-input:focus {
    border-bottom-color: #60cdff;
}

.start-group-popup-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}

.start-group-popup-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.start-group-popup-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 14px;
}

.start-group-popup-footer {
    display: flex;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.start-group-popup-btn {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #fca5a5;
    font-size: 10px;
    font-weight: 600;
    padding: 7px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.start-group-popup-btn:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #fff;
}

/* All apps list */
.start-all-apps {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 12px;
    max-height: 320px;
}

.start-all-category {
    margin-bottom: 12px;
}

.start-all-category-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--desk-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 8px;
    margin-bottom: 4px;
}

.start-all-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.start-all-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.start-all-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    color: #fff;
}

.start-all-item-name {
    font-size: 12px;
    color: var(--desk-text);
    font-weight: 500;
}

/* Start footer (user) */
.start-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.start-footer-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}

.start-footer-user:hover {
    background: rgba(255, 255, 255, 0.08);
}

.start-footer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.start-footer-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--desk-text);
}

.start-footer-actions {
    display: flex;
    gap: 4px;
}

.start-footer-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--desk-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.start-footer-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--desk-text);
}

.start-footer-btn.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* ======================== WINDOWS (OS-style) ======================== */
.desk-window {
    position: fixed;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: var(--desk-win-radius);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.2s;
    min-width: 480px;
    min-height: 320px;
}

.desk-window.focused {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.15);
}

.desk-window.maximized {
    border-radius: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 68px) !important;
}

.desk-window.minimized {
    display: none !important;
}

/* Window titlebar */
.desk-win-titlebar {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 6px 0 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    cursor: default;
    user-select: none;
}

.desk-window.focused .desk-win-titlebar {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.desk-win-titlebar-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-right: 8px;
}

.desk-win-titlebar-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.desk-window:not(.focused) .desk-win-titlebar-title {
    color: rgba(255,255,255,0.7);
}

/* Window control buttons */
.desk-win-controls {
    display: flex;
    align-items: center;
    height: 100%;
}

.desk-win-ctrl {
    width: 46px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    cursor: pointer;
    transition: background 0.1s;
}

.desk-win-ctrl:hover {
    background: rgba(255, 255, 255, 0.15);
}

.desk-win-ctrl.close:hover {
    background: #c42b1c;
    color: #fff;
}

/* Window body */
.desk-win-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    position: relative;
}

/* Module content inside windows - fixed headers, scrollable table */
.desk-win-body .mod-header {
    flex-shrink: 0;
}
.desk-win-body .mod-tabs {
    flex-shrink: 0;
}
.desk-win-body .mod-stats {
    flex-shrink: 0;
}
.desk-win-body .mod-table-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: thin;
}
/* Table section containers need to grow and allow scroll */
#pf-sp, #fc-sec-fact {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.desk-win-body .mod-table-wrap::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.desk-win-body .mod-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}
.desk-win-body .mod-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.desk-win-body .mod-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.desk-win-body .mod-table thead th {
    position: sticky;
    top: 0;
    z-index: 8;
}
.desk-win-body .mod-table {
    width: 100%;
}

/* Resize handles */
.desk-win-resize {
    position: absolute;
}

.desk-win-resize-n { top: 0; left: 6px; right: 6px; height: 4px; cursor: n-resize; }
.desk-win-resize-s { bottom: 0; left: 6px; right: 6px; height: 4px; cursor: s-resize; }
.desk-win-resize-e { right: 0; top: 6px; bottom: 6px; width: 4px; cursor: e-resize; }
.desk-win-resize-w { left: 0; top: 6px; bottom: 6px; width: 4px; cursor: w-resize; }
.desk-win-resize-ne { top: 0; right: 0; width: 8px; height: 8px; cursor: ne-resize; }
.desk-win-resize-nw { top: 0; left: 0; width: 8px; height: 8px; cursor: nw-resize; }
.desk-win-resize-se { bottom: 0; right: 0; width: 8px; height: 8px; cursor: se-resize; }
.desk-win-resize-sw { bottom: 0; left: 0; width: 8px; height: 8px; cursor: sw-resize; }

/* ======================== WIDGETS PANEL ======================== */
.widgets-panel {
    position: fixed;
    bottom: calc(var(--desk-taskbar-h) + 20px);
    right: 16px;
    width: 360px;
    max-height: 520px;
    background: rgba(20, 20, 22, 0.55);
    backdrop-filter: blur(var(--desk-glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--desk-glass-blur)) saturate(180%);
    border: 1px solid var(--desk-glass-border);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    z-index: 99998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateY(10px);
}

.widgets-panel.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.widgets-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widgets-header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--desk-text);
}

.widgets-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--desk-text-secondary);
    font-size: 12px;
    cursor: pointer;
}

.widgets-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.widgets-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Widget card */
.widget-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    transition: background 0.15s;
}

.widget-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.widget-card-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--desk-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.widget-card-title i {
    font-size: 12px;
    color: var(--desk-accent);
}

/* Calculator widget */
.calc-btn {
    padding: 10px 0;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s, transform 0.05s;
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    font-family: 'Segoe UI', -apple-system, sans-serif;
}
.calc-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}
.calc-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}
.calc-btn.calc-op {
    background: rgba(100, 116, 139, 0.3);
    color: #cbd5e1;
}
.calc-btn.calc-op:hover {
    background: rgba(100, 116, 139, 0.45);
}
.calc-btn.calc-orange {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}
.calc-btn.calc-orange:hover {
    background: rgba(245, 158, 11, 0.4);
}
.calc-btn.calc-orange:active {
    background: rgba(245, 158, 11, 0.55);
}

/* Wallpaper selector in widgets */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.wallpaper-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 6px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    border: 2px solid transparent;
    transition: all 0.15s;
    opacity: 0.8;
}

.wallpaper-thumb:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.wallpaper-thumb.selected {
    border-color: var(--desk-accent);
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

/* ======================== SCROLLBAR for dark panels ======================== */
.start-menu ::-webkit-scrollbar,
.widgets-panel ::-webkit-scrollbar { width: 4px; }
.start-menu ::-webkit-scrollbar-track,
.widgets-panel ::-webkit-scrollbar-track { background: transparent; }
.start-menu ::-webkit-scrollbar-thumb,
.widgets-panel ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* ======================== SNAP ASSIST (half screen) ======================== */
.desk-snap-left {
    left: 0 !important;
    top: 0 !important;
    width: 50vw !important;
    height: calc(100vh - var(--desk-taskbar-h)) !important;
    border-radius: 0 !important;
}

.desk-snap-right {
    left: 50vw !important;
    top: 0 !important;
    width: 50vw !important;
    height: calc(100vh - var(--desk-taskbar-h)) !important;
    border-radius: 0 !important;
}

/* Snap preview zone */
.desk-snap-preview {
    position: fixed;
    background: rgba(96, 205, 255, 0.15);
    border: 2px solid var(--desk-accent);
    border-radius: 8px;
    z-index: 99990;
    display: none;
    pointer-events: none;
    transition: all 0.15s;
}

/* ======================== TOAST (kept from original) ======================== */
.mod-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mod-toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.mod-toast-info { background: rgba(59, 130, 246, 0.9); }
.mod-toast-success { background: rgba(16, 185, 129, 0.9); }
.mod-toast-warning { background: rgba(245, 158, 11, 0.9); }
.mod-toast-error { background: rgba(239, 68, 68, 0.9); }

/* ======================== ANIMATIONS ======================== */
@keyframes windowOpen {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.desk-window {
    animation: windowOpen 0.2s ease;
}

/* ======================== MODULE CONTENT INSIDE WINDOWS ======================== */
/* These override dark defaults for content inside light window bodies */
.desk-win-body .mod-header {
    background: rgba(255,255,255,0.85);
    border-color: rgba(0,0,0,0.1);
}
.desk-win-body .mod-header-title h1 { color: #1a1a1a; }
.desk-win-body .mod-header-title small { color: #6b7280; }
.desk-win-body .mod-header-title i { color: #4b5563; }

.desk-win-body .mod-stat {
    background: rgba(255,255,255,0.8);
    border-color: rgba(0,0,0,0.08);
}
.desk-win-body .mod-stat-value { color: #1a1a1a; }
.desk-win-body .mod-stat-label { color: #6b7280; }

.desk-win-body .mod-tab { color: #6b7280; }
.desk-win-body .mod-tab:hover { color: #374151; background: rgba(0,0,0,0.04); }
.desk-win-body .mod-tab.active { color: #1d4ed8; border-bottom-color: #1d4ed8; }

.desk-win-body .mod-table-wrap {
    border-color: rgba(0,0,0,0.15);
    background: #fff;
}
.desk-win-body .mod-table thead th {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}
.desk-win-body .mod-table thead th:hover {
    background: #4b5563;
    color: #fff;
}
.desk-win-body .mod-table tbody tr:nth-child(even) { background: #dbeafe; }
.desk-win-body .mod-table tbody tr:nth-child(odd) { background: #ffffff; }
.desk-win-body .mod-table tbody tr:hover { background: #bfdbfe; }
.desk-win-body .mod-table tbody td {
    color: #1e293b;
    border-color: rgba(0,0,0,0.08);
}
.desk-win-body .mod-table tbody td:first-child {
    color: #111827;
    font-weight: 600;
}

.desk-win-body .mod-select,
.desk-win-body .mod-input {
    background: #fff;
    border-color: rgba(0,0,0,0.15);
    color: #1a1a1a;
}

.desk-win-body .mod-btn {
    background: #e5e7eb;
    border-color: rgba(0,0,0,0.1);
    color: #374151;
}
.desk-win-body .mod-btn:hover { background: #d1d5db; color: #111827; }
.desk-win-body .mod-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.desk-win-body .mod-btn-primary:hover { background: #1d4ed8; }

/* MC module shell inside window */
.desk-win-body .mc-shell { height: 100%; }
.desk-win-body .mc-main { background: #f1f5f9; }

/* Scrollbar inside windows — styled above in mod-table-wrap rules */

/* ======================== LOGIN SCREEN (kept from original) ======================== */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0f1a, #1a1a2e, #0f3460);
    transition: opacity 0.4s;
}


/* ======================== STICKY NOTES PANEL ======================== */
.sticky-notes-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 300px;
    max-height: 500px;
    background: #fef9c3;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: stickyIn 0.2s ease;
}

@keyframes stickyIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sticky-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #eab308;
    color: #1c1917;
    font-size: 13px;
    font-weight: 700;
}

.sticky-header button {
    background: none;
    border: none;
    color: #1c1917;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.sticky-header button:hover {
    background: rgba(0, 0, 0, 0.1);
}

.sticky-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: 400px;
}

.sticky-empty {
    text-align: center;
    padding: 30px 20px;
    color: #92400e;
    font-size: 12px;
}

.sticky-note {
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sticky-note-text {
    font-size: 12px;
    color: #1c1917;
    min-height: 40px;
    outline: none;
    line-height: 1.5;
    word-break: break-word;
}

.sticky-note-text:focus {
    background: #fff;
    border-radius: 4px;
    padding: 4px;
    margin: -4px;
}

.sticky-note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.sticky-note-date {
    font-size: 9px;
    color: #92400e;
}

.sticky-note-del {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.5;
}

.sticky-note-del:hover {
    opacity: 1;
    background: #fef2f2;
}

/* ======================== TO-DO PANEL ======================== */
.todo-panel {
    position: fixed;
    top: 60px;
    right: 340px;
    width: 320px;
    max-height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: stickyIn 0.2s ease;
}

.todo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #10b981;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.todo-header button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
}

.todo-header button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.todo-input-row {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.todo-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    color: #1f2937;
    outline: none;
    font-family: inherit;
}

.todo-input:focus {
    border-color: #10b981;
}

.todo-add-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: #10b981;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-add-btn:hover {
    background: #059669;
}

.todo-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    max-height: 380px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s;
}

.todo-item:hover {
    background: #f9fafb;
}

.todo-item-done .todo-text {
    text-decoration: line-through;
    color: #9ca3af;
}

.todo-chk {
    width: 16px;
    height: 16px;
    accent-color: #10b981;
    cursor: pointer;
}

.todo-text {
    flex: 1;
    font-size: 12px;
    color: #1f2937;
}

.todo-del {
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 4px;
}

.todo-del:hover {
    color: #dc2626;
    background: #fef2f2;
}

.todo-done-header {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    padding: 8px 14px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
