/* ═══════════════════════════════════════════════════════════
   CareerARIA — Global Design System
   Professional Light Theme · Plus Jakarta Sans · Swiss Style
   Job seeker SaaS — trustworthy, clean, credible
   ═══════════════════════════════════════════════════════════ */

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

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

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    /* ── Background layers ── */
    --bg-base:        #F0F9FF;   /* page background — light sky */
    --bg-surface:     #FFFFFF;   /* cards, sidebar, modals */
    --bg-surface-2:   #F8FAFC;   /* secondary surfaces, input bg */
    --bg-surface-3:   #F1F5F9;   /* hover states, tertiary */

    /* ── Brand & actions ── */
    --accent:         #0369A1;   /* primary brand — professional blue */
    --accent-hover:   #0284C7;
    --accent-light:   #EFF6FF;   /* icon backgrounds, chip bg */
    --accent-muted:   rgba(3,105,161,0.08);
    --accent-border:  rgba(3,105,161,0.2);

    /* ── Success / Warning / Error ── */
    --success:        #16A34A;
    --success-light:  #F0FDF4;
    --success-border: rgba(22,163,74,0.2);
    --warning:        #D97706;
    --warning-light:  #FFFBEB;
    --warning-border: rgba(217,119,6,0.2);
    --error:          #DC2626;
    --error-light:    #FEF2F2;
    --error-border:   rgba(220,38,38,0.2);

    /* ── Text ── */
    --text-primary:   #0C4A6E;   /* headings — deep navy */
    --text-body:      #1E3A5F;   /* body text */
    --text-secondary: #475569;   /* labels, subtitles */
    --text-muted:     #94A3B8;   /* hints, placeholders */
    --text-disabled:  #CBD5E1;

    /* ── Borders ── */
    --border:         #E2E8F0;
    --border-strong:  #CBD5E1;
    --border-focus:   #0369A1;

    /* ── Spacing ── */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* ── Typography ── */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --text-xs:   11px;
    --text-sm:   13px;
    --text-base: 15px;
    --text-md:   17px;
    --text-lg:   20px;
    --text-xl:   24px;
    --text-2xl:  30px;
    --text-3xl:  38px;

    /* ── Border radius ── */
    --radius-sm:   6px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-2xl:  20px;
    --radius-full: 9999px;

    /* ── Shadows ── */
    --shadow-xs:  0 1px 2px rgba(15,23,42,0.04);
    --shadow-sm:  0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.06);
    --shadow-md:  0 4px 16px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
    --shadow-lg:  0 12px 40px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.06);
    --shadow-xl:  0 20px 60px rgba(15,23,42,0.15);
    --shadow-accent: 0 4px 16px rgba(3,105,161,0.2);

    /* ── Transitions ── */
    --transition:      0.18s ease;
    --transition-slow: 0.3s ease;

    /* ── Layout ── */
    --topnav-height: 56px;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 56px;

    /* ── Z-index scale ── */
    --z-base:    1;
    --z-above:   10;
    --z-dropdown:20;
    --z-modal:   50;
    --z-toast:   100;
}

/* ── Base ───────────────────────────────────────────────────── */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text-body);
    background: var(--bg-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Skip link for keyboard accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: 0 0 var(--radius-md) 0;
    z-index: var(--z-toast);
    text-decoration: none;
}
.skip-link:focus { top: 0; }

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

img { max-width: 100%; display: block; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); font-weight: 600; }
h5 { font-size: var(--text-base); font-weight: 600; }

p {
    color: var(--text-secondary);
    line-height: 1.65;
}

/* Text utilities */
.text-xs       { font-size: var(--text-xs); }
.text-sm       { font-size: var(--text-sm); }
.text-base     { font-size: var(--text-base); }
.text-lg       { font-size: var(--text-lg); }
.text-primary  { color: var(--text-primary) !important; }
.text-secondary{ color: var(--text-secondary) !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-success  { color: var(--success) !important; }
.text-warning  { color: var(--warning) !important; }
.text-error    { color: var(--error) !important; }
.text-accent   { color: var(--accent) !important; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
    outline: none;
}

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

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: var(--shadow-accent);
    color: #fff;
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* Secondary */
.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
    background: var(--bg-surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--bg-surface-3);
    color: var(--text-primary);
}

/* Danger */
.btn-danger {
    background: var(--error-light);
    color: var(--error);
    border-color: var(--error-border);
}
.btn-danger:hover {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
}

/* Sizes */
.btn-sm  { padding: 7px 14px; font-size: var(--text-xs); }
.btn-lg  { padding: 13px 28px; font-size: var(--text-base); border-radius: var(--radius-lg); }
.btn-xl  { padding: 16px 36px; font-size: var(--text-md); border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

/* Icon button */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    letter-spacing: -0.01em;
}

.label-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 400;
}

.label-required {
    color: var(--error);
    font-size: var(--text-xs);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
    -webkit-appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(3,105,161,0.12);
    background: var(--bg-surface);
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); }

input:disabled,
textarea:disabled,
select:disabled {
    background: var(--bg-surface-3);
    color: var(--text-disabled);
    cursor: not-allowed;
}

textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.input-error {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1) !important;
}

.field-error {
    font-size: var(--text-xs);
    color: var(--error);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
}

.card-hover {
    cursor: pointer;
    transition: all var(--transition);
}
.card-hover:hover {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-accent {
    border-left: 3px solid var(--accent);
}

/* ── Badges & Tags ──────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.badge-blue    { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-green   { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.badge-yellow  { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-red     { background: var(--error-light); color: var(--error); border: 1px solid var(--error-border); }
.badge-gray    { background: var(--bg-surface-3); color: var(--text-secondary); border: 1px solid var(--border); }

/* Plan badges */
.plan-free      { background: var(--bg-surface-3); color: var(--text-secondary); border: 1px solid var(--border); }
.plan-starter   { background: #EFF6FF; color: #2563EB; border: 1px solid rgba(37,99,235,0.2); }
.plan-pro       { background: #F5F3FF; color: #7C3AED; border: 1px solid rgba(124,58,237,0.2); }
.plan-unlimited { background: #FFF7ED; color: #EA580C; border: 1px solid rgba(234,88,12,0.2); }
.plan-custom    { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; } /* overridden inline for custom colors */

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    padding: 14px var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}

.alert-icon { flex-shrink: 0; margin-top: 1px; }

.alert-success {
    background: var(--success-light);
    border-color: var(--success-border);
    color: #166534;
}
.alert-error {
    background: var(--error-light);
    border-color: var(--error-border);
    color: #991B1B;
}
.alert-warning {
    background: var(--warning-light);
    border-color: var(--warning-border);
    color: #92400E;
}
.alert-info {
    background: var(--accent-light);
    border-color: var(--accent-border);
    color: #1E40AF;
}

/* ── Toast Notifications ────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 9999;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.22s ease forwards;
    max-width: 380px;
    pointer-events: all;
    border: 1px solid transparent;
}

.toast-success {
    background: var(--bg-surface);
    color: #166534;
    border-color: var(--success-border);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--success-border);
}
.toast-error {
    background: var(--bg-surface);
    color: #991B1B;
    border-color: var(--error-border);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--error-border);
}
.toast-info {
    background: var(--bg-surface);
    color: var(--accent);
    border-color: var(--accent-border);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-border);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(3,105,161,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}
.spinner-white {
    border-color: rgba(255,255,255,0.3);
    border-top-color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-lg) 0;
}
.divider-label {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: var(--space-lg) 0;
}
.divider-label::before,
.divider-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
}
.empty-state-icon {
    width: 64px; height: 64px;
    background: var(--accent-light);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    color: var(--accent);
}
.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}
.empty-state-desc {
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: 340px;
    line-height: 1.6;
    margin-bottom: var(--space-lg);
}

/* ── Logo ───────────────────────────────────────────────────── */
.logo-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.logo-icon-wrap {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.logo-text {
    font-size: var(--text-md);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

/* ── Utilities ──────────────────────────────────────────────── */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm        { gap: var(--space-sm); }
.gap-md        { gap: var(--space-md); }
.gap-lg        { gap: var(--space-lg); }
.w-full        { width: 100%; }

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

/* ── Selection ──────────────────────────────────────────────── */
::selection { background: rgba(3,105,161,0.15); color: var(--text-primary); }
