/* ═══════════════════════════════════════════════════════════
   AgeDash AI Systems — LinkedIn Search Panel
   Clean, professional, mobile-first
   ═══════════════════════════════════════════════════════════ */

:root {
    --orange-50:  #fff7ed;
    --orange-100: #ffedd5;
    --orange-200: #fed7aa;
    --orange-500: #f97316;
    --orange-600: #ea580c;
    --orange-700: #c2410c;

    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-900: #0f172a;

    --green-600: #16a34a;
    --red-500:   #ef4444;
    --red-50:    #fef2f2;

    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, .08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--slate-50);
    color: var(--slate-900);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

svg { display: block; }

/* the hidden attribute must always win over display:flex/grid rules */
[hidden] { display: none !important; }
button svg, a svg, .btn svg { width: 18px; height: 18px; flex-shrink: 0; }

a { color: var(--orange-600); }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: 600 15px/1 var(--font);
    padding: 13px 22px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 3px solid var(--orange-200); outline-offset: 2px; }

.btn-primary {
    background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
    color: #fff;
    box-shadow: 0 4px 14px rgba(249, 115, 22, .35);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--orange-600), var(--orange-700)); box-shadow: 0 6px 20px rgba(249, 115, 22, .45); }

.btn-ghost {
    background: #fff;
    color: var(--slate-600);
    border: 1.5px solid var(--slate-200);
}
.btn-ghost:hover { border-color: var(--orange-500); color: var(--orange-600); background: var(--orange-50); }

.btn-sm { padding: 9px 14px; font-size: 14px; }
.btn-block { width: 100%; }

.btn-sheet {
    background: #fff;
    color: var(--slate-700);
    border: 1.5px solid var(--slate-200);
}
.btn-sheet:hover { border-color: var(--green-600); background: #f0fdf4; }
.btn-sheet svg { width: 20px; height: 20px; }

/* ─── Fields ──────────────────────────────────────────────── */
.field { display: block; margin-bottom: 18px; }
.field-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--slate-600);
    margin-bottom: 7px;
    letter-spacing: .01em;
}
.field-label em { color: var(--red-500); font-style: normal; }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    font: 400 15px/1.5 var(--font);
    color: var(--slate-900);
    background: #fff;
    border: 1.5px solid var(--slate-200);
    border-radius: 12px;
    padding: 13px 15px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input:hover, textarea:hover { border-color: var(--slate-300); }
input:focus, textarea:focus {
    outline: none;
    border-color: var(--orange-500);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, .12);
}
input::placeholder, textarea::placeholder { color: var(--slate-400); }

textarea { resize: vertical; min-height: 130px; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */
.login-body {
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(249, 115, 22, .12), transparent 60%),
        radial-gradient(700px 450px at -10% 110%, rgba(249, 115, 22, .10), transparent 60%),
        var(--slate-50);
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px 32px 28px;
    animation: rise .45s ease both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: 14px; }
.login-brand p { font-size: 14px; color: var(--slate-500); margin-top: 3px; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; height: 52px;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
    color: #fff;
    box-shadow: 0 6px 18px rgba(249, 115, 22, .35);
}
.brand-mark svg { width: 26px; height: 26px; }

.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 48px; }
.password-toggle {
    position: absolute;
    top: 50%; right: 8px;
    transform: translateY(-50%);
    background: none; border: none;
    padding: 8px; cursor: pointer;
    color: var(--slate-400);
    border-radius: 8px;
    transition: color .2s ease;
}
.password-toggle:hover { color: var(--slate-600); }

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-error { background: var(--red-50); color: #b91c1c; border: 1px solid #fecaca; }

.login-foot {
    text-align: center;
    font-size: 12.5px;
    color: var(--slate-400);
    margin-top: 24px;
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════ */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--slate-200);
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-brand .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.topbar-brand .brand-mark svg { width: 20px; height: 20px; }
.topbar-title { min-width: 0; }
.topbar-title strong { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title span { display: block; font-size: 12.5px; color: var(--slate-500); }

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 28px 16px 60px;
}

/* ─── Tab switcher ────────────────────────────────────────── */
.tab-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: 16px;
    padding: 6px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
}
.tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: 600 14px/1.25 var(--font);
    color: var(--slate-500);
    background: transparent;
    border: none;
    border-radius: 11px;
    padding: 12px 10px;
    cursor: pointer;
    transition: background-color .25s ease, color .25s ease, box-shadow .25s ease;
    text-align: center;
}
.tab-btn:hover { color: var(--slate-700); background: var(--slate-100); }
.tab-btn:focus-visible { outline: 3px solid var(--orange-200); outline-offset: 1px; }
.tab-btn.active {
    background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
    color: #fff;
    box-shadow: 0 4px 12px rgba(249, 115, 22, .35);
}
.tab-btn svg { width: 17px; height: 17px; }
.tab-glider { display: none; }

/* ─── Card ────────────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 26px 24px;
    animation: rise .35s ease both;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}
.card-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.card-head p { font-size: 13.5px; color: var(--slate-500); margin-top: 3px; }

/* sheet icon buttons (top-right of form) */
.sheet-links { display: flex; gap: 8px; flex-shrink: 0; }
.sheet-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--slate-50);
    border: 1.5px solid var(--slate-200);
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease, transform .15s ease;
}
.sheet-btn:hover { border-color: var(--green-600); background: #f0fdf4; transform: translateY(-1px); }
.sheet-btn.sheet-btn-input:hover { border-color: #1a73e8; background: #eff6ff; }
.sheet-btn svg { width: 22px; height: 22px; }
.sheet-btn:focus-visible { outline: 3px solid var(--orange-200); outline-offset: 2px; }

/* tooltips */
[data-tip] { position: relative; }
[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--slate-900);
    color: #fff;
    font: 500 12px/1.3 var(--font);
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity .2s ease, transform .2s ease;
    z-index: 30;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: none; }

/* notice banner (company form) */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--orange-50);
    border: 1px solid var(--orange-200);
    color: var(--orange-700);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 20px;
}
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.notice a { color: var(--orange-700); font-weight: 700; }

/* ─── Mode switch (file / text) ───────────────────────────── */
.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: var(--slate-100);
    border-radius: 12px;
    padding: 5px;
    margin-bottom: 18px;
}
.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font: 600 13.5px/1 var(--font);
    color: var(--slate-500);
    background: transparent;
    border: none;
    border-radius: 9px;
    padding: 10px 8px;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.mode-btn:hover { color: var(--slate-700); }
.mode-btn.active {
    background: #fff;
    color: var(--orange-600);
    box-shadow: var(--shadow-sm);
}
.mode-btn svg { width: 16px; height: 16px; }
.mode-btn:focus-visible { outline: 3px solid var(--orange-200); outline-offset: 1px; }

.mode-panel { margin-bottom: 18px; }

/* ─── Dropzone ────────────────────────────────────────────── */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    border: 2px dashed var(--slate-300);
    border-radius: var(--radius);
    background: var(--slate-50);
    padding: 30px 16px;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--orange-500);
    background: var(--orange-50);
}
.dropzone svg { width: 34px; height: 34px; color: var(--orange-500); margin-bottom: 4px; }
.dropzone strong { font-size: 14.5px; font-weight: 600; color: var(--slate-700); }
.dropzone .dz-or { font-weight: 400; color: var(--slate-500); }
.dz-hint { font-size: 12.5px; color: var(--slate-400); }

/* selected file chip */
.file-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--orange-50);
    border: 1.5px solid var(--orange-200);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 10px;
}
.file-chip svg { width: 20px; height: 20px; color: var(--orange-600); flex-shrink: 0; }
.file-chip-name {
    font-size: 14px; font-weight: 600; color: var(--slate-700);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0; flex: 1;
}
.file-chip-size { font-size: 12.5px; color: var(--slate-500); flex-shrink: 0; }
.file-remove {
    background: none; border: none; cursor: pointer;
    color: var(--slate-400); padding: 6px; border-radius: 8px;
    transition: color .2s ease, background-color .2s ease;
    flex-shrink: 0;
}
.file-remove:hover { color: var(--red-500); background: #fff; }
.file-remove svg { width: 15px; height: 15px; color: inherit; }

/* ─── Textarea + expand ───────────────────────────────────── */
.textarea-wrap { position: relative; }
.expand-btn {
    position: absolute;
    top: 10px; right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    background: #fff;
    border: 1.5px solid var(--slate-200);
    border-radius: 9px;
    color: var(--slate-500);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease;
}
.expand-btn:hover { color: var(--orange-600); border-color: var(--orange-500); }
.expand-btn svg { width: 15px; height: 15px; }

/* form error */
.form-error {
    display: flex;
    align-items: center;
    font-size: 13.5px;
    font-weight: 600;
    color: #b91c1c;
    background: var(--red-50);
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 10px 13px;
    margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════
   FULL-SCREEN TEXT MODAL
   ═══════════════════════════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 23, 42, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-inner {
    width: 100%;
    max-width: 900px;
    height: 100%;
    max-height: 92vh;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: rise .25s ease both;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--slate-200);
}
.modal-head h3 {
    display: flex; align-items: center; gap: 9px;
    font-size: 16px; font-weight: 700;
}
.modal-head h3 svg { width: 17px; height: 17px; color: var(--orange-600); }

#modalTextarea {
    flex: 1;
    border: none;
    border-radius: 0;
    resize: none;
    padding: 20px;
    font-size: 15.5px;
    line-height: 1.65;
    min-height: 0;
}
#modalTextarea:focus { box-shadow: none; }

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--slate-200);
    background: var(--slate-50);
}
#modalCount { font-size: 13px; color: var(--slate-500); }

/* ═══════════════════════════════════════════════════════════
   LOADING / SUCCESS OVERLAY
   ═══════════════════════════════════════════════════════════ */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(248, 250, 252, .96);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .25s ease both;
}
.overlay-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 44px 32px;
    text-align: center;
    animation: rise .3s ease both;
}
.overlay-state h3 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 20px 0 8px; }
.overlay-state p { font-size: 14.5px; color: var(--slate-500); margin-bottom: 4px; }
.overlay-state .btn { margin-top: 18px; width: 100%; }
.overlay-state .btn + .btn { margin-top: 10px; }

.spinner {
    width: 58px; height: 58px;
    margin: 0 auto;
    border-radius: 50%;
    border: 5px solid var(--orange-100);
    border-top-color: var(--orange-500);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.success-ring, .error-ring {
    width: 64px; height: 64px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pop .4s cubic-bezier(.36, 1.6, .5, 1) both;
}
.success-ring { background: #dcfce7; color: var(--green-600); }
.error-ring   { background: var(--red-50); color: var(--red-500); }
.success-ring svg, .error-ring svg { width: 30px; height: 30px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--slate-900);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    padding: 13px 16px;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    max-width: calc(100vw - 32px);
    animation: toastIn .35s cubic-bezier(.36, 1.3, .5, 1) both;
}
@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.toast svg { width: 18px; height: 18px; color: var(--orange-500); flex-shrink: 0; }
.toast a { color: #fdba74; font-weight: 700; }
.toast-close {
    background: none; border: none; cursor: pointer;
    color: var(--slate-400); padding: 4px; border-radius: 6px;
    flex-shrink: 0;
    transition: color .2s ease;
}
.toast-close:hover { color: #fff; }
.toast-close svg { width: 14px; height: 14px; color: inherit; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .page { padding: 18px 12px 48px; }
    .card { padding: 20px 16px; }
    .tab-btn { font-size: 12.5px; padding: 11px 6px; flex-direction: column; gap: 5px; }
    .tab-btn svg { width: 16px; height: 16px; }
    .card-head { flex-direction: column-reverse; }
    .sheet-links { align-self: flex-end; }
    .topbar-title span { display: none; }
    .login-card { padding: 30px 22px 22px; }
    .overlay-card { padding: 34px 22px; }
    [data-tip]::after { display: none; } /* tooltips off on touch */
}

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