/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1535 50%, #2d1b4e 100%);
    font-family: Arial, sans-serif;
    cursor: crosshair;
    position: fixed;
    width: 100%;
    height: 100%;
}

#canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    touch-action: none;
    z-index: 1;
    /* Ensure canvas is behind OS but visible */
}

/* LezGo OS Container */
#lezgo-os {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Use a semi-transparent background to show the "simulation" aspect or keep solid? form previous it was solid gradient */
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    z-index: 1000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#lezgo-os.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
}

/* Desktop Area */
.os-desktop {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Desktop Icons */
.os-icon {
    position: absolute;
    width: 80px;
    height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: move;
    transition: background 0.2s;
    border-radius: 8px;
    padding: 5px;
    user-select: none;
}

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

.os-icon.dragging {
    opacity: 0.7;
    z-index: 999;
}

.os-icon-image {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 5px;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.os-icon-label {
    color: white;
    font-size: 11px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 5px 0;
    min-width: 180px;
    display: none;
    z-index: 10000;
}

.context-menu.active {
    display: block;
    animation: fadeIn 0.1s ease-out;
}

.context-menu-item {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-menu-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.context-menu-divider {
    height: 1px;
    background: #ddd;
    margin: 5px 0;
}

/* Windows */
.os-window {
    position: absolute;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    /* Reduced min width slightly */
    min-height: 200px;
    display: none;
    resize: both;
    overflow: hidden;
    /* Changed from auto to hidden for container */
    flex-direction: column;
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.os-window.active {
    display: flex;
}

.os-window.fullscreen {
    width: 100% !important;
    height: calc(100% - 50px) !important;
    top: 0 !important;
    left: 0 !important;
    border-radius: 0;
    transform: none !important;
}

.os-window-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.os-window.fullscreen .os-window-header {
    border-radius: 0;
}

.os-window-title {
    font-size: 14px;
    font-weight: 600;
}

.os-window-controls {
    display: flex;
    gap: 8px;
}

.os-window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 0;
}

.os-window-control:hover {
    transform: scale(1.2);
}

.os-window-control.close {
    background: #ff5f56;
}

.os-window-control.minimize {
    background: #ffbd2e;
}

.os-window-control.maximize {
    background: #27c93f;
}

.os-window-content {
    flex: 1;
    padding: 0;
    overflow: auto;
    position: relative;
    background: #fff;
}

/* Taskbar */
.os-taskbar {
    height: 50px;
    background: rgba(15, 23, 42, 0.85);
    /* Modern dark glass */
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    z-index: 2000;
}

.os-start-button {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 10px;
}

.os-start-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(118, 75, 162, 0.5);
}

/* User Profile Widget in Taskbar */
.os-user-profile {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    margin-left: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 8px;
    color: white;
}

.os-user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.os-user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.os-user-name {
    font-size: 13px;
    font-weight: 500;
}

.os-taskbar-divider {
    width: 1px;
    height: 60%;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 10px;
}

.os-taskbar-time {
    margin-left: auto;
    color: white;
    font-size: 12px;
    padding-right: 10px;
    font-variant-numeric: tabular-nums;
}

/* Privacy Dashboard (Enhanced System Info) */
.privacy-dashboard {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    color: #e2e8f0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.privacy-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.privacy-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
    color: #a78bfa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-header p {
    font-size: 12px;
    color: #94a3b8;
}

.privacy-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
}

.privacy-category {
    margin-bottom: 20px;
}

.category-title {
    color: #818cf8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(129, 140, 248, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.risk-card {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(51, 65, 85, 0.5);
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.risk-card:hover {
    transform: translateX(4px);
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(30, 41, 59, 0.95);
}

.risk-card.critical-risk {
    border-left: 3px solid #dc2626;
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.08) 0%, transparent 30%);
}

.risk-card.high-risk {
    border-left: 3px solid #ef4444;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, transparent 30%);
}

.risk-card.medium-risk {
    border-left: 3px solid #f59e0b;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, transparent 30%);
}

.risk-card.low-risk {
    border-left: 3px solid #10b981;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.05) 0%, transparent 30%);
}

.risk-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 10px;
}

.risk-title-row {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.risk-title {
    font-weight: 600;
    color: #f1f5f9;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.risk-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.risk-badge.critical {
    background: rgba(220, 38, 38, 0.25);
    color: #fca5a5;
    border: 1px solid rgba(220, 38, 38, 0.4);
}

.risk-badge.high {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.risk-badge.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.risk-badge.low {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.risk-value {
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    background: rgba(15, 23, 42, 0.6);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 11px;
    word-break: break-word;
    margin-bottom: 10px;
    color: #e2e8f0;
    border: 1px solid rgba(51, 65, 85, 0.3);
    white-space: pre-wrap;
    line-height: 1.5;
}

.risk-explanation {
    font-size: 11px;
    color: #64748b;
    line-height: 1.5;
}

.privacy-footer {
    padding: 15px;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    flex-shrink: 0;
}

.footer-warning {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    margin-bottom: 12px;
    color: #fca5a5;
}

.footer-warning strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.footer-warning p {
    font-size: 10px;
    line-height: 1.4;
    margin: 0;
    opacity: 0.9;
}

.footer-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #818cf8;
}

.stat-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Animations */
@keyframes popIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .os-window {
        min-width: 100% !important;
        width: 100% !important;
        height: calc(100% - 50px) !important;
        left: 0 !important;
        top: 0 !important;
        border-radius: 0 !important;
    }

    .os-icon {
        width: 70px;
        height: 80px;
    }

    .os-icon-image {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .os-user-name {
        display: none;
    }
}