/* ==========================================================================
   1. RESET & BASE
   ========================================================================== */
* { margin:0; padding:0; box-sizing:border-box; font-family:'Poppins',sans-serif; }
body { background:#f5f8ff; color:#0f172a; min-height:100vh; overflow-x:hidden; }

/* ==========================================================================
   2. DESIGN TOKENS
   ========================================================================== */
:root {
    --primary: #0f62fe;
    --primary-dark: #0b246e;
    --primary-light: #cfe8ff;
    --muted: #475569;
    --bg: #f5f8ff;
    --card: #ffffff;
    --text: #0f172a;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow-sm: 0 4px 12px rgba(15,23,42,0.04);
    --shadow-md: 0 10px 24px rgba(15,23,42,0.06);
    --shadow-lg: 0 20px 40px rgba(15,23,42,0.1);
    --transition-fast: 150ms ease;
    --transition-smooth: 280ms cubic-bezier(0.34,1.56,0.64,1);
}

/* ==========================================================================
   3. TOPBAR
   ========================================================================== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(15,23,42,0.05);
    box-shadow: var(--shadow-sm);
}

.brand-link { text-decoration: none; }
.brand-link h1 {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text);
    cursor: pointer;
}

.top-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.template-scroll {
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 4px;
    max-width: 600px;
}
.template-scroll::-webkit-scrollbar {
    display: none;
}

.template-btn {
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}
.template-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    background: #fff;
}
.template-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-sm);
}

.action-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    background: transparent;
    border: 1px solid rgba(15,23,42,0.1);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition-fast);
}
.action-btn:hover {
    background: var(--bg);
    border-color: rgba(15,23,42,0.2);
}
.action-btn.danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}
.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.05);
}

.download-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
}
.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   5. BUILDER LAYOUT
   ========================================================================== */
.builder-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    margin-top: 70px;
    height: calc(100vh - 70px);
}

.sidebar {
    overflow-y: auto;
    padding-right: 10px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.1); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,0.2); }

.preview {
    overflow-y: auto;
    padding-right: 10px;
}
.preview::-webkit-scrollbar { width: 6px; }
.preview::-webkit-scrollbar-track { background: transparent; }
.preview::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.1); border-radius: 10px; }
.preview::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,0.2); }

/* ==========================================================================
   6. SECTION BOXES
   ========================================================================== */
.section-box {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    border: 1px solid rgba(15,23,42,0.05);
    margin-bottom: 16px;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.section-box:hover {
    transform: translateY(-1px);
    border-color: rgba(15,98,254,0.2);
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 16px;
    user-select: none;
    background: white;
}
.section-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toggle-icon {
    font-size: 12px;
    color: var(--muted);
    transition: transform 0.3s ease;
}
.section-box.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.section-content {
    max-height: 2000px;
    transition: max-height 400ms ease, opacity 400ms ease, padding 400ms ease, margin 400ms ease;
    overflow: hidden;
    padding: 0 16px 16px 16px;
    opacity: 1;
}
.section-box.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    padding: 0 16px;
    margin: 0;
}

/* ==========================================================================
   7. FORM ELEMENTS
   ========================================================================== */
.form-group {
    margin-bottom: 12px;
}
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
input, textarea, select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(15,23,42,0.08);
    border-radius: 10px;
    background: white;
    font-size: 14px;
    color: var(--text);
    transition: var(--transition-fast);
    outline: none;
}
textarea {
    resize: vertical;
    min-height: 80px;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,98,254,0.1);
    transform: translateY(-1px);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.input-row input {
    flex: 1;
}
.input-row button {
    flex: 0 0 auto;
}

.add-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.add-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.add-btn.full-width {
    width: 100%;
}
.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--muted);
    margin-top: -8px;
    margin-bottom: 8px;
}

/* ==========================================================================
   8. PHOTO UPLOAD AREA
   ========================================================================== */
.photo-upload-area {
    border: 2px dashed rgba(15,98,254,0.2);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(15,98,254,0.01);
    margin-bottom: 16px;
}
.photo-upload-area:hover {
    border-color: var(--primary);
    background: rgba(15,98,254,0.02);
}
.photo-upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(15,98,254,0.06);
    transform: scale(1.02);
}
.upload-placeholder {
    text-align: center;
}
.upload-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}
.upload-placeholder p {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 4px 0;
}
.upload-hint {
    font-size: 11px !important;
    color: rgba(71,85,105,0.7) !important;
}

.photo-preview-wrapper {
    position: relative;
    display: inline-block;
}
.photo-preview-wrapper img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
}
.remove-photo-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   9. TAGS & ITEM CARDS
   ========================================================================== */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
}
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--primary-light), rgba(207,232,255,0.5));
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    animation: tagPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: var(--transition-fast);
}
.tag:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.item-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: white;
    border: 1px solid rgba(15,23,42,0.08);
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
    transition: var(--transition-fast);
}
.item-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.item-card-content {
    flex: 1;
}
.item-card-content strong {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
}
.item-card-content span {
    font-size: 12px;
    color: var(--muted);
}
.inline-delete {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: var(--transition-fast);
}
.inline-delete:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   10. SCORE BOX
   ========================================================================== */
.score-box {
    background: white;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(15,23,42,0.05);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.score-ring-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 12px auto;
}
.score-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.score-ring-bg {
    fill: none;
    stroke: rgba(15,23,42,0.08);
    stroke-width: 8;
}
.score-ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 800ms cubic-bezier(0.4,0,0.2,1);
}
.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

/* ==========================================================================
   11. ATS CHECKER
   ========================================================================== */
.ats-checker {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(15,23,42,0.05);
    box-shadow: var(--shadow-sm);
}
#jobDescription {
    width: 100%;
    height: 70px;
    resize: none;
    border-radius: 10px;
    border: 1px solid rgba(15,23,42,0.08);
    padding: 10px;
    font-size: 13px;
    outline: none;
    transition: var(--transition-fast);
}
#jobDescription:focus {
    border-color: var(--primary);
}
#checkATS {
    margin-top: 8px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    transition: var(--transition-fast);
}
#checkATS:hover {
    background: var(--primary-dark);
}
#atsResult {
    margin-top: 8px;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
}

/* ==========================================================================
   12. RESUME PREVIEW (BASE)
   ========================================================================== */
.resume-preview {
    background: white;
    width: min(794px, 100%);
    min-height: 1123px; /* A4 aspect */
    padding: 40px;
    margin: 16px auto;
    border-radius: 12px;
    border: 1px solid rgba(15,23,42,0.05);
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.resume-preview:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.resume-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 20px;
}
.resume-header-text {
    flex: 1;
}
.resume-header h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 6px;
    line-height: 1.1;
    color: var(--text);
}
.contact-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 13px;
    color: var(--muted);
}
.contact-info span {
    position: relative;
}
.contact-info span:not(:first-child)::before {
    content: '|';
    position: absolute;
    left: -10px;
    color: rgba(15,23,42,0.2);
}

#profilePreview {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
    flex-shrink: 0;
}

.resume-section {
    margin-top: 20px;
}
.resume-section h2 {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 6px;
    margin-bottom: 12px;
    color: var(--text);
}

/* ==========================================================================
   13. PREVIEW CONTENT STYLES
   ========================================================================== */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.skill-pill {
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--primary-light);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.exp-entry, .edu-entry, .project-entry {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(15,23,42,0.06);
}
.exp-entry:last-child, .edu-entry:last-child, .project-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.exp-header, .edu-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.exp-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.exp-duration, .edu-year {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.exp-company, .edu-college {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}
.edu-score {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 2px;
}
.exp-desc {
    font-size: 13px;
    color: var(--muted);
    margin-top: 6px;
    line-height: 1.6;
}

.project-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.project-desc {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    line-height: 1.5;
}
.project-tech {
    display: inline-block;
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 4px;
    font-style: italic;
}

.lang-entry {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(15,23,42,0.06);
}
.lang-entry:last-child {
    border-bottom: none;
}
.lang-name {
    font-weight: 600;
    font-size: 14px;
}
.lang-level {
    font-size: 13px;
    color: var(--muted);
}

.cert-entry {
    margin-bottom: 10px;
}
.cert-entry strong {
    font-size: 14px;
    color: var(--text);
}
.cert-meta {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

/* ==========================================================================
   14. 15 UNIQUE TEMPLATES
   ========================================================================== */

/* 1. MODERN TEMPLATE */
.modern-template .resume-header {
    background: #f0fdf4;
    border-top: 6px solid #2563eb;
    margin: -40px -40px 20px -40px;
    padding: 40px;
    border-radius: 12px 12px 0 0;
}
.modern-template h2 {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}
.modern-template .skill-pill {
    background: #dbeafe;
    color: #1e40af;
}

/* 2. ATS TEMPLATE */
.ats-template {
    font-family: Arial, Helvetica, sans-serif;
    border-radius: 0;
    box-shadow: none;
    border: 1px solid #ccc;
}
.ats-template .resume-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.ats-template h2 {
    text-transform: uppercase;
    border-bottom: 1px solid #000;
    color: #000;
}
.ats-template .skill-pill {
    background: transparent;
    padding: 0;
}
.ats-template .skill-pill:not(:last-child)::after {
    content: ', ';
}
.ats-template #profilePreview {
    display: none !important;
}

/* 3. CLASSIC TEMPLATE */
.classic-template {
    background: #fffaf3;
    border-left: 14px solid #8b5a2b;
}
.classic-template h1, .classic-template h2, .classic-template .exp-title {
    font-family: 'Playfair Display', serif;
}
.classic-template h2 {
    color: #8b5a2b;
    border-bottom: 2px dotted #8b5a2b;
}
.classic-template .skill-pill {
    background: #f4e8d3;
    color: #5c3a1a;
}

/* 4. STUDENT TEMPLATE */
.student-template {
    background: #f0fdf4;
}
.student-template .resume-header {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
}
.student-template h2 {
    color: #059669;
    border-bottom: 2px solid #059669;
}
.student-template .skill-pill {
    background: #d1fae5;
    color: #065f46;
    border-radius: 12px;
}

/* 5. CREATIVE TEMPLATE */
.creative-template {
    background: #faf5ff;
}
.creative-template .resume-header {
    background: linear-gradient(135deg, #9333ea, #4f46e5);
    margin: -40px -40px 20px -40px;
    padding: 40px;
    color: white;
}
.creative-template .resume-header h1,
.creative-template .contact-info,
.creative-template .contact-info span::before {
    color: white;
}
.creative-template h2 {
    color: #9333ea;
    border-bottom: 2px dashed #9333ea;
}
.creative-template .skill-pill {
    background: #f3e8ff;
    color: #6b21a8;
    border-radius: 18px;
}

/* 6. EXECUTIVE TEMPLATE */
.executive-template {
    background: #f8fafc;
    border-top: 4px double #1e293b;
}
.executive-template h1, .executive-template h2 {
    font-family: 'Playfair Display', serif;
}
.executive-template h2 {
    text-transform: uppercase;
    color: #1e293b;
    border-bottom: 2px solid #1e293b;
}
.executive-template .skill-pill {
    background: #e2e8f0;
    color: #0f172a;
}

/* 7. TECH TEMPLATE */
.tech-template {
    background: #eff6ff;
}
.tech-template h1, .tech-template h2 {
    font-family: 'Source Code Pro', monospace;
    color: #1e40af;
}
.tech-template h2::before {
    content: '{ ';
    color: #93c5fd;
}
.tech-template h2::after {
    content: ' }';
    color: #93c5fd;
}
.tech-template h2 {
    border-bottom: none;
}
.tech-template .skill-pill {
    background: #1e40af;
    color: white;
    border-radius: 0;
}
.tech-template .exp-entry, .tech-template .edu-entry {
    border-radius: 0;
}

/* 8. ELEGANT TEMPLATE */
.elegant-template {
    background: #fffaf6;
}
.elegant-template h1, .elegant-template h2 {
    font-family: 'Playfair Display', serif;
}
.elegant-template h2 {
    font-style: italic;
    color: #9a6a43;
    border-bottom: 1px solid #e6d5c3;
    position: relative;
}
.elegant-template h2::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 30px;
    height: 1px;
    background: #9a6a43;
}
.elegant-template .skill-pill {
    background: #f2e6d9;
    color: #7a5230;
}

/* 9. BOLD TEMPLATE */
.bold-template {
    background: #fdf2f8;
}
.bold-template h1 {
    font-size: 48px;
    font-weight: 900;
    color: #c2185b;
}
.bold-template h2 {
    color: #c2185b;
    border-bottom: 4px solid #c2185b;
}
.bold-template .skill-pill {
    background: #c2185b;
    color: white;
    font-weight: 700;
}

/* 10. TIMELINE TEMPLATE */
.timeline-template {
    background: #eef2ff;
}
.timeline-template h2 {
    color: #4f46e5;
    border-bottom: 2px solid #4f46e5;
}
.timeline-template .exp-entry, .timeline-template .edu-entry {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid #c7d2fe;
    border-bottom: none;
}
.timeline-template .exp-entry::before, .timeline-template .edu-entry::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 5px;
    width: 8px;
    height: 8px;
    background: #4f46e5;
    border-radius: 50%;
}
.timeline-template .skill-pill {
    background: #e0e7ff;
    color: #3730a3;
}

/* 11. NORDIC TEMPLATE */
.nordic-template {
    background: #ffffff;
}
.nordic-template * {
    font-weight: 300;
}
.nordic-template h1, .nordic-template h2, .nordic-template .exp-title {
    font-weight: 500;
    letter-spacing: 1px;
}
.nordic-template h2 {
    color: #64748b;
    border-bottom: 1px solid #cbd5e1;
}
.nordic-template .skill-pill {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
}

/* 12. INFOGRAPHIC TEMPLATE */
.infographic-template {
    background: #ecfeff;
}
.infographic-template h2 {
    color: #0891b2;
    border-bottom: none;
    display: inline-block;
    background: #cffafe;
    padding: 6px 16px;
    border-radius: 20px;
}
.infographic-template .skill-pill {
    background: #0891b2;
    color: white;
    width: 100%;
    margin-bottom: 4px;
    position: relative;
}
.infographic-template .skill-pill::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 80%; height: 3px; background: rgba(255,255,255,0.5);
}

/* 13. SPLIT TEMPLATE */
.split-template {
    background: #f8fafc;
}
.split-template h2 {
    color: #1e3a5f;
    border-bottom: 2px solid #1e3a5f;
}
.split-template .resume-section:nth-child(odd) {
    background: #f1f5f9;
    margin: 0 -40px;
    padding: 20px 40px;
}
.split-template .resume-section:nth-child(even) {
    background: #ffffff;
    margin: 0 -40px;
    padding: 20px 40px;
}
.split-template .skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

/* 14. COMPACT TEMPLATE */
.compact-template {
    padding: 20px;
}
.compact-template h1 { font-size: 24px; }
.compact-template h2 {
    font-size: 13px;
    color: #115e59;
    border-bottom: 1px solid #115e59;
    margin-bottom: 6px;
    padding-bottom: 2px;
}
.compact-template .exp-entry, .compact-template .edu-entry {
    margin-bottom: 6px;
    padding-bottom: 6px;
}
.compact-template .exp-desc { margin-top: 2px; font-size: 11px; }
.compact-template .skills-grid { display: block; }
.compact-template .skill-pill {
    display: inline; background: none; padding: 0; font-size: 11px;
}
.compact-template .skill-pill:not(:last-child)::after { content: ', '; }

/* 15. GRADIENT TEMPLATE */
.gradient-template .resume-header {
    background: linear-gradient(135deg, #2563eb, #f97316);
    margin: -40px -40px 20px -40px;
    padding: 40px;
    color: white;
}
.gradient-template .resume-header h1,
.gradient-template .contact-info,
.gradient-template .contact-info span::before {
    color: white;
}
.gradient-template #profilePreview {
    border-color: white;
}
.gradient-template h2 {
    color: #2563eb;
    border-bottom: 2px solid #f97316;
}

/* ==========================================================================
   15. MOBILE BOTTOM BAR
   ========================================================================== */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    border-top: 1px solid rgba(15,23,42,0.1);
    padding: 12px 16px;
    z-index: 99;
}
.bottom-bar-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

/* ==========================================================================
   16. TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease forwards;
    border-left: 4px solid var(--primary);
    font-size: 14px;
    font-weight: 500;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }
.toast.warning { border-left-color: var(--warning); }
.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

/* ==========================================================================
   17. MODAL
   ========================================================================== */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: var(--transition-fast);
}
.modal.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-content {
    background: white;
    padding: 24px;
    border-radius: 14px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    transform: scale(1);
    transition: transform 0.2s ease;
}
.modal.hidden .modal-content {
    transform: scale(0.9);
}
.modal-content h3 { margin-bottom: 10px; }
.modal-content p { color: var(--muted); margin-bottom: 20px; font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.btn-cancel, .btn-delete {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.btn-cancel { background: #e2e8f0; color: #0f172a; }
.btn-delete { background: var(--danger); color: white; }

/* ==========================================================================
   18. LOADING SPINNER
   ========================================================================== */
.loading-spinner {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
.loading-spinner.hidden { display: none; }
.spinner-circle {
    width: 40px; height: 40px;
    border: 4px solid rgba(15,98,254,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}
.loading-spinner span {
    font-weight: 600; color: var(--text);
}

/* ==========================================================================
   19. FORM VALIDATION ERRORS
   ========================================================================== */
input.error, textarea.error {
    border-color: var(--danger);
    animation: shake 0.4s ease;
}
.error-message {
    color: var(--danger);
    font-size: 11px;
    margin-top: 4px;
    display: block;
}
.required-asterisk {
    color: var(--danger);
    margin-left: 2px;
    animation: pulse 2s infinite;
}

/* ==========================================================================
   20. SAVE INDICATOR
   ========================================================================== */
.save-indicator {
    position: fixed;
    top: 80px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 101;
    box-shadow: var(--shadow-sm);
    animation: slideInRight 0.3s ease forwards;
}

/* ==========================================================================
   21. BACK TO TOP
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    font-size: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 90;
    transition: var(--transition-fast);
}
.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.back-to-top.visible { display: flex; }

/* ==========================================================================
   22. RIPPLE EFFECT
   ========================================================================== */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

/* ==========================================================================
   23. PDF EXPORT
   ========================================================================== */
.resume-preview.exporting {
    width: 210mm !important;
    min-height: 297mm !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 20mm !important;
    overflow: visible !important;
}

/* ==========================================================================
   24. PRINT CSS
   ========================================================================== */
@media print {
    body { background: white; }
    .topbar, .sidebar, .mobile-bottom-bar, .score-box, .ats-checker, .toast-container, .modal, .loading-spinner, .back-to-top { display: none !important; }
    .builder-container { display: block; height: auto; margin: 0; padding: 0; }
    .preview { padding: 0; overflow: visible; }
    .resume-preview {
        box-shadow: none;
        border: none;
        margin: 0;
        width: 100%;
        min-height: auto;
    }
}

/* ==========================================================================
   25. MOBILE RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
    .topbar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }
    .mobile-menu-toggle { display: flex; align-items: center; justify-content: center; }
    .top-actions {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }
    .top-actions.open { display: flex; }
    .template-scroll {
        flex-wrap: wrap;
        overflow: visible;
        width: 100%;
        max-width: none;
        justify-content: center;
    }
    .builder-container {
        display: block;
        height: auto;
        overflow: visible;
        margin-top: 80px;
        padding: 12px;
        margin-bottom: 70px;
    }
    .sidebar, .preview {
        display: block;
        overflow: visible;
        padding: 0;
    }
    .mobile-bottom-bar { display: flex; }
    .resume-preview {
        width: 100% !important;
        min-height: auto;
        padding: 20px;
    }
    .resume-preview h1 { font-size: 26px !important; }
    #profilePreview { width: 80px; height: 80px; }
    .resume-header { flex-direction: column; align-items: center; text-align: center; }
    .contact-info { justify-content: center; }
}

@media (max-width: 480px) {
    .builder-container { padding: 8px; margin-top: 80px; }
    .section-box { padding: 10px; }
    .resume-preview { padding: 16px; }
    .resume-preview h1 { font-size: 22px !important; }
    .form-row { grid-template-columns: 1fr; }
    .skill-pill, .tag { font-size: 11px; padding: 4px 8px; }
}

/* ==========================================================================
   26. ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}
@keyframes tagPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}
