/* ============================================================
   Mission Control - mc.thedacg.com
   ============================================================ */

:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --border: #475569;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --urgent: #dc2626;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    --nav-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ---- NAVBAR ---- */
.navbar {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: var(--nav-height);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
}

.nav-brand a {
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-brand a:hover { text-decoration: none; }
.brand-icon { font-size: 1.4rem; color: var(--primary); }

.nav-links {
    display: flex;
    gap: 0.25rem;
    margin-left: 2rem;
}
.nav-links a {
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-input); text-decoration: none; }
.nav-links a.active { color: var(--primary); background: rgba(59,130,246,0.15); }

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Context Toggle (All / Personal / Work) */
.context-toggle {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 2px;
    gap: 2px;
}
.ctx-btn {
    color: var(--text-muted);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.ctx-btn:hover { color: var(--text); background: var(--bg-input); text-decoration: none; }
.ctx-btn.ctx-active { color: #fff; background: var(--primary); }
.ctx-btn.ctx-active:hover { text-decoration: none; }

/* Notes */
.notes-list { margin-bottom: 1rem; }
.note-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.note-item:last-child { border-bottom: none; }
.note-meta {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}
.note-content {
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}
.note-form {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.note-form textarea {
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
}

.search-form { display: flex; }
.search-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    width: 200px;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--primary); }

.nav-user {
    position: relative;
    cursor: pointer;
}
.user-name {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    transition: background 0.2s;
}
.nav-user:hover .user-name { background: var(--bg-input); }
.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 150px;
    box-shadow: var(--shadow);
    z-index: 200;
    margin-top: 0.25rem;
}
.nav-user:hover .user-dropdown { display: block; }
.user-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.user-dropdown a:hover { background: var(--bg-input); color: var(--text); text-decoration: none; }

.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* ---- CONTAINER ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.container.with-nav { margin-top: var(--nav-height); }

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 1.1rem; font-weight: 600; }

/* ---- GRID ---- */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #fff;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--text); color: var(--text); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--primary); }
select.form-control { appearance: auto; }
textarea.form-control { min-height: 80px; resize: vertical; font-family: inherit; }

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.badge-planning { background: #6366f1; color: #fff; }
.badge-active { background: var(--primary); color: #fff; }
.badge-on_hold { background: var(--warning); color: #000; }
.badge-completed { background: var(--success); color: #fff; }
.badge-archived { background: var(--text-muted); color: var(--bg); }

.badge-low { background: #94a3b8; color: var(--bg); }
.badge-medium { background: var(--primary); color: #fff; }
.badge-high { background: var(--warning); color: #000; }
.badge-urgent { background: var(--urgent); color: #fff; }

.badge-backlog { background: var(--text-muted); color: var(--bg); }
.badge-in_progress { background: var(--primary); color: #fff; }

.badge-admin { background: var(--danger); color: #fff; }
.badge-editor { background: var(--primary); color: #fff; }
.badge-viewer { background: var(--text-muted); color: var(--bg); }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
tr:hover { background: rgba(255,255,255,0.02); }

/* ---- STATS ---- */
.stat-card {
    text-align: center;
    padding: 1.25rem;
}
.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- KANBAN ---- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    align-items: start;
}
.kanban-column {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 300px;
}
.kanban-column-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kanban-column-header .count {
    background: var(--bg-input);
    padding: 0.1rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.kanban-cards {
    padding: 0.5rem;
    min-height: 200px;
}
.kanban-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: all 0.2s;
}
.kanban-card:hover { border-color: var(--primary); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card-title {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}
.kanban-card-title a { color: var(--text); }
.kanban-card-title a:hover { color: var(--primary); }
.kanban-card-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.kanban-drop-zone {
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    display: none;
}
.kanban-column.drag-over .kanban-drop-zone { display: block; }

/* ---- CALENDAR ---- */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.cal-header {
    background: var(--bg-card);
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.cal-day {
    background: var(--bg-card);
    min-height: 90px;
    padding: 0.35rem;
    cursor: pointer;
    transition: background 0.2s;
}
.cal-day:hover { background: var(--bg-input); }
.cal-day.other-month { opacity: 0.4; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day-num {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    color: var(--text-muted);
}
.cal-day.today .cal-day-num { color: var(--primary); font-weight: 700; }
.cal-event {
    display: block;
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    cursor: pointer;
}
.cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.cal-nav h2 { font-size: 1.25rem; }

/* ---- ACTIVITY ---- */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.85rem;
}
.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 0.5rem;
    flex-shrink: 0;
}
.activity-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* ---- LOGIN ---- */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}
.login-card {
    width: 100%;
    max-width: 400px;
}
.login-card h1 {
    text-align: center;
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
}
.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ---- MODAL ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; }

/* ---- ALERTS ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid var(--danger); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.15); border: 1px solid var(--success); color: #86efac; }
.alert-info { background: rgba(59,130,246,0.15); border: 1px solid var(--primary); color: #93c5fd; }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 0.5rem; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .nav-links, .search-form { display: none; }
    .nav-toggle { display: block; }
    .navbar.open { flex-wrap: wrap; height: auto; }
    .navbar.open .nav-links { display: flex; flex-direction: column; width: 100%; padding: 0.5rem 0; }
    .navbar.open .search-form { display: flex; width: 100%; padding: 0.5rem 0; }
    .navbar.open .search-input { width: 100%; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .kanban-board { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .page-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
}

/* ---- UTILITY ---- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
