:root {
    --accent-color: #007AFF;
    --sys-red: #FF5F56;
    --sys-yellow: #FFBD2E;
    --sys-green: #27C93F;
    --glass-light: rgba(255, 255, 255, 0.15);
    --bg-window: rgba(28, 28, 30, 0.85);
    --text-main: #ffffff;
}

.dark-mode {
    --bg-window: rgba(20, 20, 22, 0.95);
}

#boot-screen {
    position: fixed;
    inset: 0;
    background: black;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

.boot-logo {
    font-size: 80px;
    color: white;
    margin-bottom: 40px;
}

.boot-progress-bar {
    width: 200px;
    height: 6px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.boot-progress-fill {
    width: 0%;
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 2.5s ease-in-out;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    background-color: #000;
}

.desktop {
    background-image: url('../image/wallpaper/princiapl.png');
    background-size: cover;
    background-position: center;
    height: 100vh;
    width: 100vw;
    position: relative;
    transition: filter 0.5s ease, background-image 0.5s ease;
    z-index: 1;
}

#brightness-overlay {
    position: fixed;
    inset: 0;
    background: black;
    pointer-events: none;
    z-index: 99999;
    opacity: 0;
}

@keyframes closeGenie {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
        filter: blur(0);
    }

    100% {
        transform: scale(0.1) translateY(500px);
        opacity: 0;
        filter: blur(20px);
    }
}

.window-closing {
    animation: closeGenie 0.4s cubic-bezier(0.55, 0, 0.1, 1) forwards;
    pointer-events: none;
}

/* Barra Superior */
.top-bar {
    height: 32px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(30px);
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    justify-content: space-between;
    z-index: 20000;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}

/* Estilos Ventana */
.window {
    position: absolute;
    background: var(--bg-window);
    backdrop-filter: blur(50px);
    border-radius: 12px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    overflow: visible;            /* allows resize handles outside the border */
    display: none;
    flex-direction: column;
    border: 0.5px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    transform-origin: bottom center;
    z-index: 100;
}

/* Clip the inner content so it doesn't overflow visually */
.window > *:not(.resize-handle) {
    overflow: hidden;
}

/* ── Resize Handles ───────────────────────────────────────────── */
.resize-handle {
    position: absolute;
    z-index: 9999;
}

/* Edges */
.resize-n  { top: -4px;    left: 8px;    right: 8px;   height: 8px;  cursor: n-resize; }
.resize-s  { bottom: -4px; left: 8px;    right: 8px;   height: 8px;  cursor: s-resize; }
.resize-e  { right: -4px;  top: 8px;     bottom: 8px;  width: 8px;   cursor: e-resize; }
.resize-w  { left: -4px;   top: 8px;     bottom: 8px;  width: 8px;   cursor: w-resize; }

/* Corners */
.resize-ne { top: -4px;    right: -4px;  width: 16px; height: 16px; cursor: ne-resize; }
.resize-nw { top: -4px;    left: -4px;   width: 16px; height: 16px; cursor: nw-resize; }
.resize-se { bottom: -4px; right: -4px;  width: 16px; height: 16px; cursor: se-resize; }
.resize-sw { bottom: -4px; left: -4px;   width: 16px; height: 16px; cursor: sw-resize; }

/* ── Snap Zones (Windows 11 style) ─────────────────────────────── */
#snap-zones {
    display: none;
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
}

.snap-zone {
    position: absolute;
    background: rgba(0, 122, 255, 0.15);
    border: 2px solid rgba(0, 122, 255, 0.4);
    border-radius: 8px;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.snap-zone.snap-zone-active {
    opacity: 1;
    background: rgba(0, 122, 255, 0.25);
    border-color: rgba(0, 122, 255, 0.8);
}

#snap-left  { top: 36px; left: 4px;   width: calc(50% - 8px); bottom: 4px; }
#snap-right { top: 36px; right: 4px;  width: calc(50% - 8px); bottom: 4px; }
#snap-top   { top: 36px; left: 4px;   right: 4px;             bottom: 4px; }

.window-header {
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    padding: 0 16px;
    cursor: move;
    user-select: none;
}

.traffic-lights {
    display: flex;
    gap: 8px;
    width: 70px;
}

.light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    color: rgba(0, 0, 0, 0.4);
}

.light i {
    opacity: 0;
    transition: opacity 0.2s;
}

.light:hover i {
    opacity: 1;
}

.light-close {
    background: var(--sys-red);
}

.light-min {
    background: var(--sys-yellow);
}

.light-max {
    background: var(--sys-green);
}

/* Spotlight Search */
#spotlight {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 640px;
    max-width: 94vw;
    background: rgba(28, 28, 30, 0.92);
    backdrop-filter: blur(60px);
    border-radius: 18px;
    border: 0.5px solid rgba(255, 255, 255, 0.2);
    z-index: 40000;
    display: none;
    flex-direction: column;
    padding: 14px 16px;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
}

/* Divider when results appear */
#spotlight-results:not(.hidden) {
    border-top: 0.5px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
}

/* Category heading */
.spotlight-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    padding: 8px 10px 4px;
}

/* Result row */
.spotlight-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s;
    color: white;
}
.spotlight-item:hover,
.spotlight-item.spotlight-active {
    background: rgba(0, 122, 255, 0.35);
}
.spotlight-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    shrink: 0;
}
.spotlight-item-text { flex: 1; }
.spotlight-item-title { font-size: 13px; font-weight: 600; }
.spotlight-item-sub   { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 1px; }

/* Control Center */
#control-center {
    position: absolute;
    top: 40px;
    right: 10px;
    width: 320px;
    background: rgba(40, 40, 42, 0.8);
    backdrop-filter: blur(50px);
    border-radius: 18px;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 35000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.cc-tile {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px;
}

.cc-slider {
    width: 100%;
    height: 20px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.cc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    box-shadow: -400px 0 0 400px var(--accent-color);
}

/* Widgets */
.widgets-area {
    position: absolute;
    right: 20px;
    top: 50px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 160px;
    z-index: 50;
}

.widget {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Launchpad */
#launchpad {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(50px);
    z-index: 30000;
    display: none;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.launchpad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 40px;
    width: 80%;
    max-width: 900px;
    margin-top: 40px;
}

.launchpad-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s;
}

.launchpad-item:hover {
    transform: scale(1.1);
}

.launchpad-icon {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Dock */
.dock-container {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(35px);
    border-radius: 24px;
    border: 0.5px solid rgba(255, 255, 255, 0.2);
    z-index: 25000;
}

.dock-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.dock-icon {
    width: 52px;
    height: 52px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    font-size: 24px;
    overflow: hidden;
}

.dock-item:hover .dock-icon {
    transform: scale(1.3) translateY(-12px);
}

.dock-tooltip {
    position: absolute;
    top: -45px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

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

.indicator {
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    margin-top: 4px;
    opacity: 0;
}

.indicator.active {
    opacity: 1;
}

/* Lock Screen */
#lock-screen {
    position: fixed;
    inset: 0;
    z-index: 50000;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(60px);
}

.shaking {
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }
}

#context-menu {
    position: absolute;
    display: none;
    background: rgba(30, 30, 32, 0.95);
    backdrop-filter: blur(25px);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 5px;
    width: 190px;
    z-index: 50000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.menu-item {
    padding: 8px 12px;
    color: white;
    font-size: 12px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Notifications */
#notification-container {
    position: fixed;
    top: 50px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 60000;
    pointer-events: none;
    /* Let clicks pass through */
}

.notification-toast {
    width: 280px;
    background: rgba(40, 40, 42, 0.7);
    backdrop-filter: blur(20px);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

.notification-toast.show {
    transform: translateX(0);
}

/* Mobile Responsive Logic */
@media (min-width: 768px) {
    #mobile-profile {
        display: none !important;
    }
}

@media (max-width: 768px) {

    /* Hide specific elements explicitly just in case */
    .desktop,
    .dock-container,
    #launchpad,
    #spotlight,
    #control-center,
    #boot-screen,
    #lock-screen,
    .window,
    #brightness-overlay,
    #matrix-canvas {
        display: none !important;
    }

    /* Target specific IDs that might override */
    #desktop {
        display: none !important;
    }

    /* Show Mobile Profile */
    #mobile-profile {
        display: flex !important;
    }

    /* Reset body overflow for mobile scrolling if needed */
    body,
    html {
        overflow: auto;
    }
}