/* --- 1. THEME VARIABLES (CSS Variables for dynamic switching) --- */
:root {
    /* Default: Deep Dark */
    --bg: #09090b;
    --glass: rgba(20, 20, 25, 0.7);
    --border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --text-dim: #a1a1aa;
    --accent: #6366f1; /* Indigo */
    --card-bg: #18181b;
    --success: #10b981;
    --font: 'General Sans', sans-serif;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* Light Theme */
[data-theme="light"] {
    --bg: #e2e8f0;
    --glass: rgba(255, 255, 255, 0.6);
    --border: rgba(0, 0, 0, 0.05);
    --text: #1e293b;
    --text-dim: #64748b;
    --accent: #3b82f6;
    --card-bg: #ffffff;
    --shadow: 0 8px 24px rgba(0,0,0,0.05);
}

/* Cyberpunk Theme */
[data-theme="cyber"] {
    --bg: #050505;
    --glass: rgba(0, 0, 0, 0.8);
    --border: #33ff00;
    --text: #33ff00;
    --text-dim: #008f11;
    --accent: #ff00ff;
    --card-bg: #000000;
    --success: #33ff00;
    --shadow: 0 0 15px rgba(51, 255, 0, 0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; user-select: none; -webkit-tap-highlight-color: transparent; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    height: 100vh;
    overflow: hidden;
    transition: background 0.5s ease;
}

/* WALLPAPER */
.wallpaper {
    position: fixed; inset: 0; z-index: -2;
    background: radial-gradient(circle at 50% 0%, var(--accent), transparent 60%);
    opacity: 0.15; transition: 0.5s;
}

/* LAYOUT STRUCTURE */
#os-interface {
    display: flex; flex-direction: column; height: 100%;
    position: relative;
}

/* HEADER & SETTINGS ISLAND */
.status-bar {
    height: 70px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0; /* Header won't shrink */
}
.logo { font-weight: 700; font-size: 1.25rem; }
.logo span { color: var(--accent); }

.settings-island {
    background: var(--glass); backdrop-filter: blur(20px);
    border: 1px solid var(--border); border-radius: 50px;
    padding: 6px; display: flex; align-items: center; gap: 8px;
    box-shadow: var(--shadow);
}
.theme-btn {
    width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent;
    cursor: pointer; font-size: 1rem; transition: 0.2s; opacity: 0.5;
}
.theme-btn:hover, .theme-btn.active { opacity: 1; background: rgba(125,125,125,0.2); transform: scale(1.1); }
.divider { width: 1px; height: 20px; background: var(--border); }
.icon-btn {
    width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent;
    color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

/* MAIN GRID WRAPPER (Fixes Scroll Issues) */
.grid-wrapper {
    flex: 1; overflow: hidden; /* Hide outer scroll */
    padding: 10px 20px;
    padding-bottom: 100px; /* Space for Dock */
}

.grid-container {
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px; 
    height: 100%;
}

/* COLUMNS / ZONES */
.zone {
    background: var(--glass); border: 1px solid var(--border); border-radius: 20px;
    padding: 16px; display: flex; flex-direction: column;
    height: 100%; /* Fill height */
    min-height: 0; /* Crucial for flex child scrolling */
}

.zone-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-shrink: 0; }
.head-left { display: flex; align-items: center; gap: 10px; }
.icon-box {
    width: 32px; height: 32px; border-radius: 8px; background: rgba(125,125,125,0.1);
    display: flex; align-items: center; justify-content: center; color: var(--text-dim);
}
.icon-box.active { color: var(--accent); background: rgba(99, 102, 241, 0.1); }
.icon-box.success { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.zone-head h3 { font-size: 0.95rem; font-weight: 600; }
.count { background: rgba(125,125,125,0.1); padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; color: var(--text-dim); }

/* SCROLLABLE STACK (The Fix) */
.card-stack {
    flex: 1; overflow-y: auto; /* Scroll inside column */
    display: flex; flex-direction: column; gap: 12px;
    padding-right: 4px;
}

/* Custom Scrollbar */
.card-stack::-webkit-scrollbar { width: 4px; }
.card-stack::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* CARD DESIGN */
.card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
    cursor: grab; transition: 0.2s; position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.card:active { cursor: grabbing; }
.card p { font-size: 0.9rem; line-height: 1.4; color: var(--text); }
.card-tag {
    display: inline-block; font-size: 0.65rem; font-weight: 700;
    padding: 3px 6px; border-radius: 4px; margin-bottom: 8px; text-transform: uppercase;
}
.tag-urg { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.tag-bug { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.tag-gen { background: rgba(125,125,125,0.1); color: var(--text-dim); }

/* DOCK */
.dock-wrapper {
    position: absolute; bottom: 30px; left: 0; width: 100%;
    display: flex; justify-content: center; pointer-events: none; z-index: 100;
}
.spotlight-bar {
    pointer-events: auto; width: 500px; max-width: 90%;
    background: var(--glass); backdrop-filter: blur(20px);
    border: 1px solid var(--border); border-radius: 50px;
    padding: 6px 6px 6px 20px; display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow); transition: 0.3s;
    justify-content: space-between;
    
}
.spotlight-bar input { flex: 1; background: transparent; border: none; color: var(--text); font-size: 1rem; padding: 10px 0; font-family: var(--font); }
.send-btn {
    width: 40px; height: 40px; border-radius: 50%; border: none;
    background: var(--accent); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;

}

/* --- MOBILE RESPONSIVE (Important!) --- */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr; /* Stack vertically */
        grid-template-rows: auto auto auto;
        gap: 16px;
        overflow-y: auto; /* Allow grid itself to scroll on mobile if needed */
        padding-bottom: 120px;
    }
    
    .zone {
        min-height: 250px; /* Fixed height for each zone on mobile */
    }

    .grid-wrapper {
        padding: 10px;
        overflow-y: auto; /* Whole page scrolls on mobile */
    }

    .card-stack {
        overflow-y: visible; /* Let container handle scroll */
    }
    
    .dock-wrapper { bottom: 20px; }
}