/* ============================================================
   Agency Command Center — Shared Styles
   ============================================================ */

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

:root {
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: #16213e;
    --bg-sidebar-active: #0f3460;
    --bg-body: #f8f9fb;
    --bg-card: #ffffff;
    --bg-input: #f4f5f7;
    --bg-input-focus: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-inverse: #f8f9fb;
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    --accent-light: #cffafe;
    --accent-bg: #ecfeff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --warning: #eab308;
    --warning-bg: #fefce8;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --info: #06b6d4;
    --info-bg: #ecfeff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --transition: 150ms ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* --- Dark Theme --- */
html[data-theme="dark"] {
    --bg-sidebar: #0d0d1a !important;
    --bg-sidebar-hover: #1a1a2e !important;
    --bg-sidebar-active: #0f3460 !important;
    --bg-body: #111118 !important;
    --bg-card: #1a1a24 !important;
    --bg-input: #22222e !important;
    --bg-input-focus: #2a2a38 !important;
    --text-primary: #e8e8ef !important;
    --text-secondary: #9ca3af !important;
    --text-muted: #6b7280 !important;
    --text-inverse: #f8f9fb !important;
    --accent: #22d3ee !important;
    --accent-hover: #06b6d4 !important;
    --accent-light: #164e63 !important;
    --accent-bg: #083344 !important;
    --border: #2a2a38 !important;
    --border-light: #1f1f2e !important;
    --success: #34d399 !important;
    --success-bg: #0d2818 !important;
    --warning: #fbbf24 !important;
    --warning-bg: #2d2305 !important;
    --error: #f87171 !important;
    --error-bg: #2d0e0e !important;
    --info: #22d3ee !important;
    --info-bg: #083344 !important;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3) !important;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3) !important;
    --shadow-md: 0 4px 6px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.3) !important;
    --shadow-lg: 0 10px 15px rgba(0,0,0,.5), 0 4px 6px rgba(0,0,0,.3) !important;
}
[data-theme="dark"] .kanban-col { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .task-card { background: #22222e; border-color: var(--border); }
[data-theme="dark"] .task-card:hover { border-color: var(--accent); }
[data-theme="dark"] .stat-card { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .priority-badge { opacity: .9; }
[data-theme="dark"] .tag-badge { background: var(--accent-bg); color: var(--accent); border-color: var(--border); }
[data-theme="dark"] .modal-content, [data-theme="dark"] .modal { background: var(--bg-card); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .modal-header { border-color: var(--border); }
[data-theme="dark"] .modal-footer { border-color: var(--border); }
[data-theme="dark"] .content { background: var(--bg-body); }
[data-theme="dark"] .topbar { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .kanban-col-header { color: var(--text-primary); }
[data-theme="dark"] .activity-section { color: var(--text-primary); }
[data-theme="dark"] .activity-item { border-color: var(--border); }
[data-theme="dark"] .form-input, [data-theme="dark"] .form-select, [data-theme="dark"] .form-textarea { background: var(--bg-input); color: var(--text-primary); border-color: var(--border); }
[data-theme="dark"] .btn-secondary { background: var(--bg-input); color: var(--text-primary); border-color: var(--border); }

/* --- Theme Toggle Button --- */
.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px; border: none;
    background: transparent; color: var(--text-secondary); cursor: pointer;
    transition: all .15s; font-size: 1.1rem;
}
.theme-toggle:hover { background: var(--bg-input); color: var(--text-primary); }

html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font); color: var(--text-primary); background: var(--bg-body); line-height: 1.6; transition: background .2s, color .2s; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
html[data-theme="dark"] a { color: #e2e8f0; }
html[data-theme="dark"] a:hover { color: #fff; text-decoration: underline; }
html[data-theme="dark"] a.btn, html[data-theme="dark"] a.btn-primary { color: #fff; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 { line-height: 1.3; font-weight: 600; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500;
    cursor: pointer; border: none; transition: all var(--transition); font-family: var(--font);
    text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e9ebee; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .spinner-sm { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }

/* --- Inputs --- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; color: var(--text-primary); }
.form-input {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: .9rem; font-family: var(--font); background: var(--bg-input); color: var(--text-primary);
    transition: all var(--transition); outline: none;
}
.form-input:focus { border-color: var(--accent); background: var(--bg-input-focus); box-shadow: 0 0 0 3px var(--accent-light); }
.form-input::placeholder { color: var(--text-muted); }
.form-input.error { border-color: var(--error); }
.form-error { font-size: .8rem; color: var(--error); margin-top: 4px; }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* --- Cards --- */
.card {
    background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: .95rem; font-weight: 600; }
.card-body { padding: 20px; }

/* --- Priority Badges --- */
.priority-badge {
    display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 100px;
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.priority-critical { background: #fef2f2; color: #dc2626; }
.priority-high { background: #fff7ed; color: #ea580c; }
.priority-medium { background: #fefce8; color: #ca8a04; }
.priority-low { background: #f0fdf4; color: #16a34a; }

/* --- Tag Badges --- */
.tag-badge {
    display: inline-flex; padding: 2px 8px; border-radius: 100px; font-size: .7rem;
    background: var(--accent-bg); color: var(--accent); font-weight: 500;
}

/* --- Status Badges --- */
.status-badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
    border-radius: 100px; font-size: .75rem; font-weight: 500;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.status-backlog { background: #f3f4f6; color: #6b7280; }
.status-backlog::before { background: #9ca3af; }
.status-in-progress { background: #cffafe; color: #0891b2; }
.status-in-progress::before { background: #06b6d4; }
.status-review { background: #fef3c7; color: #d97706; }
.status-review::before { background: #f59e0b; }
.status-completed { background: #dcfce7; color: #16a34a; }
.status-completed::before { background: #22c55e; }

/* --- Toast Notifications --- */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    font-size: .85rem; pointer-events: all; opacity: 0; transform: translateX(40px);
    transition: all .3s ease; min-width: 280px;
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-info { border-left: 3px solid var(--info); }
.toast-close { background: none; border: none; font-size: 1.1rem; color: var(--text-muted); cursor: pointer; margin-left: auto; padding: 0 4px; }

/* --- Modal --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 5000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all .2s ease; padding: 20px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card); border-radius: var(--radius-lg); width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
    transform: translateY(10px) scale(.98); transition: all .2s ease;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border-light);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { background: var(--bg-input); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-light); display: flex; gap: 8px; justify-content: flex-end; }

/* --- Loading Spinner --- */
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; align-items: center; justify-content: center; padding: 60px 20px; flex-direction: column; gap: 12px; color: var(--text-secondary); }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state svg, .empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 1rem; color: var(--text-primary); margin-bottom: 4px; }
.empty-state p { font-size: .85rem; max-width: 300px; margin: 0 auto; }

/* --- Skeleton Loading --- */
.skeleton { background: linear-gradient(90deg, var(--bg-input) 25%, #e9ebee 50%, var(--bg-input) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- Table --- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 16px; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; font-size: .85rem; border-bottom: 1px solid var(--border-light); }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--accent-bg); }

/* --- Avatar --- */
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600;
}
.avatar-sm { width: 24px; height: 24px; font-size: .65rem; }

/* --- Utility --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 768px) {
    html { font-size: 14px; }
    .modal { max-width: 100%; margin: 10px; }
    .card-body { padding: 16px; }
}
