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

:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --border: #e2e6ea;
    --border-light: #f0f2f5;
    --text: #1a1d21;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --sidebar-width: 300px;
    --topbar-height: 56px;

    /* Status colours */
    --status-grey: #9ca3af;
    --status-amber: #f59e0b;
    --status-blue: #3b82f6;
    --status-green: #10b981;
    --status-red: #ef4444;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center;
    justify-content: center; background: linear-gradient(135deg, #f0f4ff 0%, #fafbff 100%); }

.login-box { background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 48px 40px; text-align: center;
    max-width: 380px; width: 90%; box-shadow: 0 4px 24px rgba(0,0,0,.06); }

.login-logo { color: var(--primary); margin-bottom: 16px; }
.login-box h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }

.error-msg { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626;
    padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }

.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 10px 16px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface); color: var(--text);
    font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
    transition: background .15s, border-color .15s; }
.btn-google:hover { background: var(--bg); border-color: #d1d5db; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.app-layout { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar { height: var(--topbar-height); background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; gap: 16px; flex-shrink: 0; }

.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-icon { color: var(--primary); flex-shrink: 0; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.summary-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.summary-num { font-weight: 700; color: var(--text); }
.summary-num.contacted { color: var(--primary); }
.summary-num.awaiting { color: var(--status-amber); }
.summary-num.interview { color: var(--status-green); }
.summary-divider { color: var(--border); }

.user-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
    border: 1px solid var(--border); }

.btn-small { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text); font-size: 12px; font-weight: 500;
    text-decoration: none; cursor: pointer; transition: background .15s; white-space: nowrap; }
.btn-small:hover { background: var(--bg); }
.btn-logout { color: var(--text-muted); }

.main-area { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar { width: var(--sidebar-width); border-right: 1px solid var(--border);
    background: var(--surface); display: flex; flex-direction: column;
    overflow: hidden; flex-shrink: 0; }

.sidebar-filters { padding: 12px; border-bottom: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 8px; }

.search-input { width: 100%; padding: 7px 10px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 13px; background: var(--bg); outline: none; }
.search-input:focus { border-color: var(--primary); background: var(--surface); }

.filter-row { display: flex; gap: 6px; }
.filter-select { flex: 1; padding: 6px 8px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 12px; background: var(--bg); outline: none; }
.filter-select:focus { border-color: var(--primary); }
.filter-select-full { width: 100%; }

.recruiter-count { padding: 8px 12px; font-size: 11px; color: var(--text-light);
    font-weight: 500; text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 1px solid var(--border-light); }

.recruiter-list { flex: 1; overflow-y: auto; }

.recruiter-item { padding: 10px 12px; border-bottom: 1px solid var(--border-light);
    cursor: pointer; transition: background .1s; }
.recruiter-item:hover { background: var(--bg); }
.recruiter-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.recruiter-item.hidden { display: none; }

.recruiter-item-header { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 4px; }
.recruiter-name { font-weight: 600; font-size: 13px; flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.priority-badge { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 10px;
    white-space: nowrap; text-transform: uppercase; letter-spacing: .3px; }
.priority-high { background: #fef2f2; color: #dc2626; }
.priority-medium { background: #fffbeb; color: #d97706; }
.priority-low { background: #f0fdf4; color: #16a34a; }

.recruiter-item-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.country-tag { font-weight: 600; color: var(--primary); }

.btn-add-recruiter { margin: 10px 12px; padding: 8px; background: var(--primary);
    color: white; border: none; border-radius: 6px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .15s; }
.btn-add-recruiter:hover { background: var(--primary-dark); }

/* ── Status dots ─────────────────────────────────────────────────────────── */
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* grey = not contacted / no response / on hold / withdrawn */
.status-dot.status-not-contacted,
.status-dot.status-no-response,
.status-dot.status-on-hold,
.status-dot.status-withdrawn { background: var(--status-grey); }

/* amber = waiting / submitted / registered / acknowledged */
.status-dot.status-cv-submitted-via-website,
.status-dot.status-cv-submitted-via-email,
.status-dot.status-applied-via-linkedin-easy-apply,
.status-dot.status-linkedin-connection-request-sent,
.status-dot.status-linkedin-dm-sent,
.status-dot.status-registered-on-portal,
.status-dot.status-acknowledged---auto-reply-received,
.status-dot.status-in-review { background: var(--status-amber); }

/* blue = calls / scheduled */
.status-dot.status-phone-call-scheduled,
.status-dot.status-phone-call-completed,
.status-dot.status-interview-scheduled,
.status-dot.status-interview-completed,
.status-dot.status-role-presented { background: var(--status-blue); }

/* green = offer */
.status-dot.status-offer-received { background: var(--status-green); }

/* red = rejected */
.status-dot.status-rejected { background: var(--status-red); }

/* ── Detail Panel ────────────────────────────────────────────────────────── */
.detail-panel { flex: 1; overflow-y: auto; padding: 24px; }

.empty-state { display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100%; color: var(--text-light); gap: 12px; }
.empty-state p { font-size: 14px; }

/* ── Recruiter Detail ────────────────────────────────────────────────────── */
.detail-heading { display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.detail-company { font-size: 22px; font-weight: 800; color: var(--text); }
.detail-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 12px;
    font-weight: 600; white-space: nowrap; }
.status-grey { background: #f3f4f6; color: #4b5563; }
.status-amber { background: #fffbeb; color: #b45309; }
.status-blue { background: #eff6ff; color: #1d4ed8; }
.status-green { background: #f0fdf4; color: #15803d; }
.status-red { background: #fef2f2; color: #b91c1c; }

.detail-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group-full { grid-column: 1 / -1; }
.form-group label { font-size: 11px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px; }

.form-group input, .form-group select, .form-group textarea {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; background: var(--surface); color: var(--text); outline: none;
    font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.form-group textarea { resize: vertical; min-height: 80px; }

.link-field { color: var(--primary); text-decoration: none; font-size: 13px;
    word-break: break-all; }
.link-field:hover { text-decoration: underline; }

.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px;
    padding-top: 8px; }
.btn-primary { padding: 9px 20px; background: var(--primary); color: white;
    border: none; border-radius: 6px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background .15s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { padding: 9px 20px; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
    font-weight: 500; cursor: pointer; transition: background .15s; }
.btn-secondary:hover { background: var(--bg); }

.save-msg { font-size: 13px; color: var(--status-green); font-weight: 500; }
.save-msg.error { color: var(--status-red); }

/* ── Activity Log ────────────────────────────────────────────────────────── */
.activity-section { margin-top: 32px; padding-top: 24px;
    border-top: 1px solid var(--border); }
.activity-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: 7px; top: 24px;
    bottom: -10px; width: 2px; background: var(--border-light); }
.timeline-item:last-child::before { display: none; }

.timeline-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--primary);
    flex-shrink: 0; margin-top: 2px; border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--border); }
.timeline-content { flex: 1; }
.timeline-statuses { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.timeline-arrow { color: var(--text-muted); font-weight: 400; margin: 0 4px; }
.timeline-date { font-size: 11px; color: var(--text-light); }
.timeline-notes { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }

.no-activity { color: var(--text-light); font-size: 13px; font-style: italic; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close { width: 28px; height: 28px; border: none; background: none; font-size: 20px;
    cursor: pointer; color: var(--text-muted); border-radius: 4px; }
.modal-close:hover { background: var(--bg); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px 24px; }
.form-grid .form-group { display: flex; flex-direction: column; gap: 4px; }
.form-grid .form-group-full { grid-column: 1 / -1; }
.form-grid label { font-size: 11px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px; }
.form-grid input, .form-grid select, .form-grid textarea {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; background: var(--surface); color: var(--text); outline: none; font-family: inherit; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
    border-color: var(--primary); }

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

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-width: 100%; }
    .main-area { flex-direction: column; }
    .sidebar { width: 100%; height: 50vh; border-right: none; border-bottom: 1px solid var(--border); }
    .detail-panel { padding: 16px; }
    .detail-form { grid-template-columns: 1fr; }
    .form-group-full { grid-column: 1; }
    .form-actions { flex-wrap: wrap; }
    .summary-bar { display: none; }
    .topbar-title { display: block; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .form-group-full { grid-column: 1; }
}
