/**
 * Mission Control Design System
 * Version: 2.0.0
 *
 * Hybrid design: Dark sidebar + Warm light content
 */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    /* Dark Sidebar */
    --sidebar-bg: #18181B;
    --sidebar-surface: #27272A;
    --sidebar-border: #3F3F46;
    --sidebar-text: #A1A1AA;
    --sidebar-text-bright: #FAFAFA;

    /* Warm Light Content */
    --bg-page: #FAFAF9;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F5F5F4;
    --bg-hover: #F0EEEB;

    --border: #E8E6E3;
    --border-subtle: #F0EEEB;

    --text-primary: #1C1917;
    --text-secondary: #57534E;
    --text-muted: #A8A29E;

    /* Accent Color */
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --accent-subtle: #EFF6FF;

    /* Status Colors */
    --status-working: #10B981;
    --status-working-bg: #ECFDF5;
    --status-idle: #71717A;
    --status-error: #EF4444;
    --status-error-bg: #FEF2F2;

    /* Priority Colors */
    --priority-high: #EF4444;
    --priority-high-bg: #FEF2F2;
    --priority-medium: #F59E0B;
    --priority-medium-bg: #FFFBEB;
    --priority-low: #A8A29E;
    --priority-low-bg: #F5F5F4;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Consolas', monospace;

    /* Font Sizes */
    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 18px;
    --text-xl: 20px;

    /* Spacing (8px grid) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
}

/* ===== BASE RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ===== TYPOGRAPHY ===== */
body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== STATUS PULSE ANIMATION ===== */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.status-working {
    animation: pulse 2s ease-in-out infinite;
}

/* ===== SIDEBAR STYLES ===== */
#sidebar {
    background: var(--sidebar-bg) !important;
    color: var(--sidebar-text);
}

#sidebar .border-gray-700 {
    border-color: var(--sidebar-border) !important;
}

/* Sidebar Header */
#sidebar h1 {
    color: var(--sidebar-text-bright);
    font-size: var(--text-md);
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* Agent List Items */
#agents-list .agent-item {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
}

#agents-list .agent-item:hover {
    background: var(--sidebar-surface);
}

/* Agent Status Dots */
.agent-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.agent-status-dot.idle {
    background: var(--status-idle);
}

.agent-status-dot.working {
    background: var(--status-working);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: pulse 2s ease-in-out infinite;
}

.agent-status-dot.error {
    background: var(--status-error);
}

/* Navigation Items */
.nav-btn {
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-btn:hover,
.nav-btn.active {
    background: var(--sidebar-surface) !important;
}

/* Sync Status Footer */
#sidebar .sync-info {
    font-size: var(--text-xs);
    color: var(--sidebar-text);
}

/* ===== MAIN CONTENT AREA ===== */
main {
    background: var(--bg-page);
}

/* Header */
main header {
    background: var(--bg-surface);
    border-color: var(--border);
    padding: var(--space-4) var(--space-6);
}

/* Project Selector */
#project-selector-btn {
    background: transparent;
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
}

#project-selector-btn:hover {
    background: var(--bg-subtle);
}

#current-project-name {
    font-weight: 500;
    color: var(--text-primary);
}

/* Search and Filters */
#mission-search,
#priority-filter,
#agent-filter,
#mission-sort {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.15s ease;
}

#mission-search:focus,
#priority-filter:focus,
#agent-filter:focus,
#mission-sort:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Primary Button */
.btn-primary,
button[onclick="MissionControl.ui.openAddMission()"] {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    transition: background 0.15s ease;
}

.btn-primary:hover,
button[onclick="MissionControl.ui.openAddMission()"]:hover {
    background: var(--accent-hover);
}

/* ===== DASHBOARD PANELS ===== */
#dashboard-panels > div {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Panel Headers */
.text-xs.font-semibold.text-gray-500.uppercase {
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Building Card */
#building-card {
    background: linear-gradient(135deg, var(--accent) 0%, #6366F1 100%);
    border-radius: var(--radius-lg);
}

/* Progress Bar */
#building-progress-bar {
    background: linear-gradient(90deg, var(--accent), var(--status-working));
}

/* ===== KANBAN STYLES ===== */
.kanban-column {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.column-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.column-title {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

/* Column Status Dots */
.column-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.column-dot.backlog { background: #A8A29E; }
.column-dot.todo { background: #3B82F6; }
.column-dot.in-progress { background: #F59E0B; }
.column-dot.review { background: #8B5CF6; }
.column-dot.testing { background: #EC4899; }
.column-dot.done { background: #10B981; }

/* Mission Cards */
.mission-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    cursor: pointer;
    transition: all 0.15s ease;
}

.mission-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.mission-card h4,
.mission-title {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.mission-card .text-sm.text-gray-500,
.mission-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* Tags */
.tag,
.mission-tag {
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

/* Priority Badges */
.priority-high {
    background: var(--priority-high-bg);
    color: var(--priority-high);
}

.priority-medium {
    background: var(--priority-medium-bg);
    color: var(--priority-medium);
}

.priority-low {
    background: var(--priority-low-bg);
    color: var(--priority-low);
}

/* ===== PROFILE PANEL ===== */
#profile-panel {
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
}

#profile-panel .border-gray-200 {
    border-color: var(--border-subtle);
}

/* Profile Header */
#profile-header {
    text-align: center;
    padding: var(--space-6);
}

#profile-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

#profile-role {
    font-size: 13px;
    color: var(--text-muted);
}

/* Profile Stats */
#profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

#profile-stats > div {
    background: var(--bg-surface);
    padding: var(--space-4);
    text-align: center;
}

#profile-stats .text-lg,
.stat-value {
    font-size: var(--text-xl);
    font-weight: 600;
    font-family: var(--font-mono);
}

#profile-stats .text-green-600 { color: var(--status-working); }
#profile-stats .text-red-600 { color: var(--status-error); }
#profile-stats .text-purple-600 { color: #8B5CF6; }
#profile-stats .text-blue-600 { color: var(--accent); }
#profile-stats .text-gray-600 { color: var(--text-secondary); }

/* Profile Sections */
#profile-panel h4 {
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

#profile-about {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Skills Tags */
#profile-skills .skill-tag {
    font-size: var(--text-sm);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

/* Status Badge */
#profile-status-container {
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

#profile-status-container.working {
    background: var(--status-working-bg);
}

#profile-status-container.idle {
    background: var(--bg-subtle);
}

#profile-status-container.error {
    background: var(--status-error-bg);
}

/* ===== MODALS ===== */
.modal-content,
#mission-detail-modal > div,
#edit-mission-modal > div,
#add-mission-modal > div,
#agent-modal > div,
#agent-library-modal > div,
#help-modal > div {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Form Inputs */
input[type="text"],
input[type="date"],
textarea,
select {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: var(--text-base);
    color: var(--text-primary);
    transition: all 0.15s ease;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ===== ADMIN VIEW ===== */
#admin-stats > div {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* ===== PROJECTS VIEW ===== */
#projects-grid .project-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.15s ease;
}

#projects-grid .project-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

/* ===== STATUS BAR ===== */
.status-bar {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: var(--space-2) var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.status-bar .timestamp {
    font-family: var(--font-mono);
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Sidebar Scrollbar */
#sidebar ::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

#sidebar ::-webkit-scrollbar-thumb {
    background: var(--sidebar-border);
}

#sidebar ::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-text);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-3) var(--space-4);
}

.toast.success {
    border-left: 3px solid var(--status-working);
}

.toast.error {
    border-left: 3px solid var(--status-error);
}

/* ===== LOADING INDICATOR ===== */
#loading-indicator {
    background: rgba(250, 250, 249, 0.9);
}

#loading-indicator .animate-spin {
    border-color: var(--accent);
    border-top-color: transparent;
}

/* ===== DRAG AND DROP ===== */
.sortable-ghost {
    opacity: 0.4;
    background: var(--accent-subtle) !important;
}

.sortable-chosen {
    box-shadow: var(--shadow-lg);
}

/* ===== KEYBOARD FOCUS ===== */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== UTILITY CLASSES ===== */
.font-mono {
    font-family: var(--font-mono);
}

.text-accent {
    color: var(--accent);
}

.bg-accent {
    background: var(--accent);
}

.text-muted {
    color: var(--text-muted);
}

.border-subtle {
    border-color: var(--border-subtle);
}
