/* Atlas Home OS — Design System */

/* --------------------------------------------------------
   CSS Variables
   -------------------------------------------------------- */
:root {
    /* Cyberpunk Terminal — pure black base with neon green matrix accent */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #0d0d0d;
    --bg-card-hover: #151515;
    --border: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #888888;
    --text-muted: #666666;
    --accent: #00ff88;
    --accent-hover: #33ffaa;
    --green: #00ff88;
    --red: #ff4444;
    --yellow: #ffaa00;
    --blue: #00aaff;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 0 20px rgba(0, 255, 136, 0.05);
    --grid-cols: 12;
    --grid-gap: 20px;
    --nav-height: 48px;
    --glow-green: 0 0 15px rgba(0, 255, 136, 0.15);
    --scanline-opacity: 0.02;
}

/* --------------------------------------------------------
   Reset & Base
   -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Skip-to-content (a11y) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--accent);
    color: #000;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.skip-link:focus { top: 8px; }

/* Focus indicators (a11y) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* --------------------------------------------------------
   Navigation
   -------------------------------------------------------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    padding: 0 20px;
    background: #0a0a0a;
    border-bottom: 1px solid;
    border-image: linear-gradient(90deg, transparent, rgba(0,255,136,0.3), transparent) 1;
}

.nav__brand a {
    color: #00ff88;
    font-weight: 700;
    font-size: 15px;
    font-family: var(--font-mono);
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0,255,136,0.3);
}

.nav__links { display: flex; gap: 4px; align-items: center; }

.nav__link {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 11px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.15s;
}

.nav__link:hover { color: var(--text-primary); background: var(--bg-card); }
.nav__link--active { color: #00ff88; background: rgba(0,255,136,0.08); font-weight: 600; }
.nav__link--system { color: #555; }

.nav__btn {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: inherit;
}

/* Burger menu — hidden on desktop */
.nav__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
}

.nav__burger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav__burger--open .nav__burger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav__burger--open .nav__burger-line:nth-child(2) {
    opacity: 0;
}

.nav__burger--open .nav__burger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* --------------------------------------------------------
   12-Column Grid
   -------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), 1fr);
    gap: var(--grid-gap);
    padding: var(--grid-gap);
    max-width: 1440px;
    margin: 0 auto;
}

/* Widget spans */
.widget-sm { grid-column: span 3; }
.widget-md { grid-column: span 6; }
.widget-lg { grid-column: span 12; }

@media (max-width: 1024px) {
    .widget-sm { grid-column: span 6; }
    .widget-md { grid-column: span 12; }
}

@media (max-width: 640px) {
    .widget-sm, .widget-md, .widget-lg { grid-column: span 12; }
}

/* --------------------------------------------------------
   Cards
   -------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius);
    padding: 16px;
    transition: background 0.15s;
}

.card:hover { background: var(--bg-card-hover); }

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card__title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.card__value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.card__change--up { color: var(--green); }
.card__change--down { color: var(--red); }
.card__change--neutral { color: var(--text-secondary); }

/* --------------------------------------------------------
   Widget container
   -------------------------------------------------------- */
.widget {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius);
    padding: 20px;
    min-height: 200px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--module-glow, var(--shadow));
}

/* Neon top glow stripe */
.widget[data-module]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--module-accent, var(--accent)), transparent);
    opacity: 0.7;
    z-index: 1;
}

/* CRT scanline overlay */
.widget::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,255,136, var(--scanline-opacity)) 2px, rgba(0,255,136, var(--scanline-opacity)) 4px);
    pointer-events: none;
    border-radius: var(--radius);
    z-index: 1;
}

.widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 12px;
}

.widget__title {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-primary);
}

/* --------------------------------------------------------
   Tabs
   -------------------------------------------------------- */
.tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.tab {
    padding: 8px 18px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.tab:hover { color: var(--text-primary); }
.tab--active { background: var(--bg-card); color: var(--accent); }

/* --------------------------------------------------------
   Source Badge
   -------------------------------------------------------- */
.source-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--text-muted);
    font-family: var(--font-mono);
}
.source-badge--polygon { background: var(--accent); }
.source-badge--yfinance { background: var(--yellow); }
.source-badge--finnhub { background: var(--blue); }
.source-badge--fmp { background: var(--green); }
.source-badge--coingecko { background: var(--green); }
.source-badge--cmc { background: var(--blue); }

/* --------------------------------------------------------
   Empty State
   -------------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.empty-state__icon {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.empty-state__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state__message {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 300px;
}

/* --------------------------------------------------------
   Tables
   -------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-family: var(--font-mono);
}

.data-table tr:hover { background: var(--bg-card-hover); }

/* --------------------------------------------------------
   Main & Footer
   -------------------------------------------------------- */
.main {
    min-height: calc(100vh - var(--nav-height) - 32px);
}

.footer {
    display: flex;
    justify-content: center;
    padding: 8px;
    color: #333;
    font-size: 10px;
    font-family: var(--font-mono);
}

/* --------------------------------------------------------
   Utility classes
   -------------------------------------------------------- */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: 4px; }
.gap-md { gap: 8px; }
.gap-lg { gap: 16px; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mb-xs { margin-bottom: 4px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.ml-xs { margin-left: 4px; }
.ml-sm { margin-left: 6px; }
.ml-md { margin-left: 8px; }
.mr-xs { margin-right: 4px; }
.mr-sm { margin-right: 6px; }
.mr-md { margin-right: 8px; }
.py-xs { padding-top: 3px; padding-bottom: 3px; }
.py-sm { padding-top: 6px; padding-bottom: 6px; }
.block { display: block; }
.inline-block { display: inline-block; }
.text-xs { font-size: 10px; }
.text-sm { font-size: 11px; }
.text-base { font-size: 12px; }
.text-md { font-size: 14px; }
.fw-600 { font-weight: 600; }
.pos-col { display: inline-block; width: 24px; text-align: right; }

/* --------------------------------------------------------
   Forms & Controls
   -------------------------------------------------------- */
.input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
}

.input:focus { outline: none; border-color: var(--accent); }

.btn {
    padding: 8px 16px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.97); }
.btn--sm { padding: 4px 10px; font-size: 11px; }
.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover { background: #ff6666; }
.btn--ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn--ghost:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.btn--ghost:active { transform: scale(0.97); background: var(--bg-secondary); }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--border); border-radius: 20px; transition: 0.2s;
}
.toggle__slider::before {
    content: ''; position: absolute; height: 14px; width: 14px;
    left: 3px; bottom: 3px; background: var(--text-secondary);
    border-radius: 50%; transition: 0.2s;
}
.toggle input:checked + .toggle__slider { background: var(--accent); }
.toggle input:checked + .toggle__slider::before { transform: translateX(16px); background: #000; }

/* Priority badges */
.priority-high { color: var(--red); }
.priority-medium { color: var(--yellow); }
.priority-low { color: var(--green); }

/* Status badges */
.status-badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 3px; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.status-badge--active { background: rgba(0,255,136,0.15); color: var(--green); }
.status-badge--paused { background: rgba(255,200,0,0.15); color: var(--yellow); }
.status-badge--done { background: rgba(0,170,255,0.15); color: var(--accent); }

/* --------------------------------------------------------
   Staleness Indicator
   -------------------------------------------------------- */
.staleness-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.staleness-badge--fresh { background: rgba(0,255,136,0.15); color: var(--green); }
.staleness-badge--stale { background: rgba(255,200,0,0.15); color: var(--yellow); }
.staleness-badge--expired { background: rgba(255,68,68,0.15); color: var(--red); }

/* --------------------------------------------------------
   Drag & Drop Reorder
   -------------------------------------------------------- */
.widget[draggable="true"] { cursor: grab; }
.widget--dragging { opacity: 0.4; cursor: grabbing; }
.widget--dragover { border-color: var(--module-accent, var(--accent)); box-shadow: 0 0 0 2px var(--module-accent, var(--accent)), var(--module-glow, var(--glow-green)); }

/* --------------------------------------------------------
   Loading Skeleton
   -------------------------------------------------------- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 12px;
    margin: 6px 0;
}

.skeleton-text--lg {
    height: 24px;
    width: 60%;
}

.skeleton-text--sm {
    height: 10px;
    width: 40%;
}

.skeleton-block {
    height: 60px;
    margin: 8px 0;
}

.skeleton-chart {
    height: 120px;
    margin: 8px 0;
}

/* Loading state for widgets */
.widget--loading .widget__body {
    min-height: 100px;
}

/* --------------------------------------------------------
   Stat Label/Value (replaces inline font-size/weight/etc.)
   -------------------------------------------------------- */
.stat__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.stat__value { font-weight: 600; font-family: var(--font-mono); }
.stat__value--sm { font-size: 14px; font-weight: 600; }
.stat__value--md { font-size: 18px; font-weight: 700; }
.stat__value--lg { font-size: 24px; font-weight: 700; }
.stat__value--xl { font-size: 36px; font-weight: 700; }
.stat__value--hero { font-size: 48px; font-weight: 700; }

/* --------------------------------------------------------
   Stat Grid (replaces inline grid layouts)
   -------------------------------------------------------- */
.stat-grid { display: grid; gap: 8px; }
.stat-grid--2 { grid-template-columns: repeat(2, 1fr); }
.stat-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid--4 { grid-template-columns: repeat(4, 1fr); }

/* --------------------------------------------------------
   Ticker Row (price list items)
   -------------------------------------------------------- */
.ticker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-family: var(--font-mono);
}

.ticker-row__name { font-weight: 600; }
.ticker-row__change { font-size: 11px; margin-left: 4px; }

/* --------------------------------------------------------
   Widget Size Toggle
   -------------------------------------------------------- */
.widget__size-toggle {
    display: flex;
    gap: 1px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 6px;
}

.widget__size-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.5px;
}

.widget__size-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.widget__size-btn--active {
    color: var(--module-accent, var(--accent));
    background: rgba(0,255,136,0.08);
}

/* --------------------------------------------------------
   Widget Detail Link
   -------------------------------------------------------- */
.widget__refresh-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
    font-family: inherit;
}
.widget__refresh-btn:hover { color: var(--accent); }
.widget__refresh-btn--spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.widget--poll-error { border-color: var(--red); }
.widget__poll-error { padding: 4px 8px; }

.widget__link { font-size: 11px; color: var(--text-secondary); }
.widget__link:hover { color: var(--accent); }

/* --------------------------------------------------------
   Form Grid (2-column form layout)
   -------------------------------------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-grid__full { grid-column: span 2; }

.form-label {
    font-size: 10px;
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* --------------------------------------------------------
   Page Container (replaces inline max-width/margin/padding)
   -------------------------------------------------------- */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}
.page-container--sm { max-width: 800px; }
.page-container--md { max-width: 1000px; }
.page-container--lg { max-width: 1440px; }

.page-title {
    font-size: 18px;
    font-weight: 700;
}

/* --------------------------------------------------------
   Table scroll wrapper (for mobile)
   -------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --------------------------------------------------------
   Mobile Responsive
   -------------------------------------------------------- */
@media (max-width: 640px) {
    /* Burger menu visible */
    .nav__burger { display: flex; }

    /* Nav links — vertical dropdown, hidden by default */
    .nav__links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background: #0a0a0a;
        border-bottom: 1px solid #1a1a1a;
        padding: 8px 0;
        z-index: 99;
        box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    }
    .nav__links--open { display: flex; }

    .nav__links .nav__link {
        padding: 14px 20px;
        width: 100%;
        font-size: 13px;
        border-radius: 0;
    }
    .nav__links .nav__link:hover { background: #151515; }
    .nav__links .nav__link--active {
        border-left: 3px solid #00ff88;
        padding-left: 17px;
    }

    .stat-grid--2, .stat-grid--3, .stat-grid--4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid__full { grid-column: span 1; }
    body { font-size: 13px; }
    .card__value { font-size: 20px; }
    .stat__value--hero { font-size: 36px; }
    .stat__value--xl { font-size: 28px; }
    .module-drawer { width: 100% !important; }
}

/* --------------------------------------------------------
   Module Drawer
   -------------------------------------------------------- */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.drawer-backdrop--open {
    opacity: 1;
    pointer-events: auto;
}

.module-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    background: #0a0a0a;
    border-left: 1px solid #1a1a1a;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
.module-drawer--open {
    transform: translateX(0);
}

.drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #1a1a1a;
}
.drawer__title {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.drawer__close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-family: inherit;
}
.drawer__close:hover { color: var(--text-primary); background: var(--bg-card); }

.drawer__tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
}
.drawer__tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.drawer__tab:hover { color: var(--text-primary); }
.drawer__tab--active {
    color: #00ff88;
    border-bottom-color: #00ff88;
}

.drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.drawer__panel { padding: 0; }

.drawer__empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 40px 20px;
}

.drawer__phase-group {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.drawer__module-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    transition: background 0.15s;
}
.drawer__module-item:hover { background: #151515; }

.drawer__drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 14px;
    user-select: none;
}
.drawer__drag-handle:active { cursor: grabbing; }

.drawer__module-icon { font-size: 18px; flex-shrink: 0; }
.drawer__module-info { flex: 1; min-width: 0; }
.drawer__module-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.drawer__module-desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer__size-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--bg-card);
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    flex-shrink: 0;
}

.drawer__remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    flex-shrink: 0;
}
.drawer__remove-btn:hover { color: var(--red); background: rgba(255,68,68,0.1); }

.drawer__add-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.drawer__add-btn:hover { border-color: #00ff88; color: #00ff88; }
.drawer__add-btn--added {
    border-color: #00ff88;
    color: #00ff88;
    cursor: default;
    pointer-events: none;
}

.drawer__module-item--dragging { opacity: 0.4; }
.drawer__module-item--dragover { border-top: 2px solid var(--accent); }

/* --------------------------------------------------------
   Widget Enter/Leave Animations
   -------------------------------------------------------- */
.widget--entering { animation: widget-enter 0.3s ease-out; }
.widget--leaving  { animation: widget-leave 0.3s ease-in forwards; }

@keyframes widget-enter {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes widget-leave {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.95); }
}

/* --------------------------------------------------------
   Dashboard Empty State
   -------------------------------------------------------- */
.dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}
.dashboard-empty__icon { font-size: 48px; margin-bottom: 16px; }
.dashboard-empty__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.dashboard-empty__message {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* --------------------------------------------------------
   Module Themes
   -------------------------------------------------------- */
.widget[data-module] {
    --module-accent: var(--accent);
}

.widget[data-module="atlas_terminal"]  { --module-accent: #00ff88; --module-glow: 0 0 25px rgba(0,255,136,0.06); }
.widget[data-module="sky"]             { --module-accent: #00c8ff; --module-glow: 0 0 25px rgba(0,200,255,0.06); }
.widget[data-module="todos"]           { --module-accent: #ffc800; --module-glow: 0 0 25px rgba(255,200,0,0.06); }
.widget[data-module="sports"]          { --module-accent: #ff4444; --module-glow: 0 0 25px rgba(255,68,68,0.06); }
.widget[data-module="pattern_house"]   { --module-accent: #9b7ec4; --module-glow: 0 0 25px rgba(155,126,196,0.06); }
.widget[data-module="data_divots"]     { --module-accent: #2d5016; --module-glow: 0 0 25px rgba(45,80,22,0.08); }
.widget[data-module="wave_atlas"]      { --module-accent: #0077b6; --module-glow: 0 0 25px rgba(0,119,182,0.06); }
.widget[data-module="hyperlens"]       { --module-accent: #ff006e; --module-glow: 0 0 25px rgba(255,0,110,0.06); }
.widget[data-module="news_wire"]       { --module-accent: #00aaff; --module-glow: 0 0 25px rgba(0,170,255,0.06); }
.widget[data-module="agenda"]          { --module-accent: #4285f4; --module-glow: 0 0 25px rgba(66,133,244,0.06); }
.widget[data-module="bookmarks"]       { --module-accent: #888888; --module-glow: 0 0 25px rgba(136,136,136,0.06); }
.widget[data-module="spotify"]         { --module-accent: #1DB954; --module-glow: 0 0 25px rgba(29,185,84,0.06); }
.widget[data-module="daily_quote"]     { --module-accent: #9333ea; --module-glow: 0 0 25px rgba(147,51,234,0.06); }

.widget[data-module] .widget__title {
    color: color-mix(in srgb, var(--module-accent) 40%, var(--text-primary));
}

.widget[data-module] .widget__header {
    border-bottom-color: color-mix(in srgb, var(--module-accent) 30%, var(--border));
}

.widget[data-module] .widget__refresh-btn:hover {
    color: var(--module-accent);
}

.widget[data-module] .widget__link:hover {
    color: var(--module-accent);
}

.widget[data-module].widget--dragover {
    border-color: var(--module-accent);
    box-shadow: 0 0 0 2px var(--module-accent), var(--module-glow, var(--glow-green));
}

/* --------------------------------------------------------
   Reduced Motion (a11y)
   -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .widget::after { display: none; }
    .widget[data-module]::before { display: none; }
    .widget { box-shadow: none !important; }
}
