/* ============================================================
   RESUME BUILDER — Layout & Form
   ============================================================ */

.rb-wrap { padding-top: 40px; padding-bottom: 80px; }

/* Top bar */
.rb-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.rb-templates { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-templates-label { font-size: 0.8rem; color: var(--ink-4); font-family: var(--font-mono); }

.rb-tpl-btn {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink-3);
    cursor: pointer;
    transition: all 0.18s;
}
.rb-tpl-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.rb-tpl-btn.active { border-color: var(--red); background: var(--red-pale); color: var(--red); font-weight: 600; }

.rb-actions { display: flex; align-items: center; gap: 8px; }

/* Shared button styles */
.rb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
    text-decoration: none;
}
.rb-btn-primary { background: var(--red); color: #fff; }
.rb-btn-primary:hover { background: var(--red-hover); color: #fff; }
.rb-btn-ghost { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.rb-btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.rb-btn-sm { font-size: 0.8rem; padding: 5px 12px; }
.rb-btn-full { width: 100%; justify-content: center; }
.rb-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* LinkedIn bar */
.rb-linkedin-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 11px 18px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--ink-2);
}
.rb-li-hint { font-size: 0.78rem; color: var(--ink-4); font-family: var(--font-mono); }

.rb-linkedin-paste {
    padding: 16px 18px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.rb-linkedin-paste textarea {
    width: 100%;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    resize: vertical;
    background: var(--bg);
    outline: none;
    transition: border-color 0.18s;
    line-height: 1.6;
}
.rb-linkedin-paste textarea:focus { border-color: var(--red); }
.rb-li-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.rb-li-status { font-size: 0.82rem; color: var(--ink-4); font-family: var(--font-mono); }
.rb-li-status.success { color: #2a9d5c; }
.rb-li-status.error   { color: var(--red); }

/* Main layout */
.rb-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 28px;
    align-items: start;
}
@media (max-width: 980px) {
    .rb-layout { grid-template-columns: 1fr; }
}

/* Form panel */
.rb-form-panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 24px;
}

.rb-section { margin-bottom: 28px; }
.rb-section:last-child { margin-bottom: 0; }

.rb-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.rb-section-head svg { flex-shrink: 0; }

.rb-add-btn {
    margin-left: auto;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--red);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.rb-add-btn:hover { background: var(--red-pale); }

.rb-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.rb-field { display: flex; flex-direction: column; gap: 5px; }
.rb-full   { grid-column: 1 / -1; }

.rb-field label {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: 0.02em;
}
.rb-hint { font-weight: 400; color: var(--ink-4); }

.rb-field input,
.rb-field textarea {
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.18s, background 0.18s;
    width: 100%;
}
.rb-field input:focus,
.rb-field textarea:focus { border-color: var(--red); background: var(--white); }
.rb-field textarea { resize: vertical; line-height: 1.6; }

/* Repeater items */
.rb-repeater-list { display: flex; flex-direction: column; gap: 14px; }

.rb-repeater-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.rb-repeater-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-2);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-2);
    user-select: none;
}
.rb-repeater-head:hover { background: var(--line); }
.rb-repeater-toggle { font-size: 0.75rem; color: var(--ink-4); transition: transform 0.2s; }
.rb-repeater-item.open .rb-repeater-toggle { transform: rotate(180deg); }
.rb-repeater-body {
    padding: 14px;
    display: none;
}
.rb-repeater-item.open .rb-repeater-body { display: block; }
.rb-repeater-body .rb-fields-grid { margin-bottom: 10px; }
.rb-remove-btn {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    color: var(--red);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, border-color 0.15s;
}
.rb-remove-btn:hover { background: var(--red-pale); border-color: var(--red); }

/* ============================================================
   PREVIEW PANEL
   ============================================================ */
.rb-preview-panel { min-width: 0; }
.rb-preview-sticky { position: sticky; top: 80px; }
.rb-preview-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.rb-preview {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    min-height: 640px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.rb-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 400px;
    color: var(--ink-4);
    font-size: 0.9rem;
    text-align: center;
    padding: 40px;
}
.rb-preview-placeholder p { margin: 0; }

/* ─── CLASSIC TEMPLATE ─────────────────────────────────── */
.rb-preview.tpl-classic { font-family: 'Georgia', serif; padding: 40px 44px; color: #1a1a1a; }
.tpl-classic .rv-name  { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.tpl-classic .rv-title { font-size: 1rem; color: #555; margin-bottom: 10px; font-style: italic; }
.tpl-classic .rv-contact {
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    font-family: Arial, sans-serif; font-size: 0.78rem; color: #555;
    border-bottom: 2px solid #1a1a1a; padding-bottom: 12px; margin-bottom: 20px;
}
.tpl-classic .rv-section-title {
    font-size: 0.7rem; font-family: Arial, sans-serif;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: #1a1a1a; border-bottom: 1px solid #ccc;
    padding-bottom: 4px; margin: 18px 0 10px;
}
.tpl-classic .rv-summary { font-size: 0.88rem; line-height: 1.7; color: #333; font-family: Arial, sans-serif; }
.tpl-classic .rv-exp-item,
.tpl-classic .rv-edu-item { margin-bottom: 14px; font-family: Arial, sans-serif; }
.tpl-classic .rv-exp-head { display: flex; justify-content: space-between; align-items: flex-start; }
.tpl-classic .rv-exp-company { font-weight: 700; font-size: 0.92rem; color: #1a1a1a; }
.tpl-classic .rv-exp-dates   { font-size: 0.78rem; color: #777; white-space: nowrap; }
.tpl-classic .rv-exp-role    { font-size: 0.85rem; color: #444; font-style: italic; margin-bottom: 4px; }
.tpl-classic .rv-exp-bullets { font-size: 0.85rem; color: #333; line-height: 1.65; margin: 4px 0 0 16px; }
.tpl-classic .rv-skills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-classic .rv-skill-tag {
    font-family: Arial, sans-serif; font-size: 0.78rem;
    padding: 3px 10px; border: 1px solid #ccc; border-radius: 3px; color: #333;
}

/* ─── MODERN TEMPLATE ──────────────────────────────────── */
.rb-preview.tpl-modern { font-family: 'Outfit', sans-serif; display: flex; min-height: 640px; color: #1a1a1a; }
.tpl-modern .rv-sidebar {
    width: 220px; flex-shrink: 0;
    background: #111; color: #eee;
    padding: 32px 22px;
}
.tpl-modern .rv-main { flex: 1; padding: 32px 28px; overflow: hidden; }
.tpl-modern .rv-name  { font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.tpl-modern .rv-title { font-size: 0.82rem; color: #aaa; margin-bottom: 20px; }
.tpl-modern .rv-contact { display: flex; flex-direction: column; gap: 7px; font-size: 0.78rem; color: #bbb; margin-bottom: 24px; }
.tpl-modern .rv-sidebar-section { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.12em; color: #888; margin: 18px 0 8px; }
.tpl-modern .rv-skill-tag {
    display: inline-block; font-size: 0.75rem; color: #ddd;
    background: rgba(255,255,255,0.08); padding: 3px 9px;
    border-radius: 3px; margin: 3px 3px 0 0;
}
.tpl-modern .rv-section-title {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em;
    color: #E03B1F; font-weight: 700; margin: 20px 0 10px;
}
.tpl-modern .rv-summary { font-size: 0.88rem; line-height: 1.7; color: #333; }
.tpl-modern .rv-exp-item,
.tpl-modern .rv-edu-item { margin-bottom: 14px; }
.tpl-modern .rv-exp-head { display: flex; justify-content: space-between; align-items: flex-start; }
.tpl-modern .rv-exp-company { font-weight: 700; font-size: 0.9rem; }
.tpl-modern .rv-exp-dates   { font-size: 0.75rem; color: #888; white-space: nowrap; }
.tpl-modern .rv-exp-role    { font-size: 0.82rem; color: #555; margin-bottom: 4px; }
.tpl-modern .rv-exp-bullets { font-size: 0.84rem; color: #444; line-height: 1.65; margin: 4px 0 0 16px; }

/* ─── MINIMAL TEMPLATE ─────────────────────────────────── */
.rb-preview.tpl-minimal { font-family: 'Outfit', sans-serif; padding: 40px 44px; color: #1a1a1a; }
.tpl-minimal .rv-name  { font-size: 2.1rem; font-weight: 300; letter-spacing: -0.03em; color: #111; }
.tpl-minimal .rv-title { font-size: 0.9rem; color: #E03B1F; font-weight: 600; margin-bottom: 10px; }
.tpl-minimal .rv-contact {
    display: flex; flex-wrap: wrap; gap: 4px 20px;
    font-size: 0.78rem; color: #777; margin-bottom: 28px;
}
.tpl-minimal .rv-divider { height: 1px; background: #eee; margin: 16px 0; }
.tpl-minimal .rv-section-title {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em;
    color: #bbb; font-weight: 700; margin: 20px 0 10px;
}
.tpl-minimal .rv-summary { font-size: 0.88rem; line-height: 1.75; color: #444; }
.tpl-minimal .rv-exp-item,
.tpl-minimal .rv-edu-item { margin-bottom: 16px; }
.tpl-minimal .rv-exp-head { display: flex; justify-content: space-between; align-items: flex-start; }
.tpl-minimal .rv-exp-company { font-weight: 600; font-size: 0.9rem; }
.tpl-minimal .rv-exp-dates   { font-size: 0.76rem; color: #aaa; white-space: nowrap; }
.tpl-minimal .rv-exp-role    { font-size: 0.83rem; color: #E03B1F; margin-bottom: 4px; }
.tpl-minimal .rv-exp-bullets { font-size: 0.84rem; color: #555; line-height: 1.65; margin: 4px 0 0 16px; }
.tpl-minimal .rv-skills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-minimal .rv-skill-tag {
    font-size: 0.78rem; color: #555;
    border: 1px solid #ddd; padding: 3px 11px; border-radius: 30px;
}

/* ============================================================
   MODALS
   ============================================================ */
.rb-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.rb-modal-overlay.is-open { display: flex; }
.rb-modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 420px;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.rb-modal-close {
    position: absolute;
    top: 14px; right: 16px;
    background: none; border: none;
    font-size: 1.4rem; line-height: 1;
    color: var(--ink-4);
    cursor: pointer;
    transition: color 0.15s;
}
.rb-modal-close:hover { color: var(--ink); }

.rb-modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}
.rb-modal-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-4);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}
.rb-modal-tab.active { color: var(--red); border-bottom-color: var(--red); }
.rb-modal-panel { display: flex; flex-direction: column; gap: 14px; }
.rb-field-msg { font-size: 0.82rem; min-height: 18px; }
.rb-field-msg.error   { color: var(--red); }
.rb-field-msg.success { color: #2a9d5c; }

/* Autosave bar */
.rb-autosave-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 18px;
    background: #f0faf4;
    border: 1px solid #b6e8ca;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.82rem;
    color: #2a7a4a;
    font-family: var(--font-mono);
}
.rb-autosave-bar.warn {
    background: var(--red-pale);
    border-color: #f5b8ae;
    color: var(--red);
}

/* Saved resumes list */
#rb-saved-list { display: flex; flex-direction: column; gap: 10px; }
.rb-saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    gap: 10px;
}
.rb-saved-item-name { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.rb-saved-item-date { font-size: 0.75rem; color: var(--ink-4); }
.rb-saved-item-actions { display: flex; gap: 6px; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    body > *:not(.rb-wrap) { display: none !important; }
    .rb-topbar,
    .rb-linkedin-bar,
    .rb-linkedin-paste,
    .rb-form-panel,
    .rb-preview-label,
    .rb-modal-overlay,
    .ains-header,
    .ains-footer,
    .ains-page-header { display: none !important; }

    .rb-wrap     { padding: 0 !important; }
    .rb-layout   { display: block !important; }
    .rb-preview-panel { width: 100% !important; }
    .rb-preview-sticky { position: static !important; }
    .rb-preview {
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        min-height: unset !important;
    }
    @page { margin: 0.5in; size: letter; }
}
