/* ==========================================================================
   1. GLOBAL VARIABLES & LIGHT/DARK SYSTEM
   ========================================================================== */
:root {
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --accent: #7c4dff;
    --accent-hover: #673ab7;
    --success: #10b981;
    --danger: #ef4444;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Resume Engine Variables */
    --theme-primary: #7c4dff;
    --theme-accent-light: rgba(124, 77, 255, 0.08);
}

/* Specific root overrides for light mode */
:root[data-theme="light"], html[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
}

/* Specific root overrides for dark mode */
:root[data-theme="dark"], html[data-theme="dark"] {
    --bg-primary: #0b0f19;
    --bg-card: #151f32;
    --border-color: #1e293b;
    --text-primary: #f1f5f9;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.5);
}

/* Base Resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utility Components & Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--bg-primary);
    transform: translateY(-1px);
}
.btn-secondary-outline {
    background: transparent;
    border: 2px dashed var(--border-color);
    color: var(--text-primary);
}
.btn-secondary-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}
.btn-danger-outline:hover {
    background: var(--danger);
    color: #ffffff;
}
.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}
.btn-full {
    width: 100%;
}
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}
.icon-btn:hover {
    background: var(--border-color);
}

/* ==========================================================================
   2. HEADER & NAVIGATION
   ========================================================================== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
}
.header-container {
    max-width: 1440px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--text-primary);
    text-decoration: none;
}
.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}
.nav-links a:hover {
    color: var(--accent);
}
.nav-btn-highlight {
    background: rgba(124, 77, 255, 0.1);
    color: var(--accent) !important;
    padding: 6px 14px;
    border-radius: 50px;
    font-weight: 600 !important;
}
.nav-btn-highlight:hover {
    background: var(--accent);
    color: #ffffff !important;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   3. HERO SECTION (SaaS LOOK)
   ========================================================================== */
.hero-section {
    position: relative;
    padding: 160px 24px 100px;
    text-align: center;
    background: radial-gradient(circle at 50% 120%, rgba(124, 77, 255, 0.08), transparent 60%);
    overflow: hidden;
}
.hero-bg-gradients {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
.gradient-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.25;
}
.gs-1 {
    width: 400px;
    height: 400px;
    background: #7c4dff;
    top: -100px;
    left: 10%;
}
.gs-2 {
    width: 500px;
    height: 500px;
    background: #00e5ff;
    bottom: -150px;
    right: 15%;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(124, 77, 255, 0.1);
    border: 1px solid rgba(124, 77, 255, 0.2);
    color: #7c4dff;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 24px;
}
.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 850;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    max-width: 900px;
    margin: 0 auto 20px;
}
.hero-subtitle {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto 36px;
}
.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ==========================================================================
   4. TEMPLATES SECTION (temp.jpg Image Rendering Rules) [2]
   ========================================================================== */
.templates-section {
    max-width: 1440px;
    margin: 0 auto;
    padding: 80px 24px;
}
.section-header {
    text-align: center;
    margin-bottom: 48px;
}
.section-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}
.section-subtitle {
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}
.template-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(124, 77, 255, 0.2);
}
.template-visual-wrapper {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    aspect-ratio: 1/1.3;
    overflow: hidden;
    position: relative;
    margin-bottom: 14px;
    border: 1px solid var(--border-color);
}
.template-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}
.template-card:hover .template-img {
    transform: scale(1.04);
}
.template-info h4 {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}
.template-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================================================
   5. ABOUT US PAGE SECTION
   ========================================================================== */
.about-section {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 100px 24px;
    transition: var(--transition);
}
.about-container {
    max-width: 1200px;
    margin: 0 auto;
}
.section-tag {
    display: inline-block;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.about-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 50px;
}
.about-feature-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px;
    transition: var(--transition);
}
.about-feature-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}
.feature-icon {
    width: 50px;
    height: 50px;
    background: rgba(124, 77, 255, 0.1);
    color: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
}
.about-feature-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.about-feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==========================================================================
   6. CONTACT US PAGE SECTION
   ========================================================================== */
.contact-section {
    padding: 100px 24px;
    transition: var(--transition);
}
.contact-container {
    max-width: 1200px;
    margin: 0 auto;
}
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}
.contact-info h2 {
    font-size: 2.5rem;
    font-weight: 850;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}
.contact-info p {
    color: var(--text-muted);
    margin-bottom: 32px;
}
.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 20px;
}
.contact-item i {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.contact-item h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.contact-item p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.contact-form-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
}
.contact-form-wrapper .form-group {
    margin-bottom: 20px;
}
#contact-form input, #contact-form textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
#contact-toast {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}
#contact-toast.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* ==========================================================================
   7. WORKSPACE INTERFACE (STICKY FORM / ACCORDIONS)
   ========================================================================== */
.workspace-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px 100px;
}
.workspace-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.workspace-title-area h2 {
    font-size: 1.5rem;
    font-weight: 800;
}
.workspace-title-area p {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.workspace-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}
.form-control-inline {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}
.theme-picker {
    display: flex;
    gap: 8px;
}
.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}
.color-dot:hover, .color-dot.active {
    transform: scale(1.15);
    border-color: var(--text-primary);
}
.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap; /* Prevents button element clipping */
}

/* Workspace Grid Structure */
.workspace-layout {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 24px;
    align-items: start;
}

/* Sticky Input Accordion Side Panel */
.form-sidebar {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}
.accordion-item {
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}
.accordion-header {
    padding: 18px 20px;
    background: var(--bg-card);
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition);
    user-select: none;
}
.accordion-header span {
    display: flex;
    align-items: center;
    gap: 12px;
}
.accordion-header span i {
    color: var(--accent);
}
.accordion-header:hover {
    background: var(--bg-primary);
}
.accordion-header .arrow {
    transition: var(--transition);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.accordion-item.active .accordion-header {
    border-bottom: 1px solid var(--border-color);
}
.accordion-item.active .arrow {
    transform: rotate(180deg);
}
.accordion-content {
    padding: 20px;
    background: var(--bg-card);
    display: none;
}
.accordion-item.active .accordion-content {
    display: block;
}

/* Forms Elements & Styling */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.col-12 { width: 100%; }
.col-6 { width: calc(50% - 6px); }
.col-4 { width: calc(33.33% - 8px); }
.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.form-group input, .form-group textarea, .form-group select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus {
    border-color: var(--accent);
}
.image-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.file-input-hidden {
    display: none;
}
.upload-trigger-btn {
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    color: var(--text-primary);
}
.upload-trigger-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Dynamic Multi-items inside Accordions */
.nested-item-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 14px;
    position: relative;
}
.nested-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.9rem;
}

/* ==========================================================================
   8. PREMIUM LIVE PREVIEW RESUME CANVASES (A4 PROPORTIONED)
   ========================================================================== */
.preview-canvas-container {
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    padding: 0;
    width: 100%;
    overflow: hidden;
}
.preview-wrapper {
    width: 100%;
    max-width: 820px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    background: #ffffff;
    overflow-x: auto; /* Enables native horizontal scrolling on mobile */
    -webkit-overflow-scrolling: touch; /* Momentum iOS touch scroller */
    display: flex;
}

/* Centralized Resume Paper Structure */
.resume-preview-sheet {
    width: 210mm; /* Strict A4 Base Dimensions */
    min-height: 297mm;
    background: #ffffff;
    color: #1e293b;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    position: relative;
    box-shadow: none;
    line-height: 1.4;
    font-size: 13px;
    flex-shrink: 0; /* Prevents viewport structural squeezing */
}

/* Dynamic Palettes Configurations */
.theme-purple { --theme-primary: #7c4dff; --theme-accent-light: rgba(124, 77, 255, 0.08); }
.theme-blue { --theme-primary: #2563eb; --theme-accent-light: rgba(37, 99, 235, 0.08); }
.theme-dark { --theme-primary: #1f2937; --theme-accent-light: rgba(31, 41, 55, 0.08); }
.theme-green { --theme-primary: #059669; --theme-accent-light: rgba(5, 150, 105, 0.08); }
.theme-black { --theme-primary: #0f172a; --theme-accent-light: rgba(15, 23, 42, 0.08); }

/* Common template utilities and shared classes */
.cv-photo {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--theme-primary);
}
.cv-name {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.cv-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--theme-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}
.cv-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--theme-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--theme-accent-light);
    padding-bottom: 4px;
    margin-bottom: 12px;
}
.timeline-item {
    position: relative;
    padding-left: 18px;
    margin-bottom: 12px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--theme-primary);
}
.timeline-item::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 15px;
    bottom: -15px;
    width: 1px;
    background: var(--theme-accent-light);
}
.timeline-item:last-child::after {
    display: none;
}
.cv-p-small {
    font-size: 11.5px;
    color: #475569;
}
.cv-meta {
    font-weight: 500;
    color: #475569;
    font-size: 11px;
    margin-bottom: 4px;
}
.skill-bar-wrapper {
    margin-bottom: 8px;
}
.skill-bar-container {
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 3px;
}
.skill-bar-fill {
    height: 100%;
    background: var(--theme-primary);
}
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip {
    background: var(--theme-accent-light);
    color: var(--theme-primary);
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

/* ==========================================================================
   9. THE 10 INDIVIDUAL RESUME TEMPLATE LAYOUTS
   ========================================================================== */

/* 1. Professional Corporate Template */
.template-corporate {
    padding: 40px;
}
.template-corporate .cv-header {
    border-bottom: 3px solid var(--theme-primary);
    padding-bottom: 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.template-corporate .header-contacts {
    text-align: right;
}
.template-corporate .cv-body {
    display: grid;
    grid-template-columns: 7fr 4fr;
    gap: 24px;
}

/* 2. Creative Designer Template */
.template-creative {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 297mm;
}
.template-creative .sidebar {
    background: var(--theme-primary);
    color: #ffffff;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.template-creative .sidebar .cv-name {
    color: #ffffff;
}
.template-creative .sidebar .cv-title {
    color: rgba(255, 255, 255, 0.85);
}
.template-creative .sidebar .cv-section-title {
    color: #ffffff;
    border-bottom: 1.5px solid rgba(255,255,255,0.3);
}
.template-creative .sidebar .cv-p-small {
    color: rgba(255,255,255,0.8);
}
.template-creative .main-content {
    padding: 35px 30px;
}

/* 3. ATS-Friendly Minimal Template */
.template-ats {
    padding: 40px;
    font-family: Arial, sans-serif;
    color: #000000;
}
.template-ats .cv-name {
    font-size: 24px;
    color: #000000;
    text-align: center;
}
.template-ats .cv-title {
    color: #333333;
    text-align: center;
}
.template-ats .contact-line {
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 11px;
    border-bottom: 1px solid #000000;
    padding-bottom: 8px;
    margin-bottom: 20px;
}
.template-ats .cv-section-title {
    color: #000000;
    border-bottom: 1px solid #000000;
    font-size: 12px;
}
.template-ats .timeline-item::before {
    background: #000000;
}

/* 4. Modern Sidebar Template */
.template-modern-sidebar {
    display: grid;
    grid-template-columns: 1fr 240px;
    min-height: 297mm;
}
.template-modern-sidebar .main-content {
    padding: 35px 30px;
}
.template-modern-sidebar .sidebar {
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    padding: 35px 20px;
}

/* 5. Dark Elegant Template */
.template-dark-elegant {
    background: #111827;
    color: #e5e7eb;
    padding: 40px;
    min-height: 297mm;
}
.template-dark-elegant .cv-name {
    color: #ffffff;
}
.template-dark-elegant .cv-section-title {
    color: var(--theme-primary);
    border-bottom-color: rgba(255,255,255,0.1);
}
.template-dark-elegant .cv-p-small {
    color: #9ca3af;
}

/* 6. Infographic CV Template */
.template-infographic {
    padding: 35px;
}
.template-infographic .header-panel {
    background: var(--theme-accent-light);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
}
.template-infographic .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* 7. Minimalist Clean Template */
.template-minimalist {
    padding: 45px;
    font-family: 'Playfair Display', serif;
}
.template-minimalist .cv-name {
    font-family: 'Playfair Display', serif;
    font-size: 30px;
}
.template-minimalist .cv-section-title {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    text-transform: capitalize;
    border: none;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

/* 8. Executive Prestige Template */
.template-executive {
    padding: 40px;
}
.template-executive .header-top {
    text-align: center;
    border-bottom: 1px double var(--theme-primary);
    padding-bottom: 14px;
    margin-bottom: 20px;
}
.template-executive .cv-section-title {
    border-bottom: 2px double var(--theme-primary);
}

/* 9. Technical Engineer Template */
.template-technical {
    padding: 35px;
}
.template-technical .header-grid {
    display: grid;
    grid-template-columns: 8fr 4fr;
    margin-bottom: 24px;
    align-items: end;
}
.template-technical .cv-section-title {
    border-left: 4px solid var(--theme-primary);
    padding-left: 8px;
    border-bottom: none;
}

/* 10. Academic CV Template */
.template-academic {
    padding: 45px;
    line-height: 1.6;
}
.template-academic .cv-section-title {
    border-bottom: 1.5px solid #000000;
}

/* ==========================================================================
   10. GLOBAL FOOTER
   ========================================================================== */
.app-footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 60px 24px 30px;
    border-top: 1px solid #1e293b;
    margin-top: 80px;
}
.footer-top {
    max-width: 1440px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 40px;
}
.footer-brand .logo {
    color: #ffffff;
    margin-bottom: 16px;
}
.footer-desc {
    font-size: 0.9rem;
    max-width: 320px;
}
.footer-links-group h4 {
    color: #ffffff;
    font-size: 0.95rem;
    margin-bottom: 16px;
}
.footer-links-group a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 8px;
    transition: var(--transition);
}
.footer-links-group a:hover {
    color: var(--accent);
}
.footer-bottom {
    max-width: 1440px;
    margin: 0 auto;
    padding-top: 24px;
    border-top: 1px solid #1e293b;
    text-align: center;
    font-size: 0.8rem;
}

/* ==========================================================================
   11. MOBILE RESPONSIVENESS (Optimized Button Scaling & Vertical Stack)
   ========================================================================== */
@media (max-width: 1024px) {
    .workspace-layout {
        grid-template-columns: 1fr;
    }
    .form-sidebar {
        position: static;
        max-height: none;
    }
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 768px) {
    /* Compact dynamic scaling for buttons on mobile screens */
    .btn {
        padding: 8px 16px;
        font-size: 0.82rem;
        gap: 6px;
        white-space: normal; /* Allows text to wrap within small button boundaries */
        text-align: center;
    }
    .btn-lg {
        padding: 10px 20px;
        font-size: 0.88rem;
        border-radius: var(--radius-sm);
    }
    .hero-actions {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        gap: 12px;
    }
    .hero-actions .btn {
        width: 100%;
    }
    .workspace-header {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }
    .workspace-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        width: 100%;
    }
    /* Toolbar button layout grid for neat vertical stacking */
    .toolbar-actions {
        display: flex;
        flex-direction: column; /* Force vertical stacking on narrow devices */
        gap: 10px;
        width: 100%;
    }
    .toolbar-actions .btn {
        width: 100%; /* Take full available width */
        justify-content: center;
        padding: 12px 16px; /* Finger-friendly click target height */
        font-size: 0.9rem;
    }
    .nav-links {
        display: none;
    }
    .footer-top {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ==========================================================================
   12. PRINT & PDF OPTIMIZED MEDIA QUERIES
   ========================================================================== */
@media print {
    body, html {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .no-print {
        display: none !important;
    }
    .workspace-container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }
    .workspace-layout {
        display: block !important;
    }
    .preview-canvas-container {
        padding: 0 !important;
        overflow: visible !important;
    }
    .preview-wrapper {
        box-shadow: none !important;
        border-radius: 0 !important;
        max-width: none !important;
        width: 100% !important;
    }
    .resume-preview-sheet {
        box-shadow: none !important;
        margin: 0 !important;
        border: none !important;
        width: 210mm !important;
        height: 297mm !important;
        page-break-after: avoid;
        page-break-inside: avoid;
    }
}