/* ============================================
   MagiJobs — Design System v2 (shadcn-inspired)
   Clean, minimal, neutral palette with Inter
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Custom Properties ──────────────────── */
:root {
    /* Neutrals (shadcn zinc) */
    --background: #FFFFFF;
    --foreground: #09090B;
    --card: #FFFFFF;
    --card-foreground: #09090B;
    --popover: #FFFFFF;
    --popover-foreground: #09090B;
    --muted: #F4F4F5;
    --muted-foreground: #71717A;
    --accent-bg: #F4F4F5;
    --accent-foreground: #18181B;
    --border: #E4E4E7;
    --input: #E4E4E7;
    --ring: #18181B;
    
    /* Brand */
    --primary: #18181B;
    --primary-foreground: #FAFAFA;
    --secondary: #F4F4F5;
    --secondary-foreground: #18181B;
    --destructive: #EF4444;
    --destructive-foreground: #FAFAFA;
    
    /* Status */
    --success: #22C55E;
    --success-bg: #F0FDF4;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --error: #EF4444;
    --error-bg: #FEF2F2;
    --info: #3B82F6;
    --info-bg: #EFF6FF;
    
    /* Legacy compat aliases */
    --white: #FFFFFF;
    --gray-50: #FAFAFA;
    --gray-100: #F4F4F5;
    --gray-200: #E4E4E7;
    --gray-300: #D4D4D8;
    --gray-400: #A1A1AA;
    --gray-500: #71717A;
    --gray-600: #52525B;
    --gray-700: #3F3F46;
    --gray-800: #27272A;
    --gray-900: #18181B;
    
    /* Surfaces */
    --bg-body: #FAFAFA;
    --bg-card: #FFFFFF;
    --bg-card-solid: #FFFFFF;
    --bg-sidebar: #FAFAFA;
    --bg-navbar: rgba(255, 255, 255, 0.8);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* Brand accent (subtle blue for highlights) */
    --brand: #2563EB;
    --brand-light: #3B82F6;
    --brand-50: #EFF6FF;
    --brand-100: #DBEAFE;
    --brand-200: #BFDBFE;
    --brand-700: #1D4ED8;
    --primary-light: #3B82F6;
    --primary-dark: #1D4ED8;
    --primary-50: #EFF6FF;
    --primary-100: #DBEAFE;
    --primary-200: #BFDBFE;
    --primary-300: #93C5FD;
    --primary-400: #60A5FA;
    --primary-500: #3B82F6;
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;
    --primary-800: #1E40AF;
    --primary-900: #1E3A5F;
    
    /* Legacy */
    --accent: #22C55E;
    --accent-light: #4ADE80;
    --accent-dark: #16A34A;
    --glass-border: var(--border);
    --glass-bg: var(--card);
    --glass-shadow: 0 1px 3px rgba(0,0,0,0.06);
    --glass-blur: 0px;
    
    /* Typography */
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-glow: none;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --navbar-height: 56px;
    --content-max-width: 1280px;
}

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

img, video {
    max-width: 100%;
    height: auto;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--foreground);
    background: var(--bg-body);
    min-height: 100vh;
}

/* No animated background */
body::before { display: none; }

/* ── Typography ─────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.3;
    letter-spacing: -0.025em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p { margin-bottom: var(--space-4); color: var(--muted-foreground); }
a { color: var(--foreground); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--brand); }

/* ── Cards ──────────────────────────────────── */
.glass-card,
.glass-card-static {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.glass-card {
    transition: box-shadow var(--transition-base);
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
    transform: none;
}

/* ── Buttons ────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 9px 16px;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.25;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--gray-800);
    transform: none;
    color: var(--primary-foreground);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--accent-bg);
    color: var(--secondary-foreground);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: none;
}

.btn-success:hover {
    background: #16A34A;
    transform: none;
    color: #fff;
}

.btn-danger {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.btn-danger:hover {
    background: #DC2626;
    transform: none;
    color: var(--destructive-foreground);
}

.btn-ghost {
    background: transparent;
    color: var(--muted-foreground);
}

.btn-ghost:hover {
    background: var(--accent-bg);
    color: var(--accent-foreground);
}

.btn-outline {
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}

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

.btn-sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn-lg { padding: 12px 24px; font-size: var(--text-base); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ── Form Elements ──────────────────────────── */
.form-group { margin-bottom: var(--space-5); }

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--foreground);
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.05);
}

.form-input::placeholder { color: var(--gray-400); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-help { font-size: var(--text-xs); color: var(--muted-foreground); margin-top: var(--space-1); }
.form-error { font-size: var(--text-xs); color: var(--destructive); margin-top: var(--space-1); }
.form-input.error { border-color: var(--destructive); }

/* ── Badges ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--radius-full);
    line-height: 1.6;
    border: 1px solid transparent;
}

.badge-primary { background: var(--gray-900); color: #fff; }
.badge-success { background: var(--success-bg); color: #15803D; border-color: #BBF7D0; }
.badge-warning { background: var(--warning-bg); color: #92400E; border-color: #FDE68A; }
.badge-error { background: var(--error-bg); color: #991B1B; border-color: #FECACA; }
.badge-info { background: var(--info-bg); color: #1E40AF; border-color: #BFDBFE; }
.badge-gray { background: var(--muted); color: var(--muted-foreground); border-color: var(--border); }

/* ── Status Dots ────────────────────────────── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.connected { background: var(--success); }
.status-dot.disconnected { background: var(--gray-300); }
.status-dot.expired { background: var(--warning); }
.status-dot.error { background: var(--error); }
.status-dot.pulse { animation: pulse 2s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Flash Messages ─────────────────────────── */
.flash-container {
    position: fixed;
    top: calc(var(--navbar-height) + 12px);
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    font-size: var(--text-sm);
    border: 1px solid transparent;
}

.flash-success { background: var(--success-bg); border-color: #BBF7D0; color: #15803D; }
.flash-error { background: var(--error-bg); border-color: #FECACA; color: #991B1B; }
.flash-warning { background: var(--warning-bg); border-color: #FDE68A; color: #92400E; }
.flash-info { background: var(--info-bg); border-color: #BFDBFE; color: #1E40AF; }

.flash-icon { flex-shrink: 0; }
.flash-text { flex: 1; }
.flash-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.5;
    padding: 0 2px;
    color: inherit;
    line-height: 1;
}
.flash-close:hover { opacity: 1; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--muted);
}

.data-table td {
    padding: 12px 16px;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--muted); }

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-slow);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
}

.modal-header h3 {
    font-size: var(--text-lg);
}

.modal-body { padding: 0 24px 16px; }

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
}

/* ── Stat Card ──────────────────────────────── */
.stat-card { padding: var(--space-6); }

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.stat-card .stat-value {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--foreground);
    line-height: 1;
    margin-bottom: 2px;
    letter-spacing: -0.025em;
}

.stat-card .stat-label {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    font-weight: 400;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--error); }

/* ── Empty State ────────────────────────────── */
.empty-state { text-align: center; padding: var(--space-16) var(--space-8); }
.empty-state svg { width: 64px; height: 64px; color: var(--gray-300); margin-bottom: var(--space-4); }
.empty-state h3 { color: var(--foreground); margin-bottom: var(--space-2); font-size: var(--text-base); }
.empty-state p { color: var(--muted-foreground); max-width: 360px; margin: 0 auto; font-size: var(--text-sm); }

/* ── Spinner & Progress ─────────────────────── */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--foreground); border-radius: var(--radius-full); animation: spin 0.6s linear infinite; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar { width: 100%; height: 6px; background: var(--muted); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); background: var(--foreground); transition: width 0.5s ease; }

/* ── Toggle Switch ──────────────────────────── */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-200); border-radius: var(--radius-full); transition: background var(--transition-fast); }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: var(--radius-full); background: #fff; box-shadow: var(--shadow-sm); top: 3px; left: 3px; transition: transform var(--transition-fast); }
.toggle input:checked + .toggle-slider { background: var(--foreground); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Tooltip ────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 4px 8px; font-size: 11px; color: #fff; background: var(--gray-900); border-radius: var(--radius-sm); white-space: nowrap; opacity: 0; visibility: hidden; transition: all var(--transition-fast); z-index: 100; pointer-events: none; }
[data-tooltip]:hover::after { opacity: 1; visibility: visible; }

/* ── Notification Dropdown ──────────────────── */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 420px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
}

.notification-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-dropdown-header h4 {
    font-size: var(--text-sm);
    font-weight: 600;
}

.notification-list {
    max-height: 340px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notification-item:hover { background: var(--muted); }
.notification-item:last-child { border-bottom: none; }
.notification-item.unread { background: var(--brand-50); }

.notification-item .notif-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 2px;
}

.notification-item .notif-body {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    line-height: 1.4;
}

.notification-item .notif-time {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ── Brand Logos ────────────────────────────── */
.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ── Layout Utilities ───────────────────────── */
.container { width: 100%; max-width: var(--content-max-width); margin: 0 auto; padding: 0 var(--space-6); }
.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.hidden { display: none !important; }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .hide-mobile { display: none !important; }
    h1 { font-size: var(--text-2xl); }
    h2 { font-size: var(--text-xl); }
    h3 { font-size: var(--text-lg); }
}

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Separator ──────────────────────────────── */
.separator {
    height: 1px;
    background: var(--border);
    margin: var(--space-4) 0;
}
