@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,400&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ==========================================
   CSS VARIABLES & DESIGN SYSTEM (App UI)
   ========================================== */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-premium: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Paper dimensions (A4 in pixels at 96dpi) */
    --paper-width: 794px;
    --paper-height: 1123px;
}

/* ==========================================
   BASE & RESET
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================
   APP HEADER
   ========================================== */
.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e3a8a, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.app-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-danger-outline {
    background-color: transparent;
    color: var(--danger);
    border-color: #fca5a5;
}

.btn-danger-outline:hover {
    background-color: #fef2f2;
    border-color: var(--danger);
}

.template-selector {
    display: flex;
    background-color: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    background-color: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   APP WORKSPACE LAYOUT
   ========================================== */
.app-container {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    flex: 1;
    height: calc(100vh - 65px);
    overflow: hidden;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
}

/* ==========================================
   EDITOR SIDEBAR (LEFT)
   ========================================== */
.editor-sidebar {
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.section-card:focus-within, .section-card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-md);
}

.section-header {
    padding: 1.25rem 1.5rem;
    background-color: #fafbfd;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.section-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
}

.section-header-title svg {
    color: var(--primary);
    width: 1.25rem;
    height: 1.25rem;
}

.section-toggle-icon {
    transition: var(--transition);
    color: var(--text-muted);
}

.section-card.collapsed .section-toggle-icon {
    transform: rotate(-90deg);
}

.section-card.collapsed .section-content {
    display: none;
}

.section-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Dynamic list groups (Experience, Education, Projects) */
.list-items-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dynamic-item {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    background-color: #f8fafc;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
}

.dynamic-item:hover {
    border-color: var(--primary-border);
    background-color: #f0f7ff;
}

.remove-item-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 1.75rem;
    height: 1.75rem;
    background-color: #fee2e2;
    border: none;
    border-radius: 50%;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.remove-item-btn:hover {
    background-color: var(--danger);
    color: white;
    transform: scale(1.05);
}

.add-btn {
    align-self: flex-start;
    background-color: var(--primary-light);
    color: var(--primary);
    border: 1.5px dashed var(--primary-border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.add-btn:hover {
    background-color: #dbeafe;
    border-color: var(--primary);
}

/* Form Controls */
.form-group-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-group-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group.full-width {
    grid-column: span 2;
}

@media (max-width: 640px) {
    .form-group.full-width {
        grid-column: span 1;
    }
}

label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-main);
    background-color: white;
    outline: none;
    transition: var(--transition);
}

input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

/* Skills input tag block */
.tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #fafbfd;
    min-height: 42px;
}

.tag {
    background-color: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.tag-remove {
    cursor: pointer;
    font-weight: bold;
    color: #3b82f6;
    transition: var(--transition);
}

.tag-remove:hover {
    color: var(--danger);
}

.skill-input-container {
    display: flex;
    gap: 0.5rem;
}

/* ==========================================
   PREVIEW SIDEBAR (RIGHT)
   ========================================== */
.preview-sidebar {
    background-color: #cbd5e1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2.5rem;
    position: relative;
    box-shadow: inset 1px 0 6px rgba(0,0,0,0.05);
}

@media (max-width: 1024px) {
    .preview-sidebar {
        padding: 1.5rem;
        overflow-y: visible;
        min-height: auto;
    }
}

/* Resume Paper Sheet Layout */
.resume-paper {
    width: var(--paper-width);
    min-height: var(--paper-height);
    background-color: white;
    box-shadow: var(--shadow-premium);
    padding: 40px;
    box-sizing: border-box;
    position: relative;
    transform-origin: top center;
    transition: var(--transition);
    /* Standard typography fallback for A4 printing */
    font-size: 14px;
    line-height: 1.5;
}

/* Dynamic Scaling to fit the viewport width nicely */
@media (min-width: 1025px) and (max-width: 1399px) {
    .resume-paper {
        transform: scale(0.8);
        margin-bottom: calc(var(--paper-height) * -0.2);
    }
}
@media (max-width: 1024px) {
    .resume-paper {
        width: 100%;
        min-height: auto;
        padding: 30px 20px;
    }
}

/* ==========================================
   RESUME TEMPLATE 1: PLAIN (B&W Classic)
   ========================================== */
.resume-paper.template-plain {
    font-family: 'Merriweather', 'Georgia', serif;
    color: #111111;
    background-color: #ffffff;
    line-height: 1.45;
}

.template-plain .resume-header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #000000;
    padding-bottom: 15px;
}

.template-plain .resume-name {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.template-plain .resume-title {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #444444;
    margin-bottom: 8px;
}

.template-plain .resume-contact {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    color: #444444;
}

.template-plain .resume-contact span {
    display: inline-flex;
    align-items: center;
}

.template-plain .resume-contact span:not(:last-child)::after {
    content: "•";
    margin-left: 12px;
    color: #888888;
}

.template-plain .resume-summary {
    font-size: 12px;
    margin-bottom: 22px;
    text-align: justify;
}

.template-plain .resume-section {
    margin-bottom: 22px;
}

.template-plain .resume-section-title {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #111111;
    padding-bottom: 4px;
    margin-bottom: 12px;
}

.template-plain .resume-item {
    margin-bottom: 14px;
}

.template-plain .resume-item-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 2px;
}

.template-plain .resume-item-subheader {
    display: flex;
    justify-content: space-between;
    font-style: italic;
    font-size: 11px;
    color: #444444;
    margin-bottom: 6px;
}

.template-plain .resume-item-desc {
    font-size: 11.5px;
    color: #222222;
    text-align: justify;
}

.template-plain .resume-item-desc ul {
    margin-left: 16px;
    padding-left: 0;
}

.template-plain .resume-item-desc li {
    margin-bottom: 3px;
}

.template-plain .resume-skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.template-plain .resume-skill-item {
    font-size: 11.5px;
    padding: 2px 6px;
    border: 1px solid #222222;
    border-radius: 2px;
}

.template-plain .resume-languages-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    font-size: 11.5px;
}

.template-plain .resume-language-item {
    display: flex;
    justify-content: space-between;
}

/* ==========================================
   RESUME TEMPLATE 2: ATTRACTIVE (Modern Color)
   ========================================== */
.resume-paper.template-attractive {
    /* Default theme (Blue) custom properties */
    --theme-primary: #1e3a8a;
    --theme-accent: #2563eb;
    --theme-light: #f0f7ff;
    --theme-text-light: #93c5fd;
    --theme-text-light-hover: #bfdbfe;
    
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    background-color: #ffffff;
    display: flex;
    padding: 0; /* Let column layouts fill borders */
    overflow: hidden;
}

/* Accent Color Themes */
.resume-paper.template-attractive.theme-blue {
    --theme-primary: #1e3a8a;
    --theme-accent: #2563eb;
    --theme-light: #f0f7ff;
    --theme-text-light: #93c5fd;
    --theme-text-light-hover: #bfdbfe;
}

.resume-paper.template-attractive.theme-emerald {
    --theme-primary: #064e3b;
    --theme-accent: #10b981;
    --theme-light: #ecfdf5;
    --theme-text-light: #a7f3d0;
    --theme-text-light-hover: #d1fae5;
}

.resume-paper.template-attractive.theme-purple {
    --theme-primary: #4c1d95;
    --theme-accent: #8b5cf6;
    --theme-light: #f5f3ff;
    --theme-text-light: #ddd6fe;
    --theme-text-light-hover: #ede9fe;
}

.resume-paper.template-attractive.theme-crimson {
    --theme-primary: #881337;
    --theme-accent: #f43f5e;
    --theme-light: #fff1f2;
    --theme-text-light: #fecdd3;
    --theme-text-light-hover: #ffe4e6;
}

.resume-paper.template-attractive.theme-charcoal {
    --theme-primary: #1e293b;
    --theme-accent: #475569;
    --theme-light: #f8fafc;
    --theme-text-light: #cbd5e1;
    --theme-text-light-hover: #e2e8f0;
}

/* Left Sidebar - Color */
.template-attractive .resume-side-col {
    width: 32%;
    background-color: var(--theme-primary);
    color: #ffffff;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: var(--transition);
}

/* Right Main Col */
.template-attractive .resume-main-col {
    width: 68%;
    padding: 35px 30px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* Sidebar Sections */
.template-attractive .side-section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 6px;
    margin-bottom: 12px;
    color: var(--theme-text-light);
}

/* Contact List Sidebar */
.template-attractive .side-contact-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 11px;
    word-break: break-all;
}

.template-attractive .side-contact-list a {
    color: inherit;
    text-decoration: none;
}

.template-attractive .side-contact-list a:hover {
    text-decoration: underline !important;
}

.template-attractive .side-contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-attractive .side-contact-item svg {
    width: 14px;
    height: 14px;
    color: var(--theme-text-light);
    flex-shrink: 0;
}

/* Education Sidebar */
.template-attractive .side-edu-item {
    margin-bottom: 12px;
    font-size: 11px;
}

.template-attractive .side-edu-school {
    font-weight: 700;
    color: #ffffff;
}

.template-attractive .side-edu-degree {
    font-style: italic;
    color: var(--theme-text-light-hover);
    margin: 2px 0;
}

.template-attractive .side-edu-date {
    color: var(--theme-text-light);
    font-size: 10px;
}

/* Skills Badges Sidebar */
.template-attractive .side-skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.template-attractive .side-skill-badge {
    background-color: rgba(255,255,255,0.12);
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Languages Sidebar */
.template-attractive .side-lang-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
}

.template-attractive .side-lang-item {
    display: flex;
    justify-content: space-between;
    color: #e2e8f0;
}

.template-attractive .side-lang-level {
    color: var(--theme-text-light);
    font-weight: 600;
}

/* Main Area Header */
.template-attractive .main-header {
    margin-bottom: 5px;
}

.template-attractive .resume-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--theme-primary);
    letter-spacing: -0.5px;
    margin-bottom: 2px;
    transition: var(--transition);
}

.template-attractive .resume-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--theme-accent);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: var(--transition);
}

.template-attractive .resume-summary {
    font-size: 11.5px;
    line-height: 1.6;
    color: #475569;
    text-align: justify;
    background-color: var(--theme-light);
    padding: 12px 16px;
    border-left: 4px solid var(--theme-accent);
    border-radius: 0 6px 6px 0;
    transition: var(--transition);
}

/* Main Section Blocks */
.template-attractive .main-section-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--theme-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2px solid var(--theme-light);
    padding-bottom: 6px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.template-attractive .main-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: #e2e8f0;
}

.template-attractive .main-item {
    margin-bottom: 12px;
}

.template-attractive .main-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
}

.template-attractive .main-item-company {
    color: var(--theme-accent);
    transition: var(--transition);
}

.template-attractive .main-item-subheader {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    color: #64748b;
    margin-top: 2px;
    margin-bottom: 5px;
}

.template-attractive .main-item-desc {
    font-size: 11px;
    line-height: 1.5;
    color: #334155;
    text-align: justify;
}

.template-attractive .main-item-desc ul {
    margin-left: 14px;
    padding-left: 0;
}

.template-attractive .main-item-desc li {
    margin-bottom: 2px;
}

/* ==========================================
   PRINT MEDIA STYLES
   ========================================== */
@media print {
    /* Hide all browser-specific headers/footers when saving as PDF */
    @page {
        size: A4 portrait;
        margin: 0;
    }
    
    /* Hide everything on screen */
    body, html {
        background-color: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .app-header, 
    .editor-sidebar,
    .preview-sidebar::before {
        display: none !important;
    }
    
    .app-container {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .preview-sidebar {
        display: block !important;
        padding: 0 !important;
        background-color: #ffffff !important;
        overflow: visible !important;
        width: 100% !important;
        height: auto !important;
    }

    .resume-paper {
        transform: none !important;
        margin: 0 !important;
        box-shadow: none !important;
        width: 100% !important;
        /* Force absolute A4 dimensions */
        width: 210mm !important;
        min-height: 297mm !important;
        padding: 15mm !important;
        box-sizing: border-box !important;
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    .resume-paper.template-attractive {
        padding: 0 !important;
        min-height: 297mm !important;
        height: 297mm !important;
    }

    .template-attractive .resume-side-col {
        padding: 15mm 8mm !important;
        min-height: 297mm !important;
    }

    .template-attractive .resume-main-col {
        padding: 15mm 10mm !important;
        min-height: 297mm !important;
    }

    /* Print-specific layout protection */
    .resume-item, .side-edu-item, .resume-section {
        page-break-inside: avoid !important;
    }

    /* Keep styling colors accurate when printing */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ==========================================
   EXTRA UTILITY STYLES (Color Themes & Links)
   ========================================== */
.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1.5px #cbd5e1;
    transition: var(--transition);
}

.color-dot:hover {
    transform: scale(1.15);
}

.color-dot.active[data-color="blue"] { box-shadow: 0 0 0 2px #2563eb; }
.color-dot.active[data-color="emerald"] { box-shadow: 0 0 0 2px #10b981; }
.color-dot.active[data-color="purple"] { box-shadow: 0 0 0 2px #8b5cf6; }
.color-dot.active[data-color="crimson"] { box-shadow: 0 0 0 2px #f43f5e; }
.color-dot.active[data-color="charcoal"] { box-shadow: 0 0 0 2px #475569; }

.template-plain .resume-contact a {
    color: inherit;
    text-decoration: none;
}
.template-plain .resume-contact a:hover {
    text-decoration: underline !important;
}

/* ==========================================
   PROFILE PHOTO UPLOAD WIDGET
   ========================================== */
.photo-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    background-color: #fafbfd;
    transition: var(--transition);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.photo-upload-area:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.photo-upload-area.drag-active {
    border-color: var(--primary);
    background-color: #dbeafe;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    color: var(--text-muted);
}

.photo-placeholder svg {
    color: #93c5fd;
    opacity: 0.8;
}

.photo-placeholder p {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

.photo-placeholder span {
    font-size: 0.75rem;
    color: #94a3b8;
}

.photo-preview-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.photo-preview-container img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    border: 3px solid white;
}

.photo-remove-btn {
    position: absolute;
    top: -6px;
    right: calc(50% - 65px);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--danger);
    border: none;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: var(--transition);
    z-index: 10;
}

.photo-remove-btn:hover {
    transform: scale(1.15);
    background-color: #dc2626;
}

/* ==========================================
   PROFILE PHOTO IN RESUME TEMPLATES
   ========================================== */

/* PLAIN template: photo in header top-right */
.template-plain .resume-header-with-photo {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 25px;
    border-bottom: 2px solid #000000;
    padding-bottom: 15px;
}

.template-plain .resume-header-with-photo .resume-header-info {
    flex: 1;
    text-align: left;
}

.template-plain .resume-header-with-photo .resume-contact {
    justify-content: flex-start;
}

.template-plain .resume-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #111111;
}

.template-plain .resume-photo.shape-circle {
    border-radius: 50%;
}

.template-plain .resume-photo.shape-rounded {
    border-radius: 10px;
}

.template-plain .resume-photo.shape-square {
    border-radius: 0;
}

/* ATTRACTIVE template: photo in sidebar top */
.template-attractive .side-photo-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-bottom: 4px;
}

.template-attractive .side-photo {
    width: 90px;
    height: 90px;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.template-attractive .side-photo.shape-circle {
    border-radius: 50%;
}

.template-attractive .side-photo.shape-rounded {
    border-radius: 12px;
}

.template-attractive .side-photo.shape-square {
    border-radius: 4px;
}

/* ==========================================
   TEMPLATE PICKER BUTTON (Header)
   ========================================== */
.btn-template-trigger {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: white;
    border: none;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: var(--transition);
}

.btn-template-trigger:hover {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.template-badge-pill {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 1px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ==========================================
   TEMPLATE PICKER MODAL
   ========================================== */
.tpl-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.tpl-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.tpl-modal-box {
    background: #ffffff;
    border-radius: 20px;
    width: 92%;
    max-width: 900px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.25);
    transform: translateY(24px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 2rem;
}

.tpl-modal-overlay.visible .tpl-modal-box {
    transform: translateY(0) scale(1);
}

.tpl-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

.tpl-modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.tpl-modal-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.3rem;
}

.tpl-modal-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    flex-shrink: 0;
    transition: var(--transition);
}

.tpl-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: scale(1.08);
}

/* Template card grid */
.template-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 1.25rem;
}

.tpl-card {
    border-radius: 14px;
    border: 2.5px solid #e2e8f0;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
}

.tpl-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
    transform: translateY(-3px);
}

.tpl-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 8px 24px rgba(37, 99, 235, 0.15);
}

/* Mini preview area */
.tpl-mini {
    height: 150px;
    overflow: hidden;
    position: relative;
}

/* Card footer */
.tpl-card-footer {
    padding: 0.75rem 0.9rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: #fafbfd;
}

.tpl-card-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: #0f172a;
    display: block;
}

.tpl-card-tag {
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 20px;
    padding: 1px 8px;
    display: inline-block;
    margin-top: 2px;
}

.tag-colored { background: #dbeafe; color: #1d4ed8; }
.tag-bw { background: #f1f5f9; color: #475569; }

/* Subtle badges */
.tpl-popular-badge { font-size: 0.68rem; color: #f59e0b; font-weight: 700; }
.tpl-ats-badge     { font-size: 0.68rem; color: #10b981; font-weight: 700; }
.tpl-pro-badge     { font-size: 0.68rem; color: #6366f1; font-weight: 700; }
.tpl-clean-badge   { font-size: 0.68rem; color: #64748b; font-weight: 700; }
.tpl-bold-badge    { font-size: 0.68rem; color: #ec4899; font-weight: 700; }

/* ==========================================
   EXECUTIVE TEMPLATE
   ========================================== */
.template-executive {
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    background: #fff;
    font-size: 11px;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.exec-header {
    background: #0f172a;
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.exec-header-text { flex: 1; }

.exec-name {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin: 0 0 4px;
}

.exec-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--theme-accent, #60a5fa);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.exec-contact-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 10px;
    color: rgba(255,255,255,0.65);
}

.exec-contact-row a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: color 0.2s;
}
.exec-contact-row a:hover { color: #fff; }

.exec-contact-row span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.exec-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.exec-photo.shape-circle  { border-radius: 50%; }
.exec-photo.shape-rounded { border-radius: 10px; }
.exec-photo.shape-square  { border-radius: 3px; }

.exec-body {
    flex: 1;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.exec-section {
    margin-bottom: 18px;
}

.exec-section-title {
    font-size: 10.5px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding-left: 10px;
    border-left: 3px solid var(--theme-accent, #2563eb);
    margin-bottom: 6px;
}

.exec-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0 0 10px;
}

.exec-item {
    margin-bottom: 10px;
}

.exec-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.exec-item-role {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
}

.exec-item-company {
    font-size: 10.5px;
    color: #475569;
    font-weight: 500;
}

.exec-item-date {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
}

.exec-item-desc {
    font-size: 10.5px;
    color: #475569;
    line-height: 1.55;
    margin-top: 3px;
}

.exec-item-desc ul {
    padding-left: 14px;
    margin: 2px 0;
}

.exec-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.exec-skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.exec-skill-tag {
    background: #f0f7ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 9.5px;
    font-weight: 500;
}

/* Theme overrides for executive */
.resume-paper.theme-blue     { --theme-accent: #2563eb; }
.resume-paper.theme-emerald  { --theme-accent: #10b981; }
.resume-paper.theme-purple   { --theme-accent: #8b5cf6; }
.resume-paper.theme-crimson  { --theme-accent: #f43f5e; }
.resume-paper.theme-charcoal { --theme-accent: #64748b; }

/* ==========================================
   MINIMAL TEMPLATE
   ========================================== */
.template-minimal {
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    background: #fff;
    font-size: 11px;
    padding: 35px 40px;
    display: flex;
    flex-direction: column;
}

.minimal-header {
    text-align: center;
    margin-bottom: 20px;
}

.minimal-name {
    font-size: 28px;
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #0f172a;
    margin: 0 0 6px;
}

.minimal-title {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 12px;
}

.minimal-contact-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 12px;
    font-size: 10px;
    color: #64748b;
    margin-bottom: 16px;
}

.minimal-contact-row a {
    color: inherit;
    text-decoration: none;
}
.minimal-contact-row a:hover { color: #0f172a; text-decoration: underline; }

.minimal-contact-sep {
    color: #cbd5e1;
}

.minimal-hr {
    height: 0.5px;
    background: #94a3b8;
    border: none;
    margin: 0 0 18px;
}

.minimal-section { margin-bottom: 16px; }

.minimal-section-title {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 0.5px solid #e2e8f0;
}

.minimal-item {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 0 16px;
    margin-bottom: 10px;
}

.minimal-item-date {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
    line-height: 1.5;
    padding-top: 1px;
}

.minimal-item-content {}

.minimal-item-title {
    font-size: 11px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 1px;
}

.minimal-item-sub {
    font-size: 10.5px;
    color: #64748b;
    margin-bottom: 3px;
}

.minimal-item-desc {
    font-size: 10px;
    color: #64748b;
    line-height: 1.55;
}

.minimal-item-desc ul { padding-left: 14px; margin: 2px 0; }

.minimal-skills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.minimal-skill-tag {
    font-size: 10px;
    color: #334155;
    border: 0.5px solid #94a3b8;
    border-radius: 3px;
    padding: 2px 8px;
    font-weight: 400;
}

.minimal-inline-item {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 0.5px solid #f1f5f9;
}
.minimal-inline-item:last-child { border-bottom: none; }

/* ==========================================
   CREATIVE TEMPLATE
   ========================================== */
.template-creative {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #1e293b;
    background: #fff;
    font-size: 11px;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.creative-header {
    background: linear-gradient(135deg, var(--cr-primary, #1e3a8a) 0%, var(--cr-secondary, #4f46e5) 100%);
    padding: 26px 30px;
    display: flex;
    align-items: center;
    gap: 18px;
}

/* Theme-aware gradient colors for Creative */
.resume-paper.template-creative.theme-blue     { --cr-primary: #1e3a8a; --cr-secondary: #3b82f6; }
.resume-paper.template-creative.theme-emerald  { --cr-primary: #064e3b; --cr-secondary: #10b981; }
.resume-paper.template-creative.theme-purple   { --cr-primary: #4c1d95; --cr-secondary: #8b5cf6; }
.resume-paper.template-creative.theme-crimson  { --cr-primary: #881337; --cr-secondary: #f43f5e; }
.resume-paper.template-creative.theme-charcoal { --cr-primary: #1e293b; --cr-secondary: #475569; }

.creative-header-text { flex: 1; }

.creative-photo {
    width: 76px;
    height: 76px;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.creative-photo.shape-circle  { border-radius: 50%; }
.creative-photo.shape-rounded { border-radius: 10px; }
.creative-photo.shape-square  { border-radius: 3px; }

.creative-name {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin: 0 0 4px;
}

.creative-title {
    font-size: 11px;
    color: rgba(255,255,255,0.75);
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.creative-contact-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.creative-contact-pill {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 9.5px;
    color: rgba(255,255,255,0.85);
    display: inline-block;
}
.creative-contact-pill a {
    color: inherit;
    text-decoration: none;
}
.creative-contact-pill a:hover { color: #fff; }

.creative-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.creative-main-col {
    flex: 1.65;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-right: 1px solid #f1f5f9;
    overflow: hidden;
}

.creative-side-col {
    flex: 1;
    padding: 20px 18px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

.creative-section { margin-bottom: 16px; }

.creative-section-title {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--cr-primary, #1e3a8a);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.creative-section-title::after {
    content: '';
    flex: 1;
    height: 1.5px;
    background: linear-gradient(90deg, var(--cr-primary, #1e3a8a) 0%, transparent 100%);
    opacity: 0.2;
    border-radius: 1px;
}

.creative-item {
    margin-bottom: 10px;
    position: relative;
    padding-left: 12px;
}

.creative-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cr-primary, #1e3a8a);
    opacity: 0.5;
}

.creative-item-title {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.creative-item-meta {
    font-size: 10px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 3px;
}

.creative-item-desc {
    font-size: 10px;
    color: #475569;
    line-height: 1.55;
}
.creative-item-desc ul { padding-left: 14px; margin: 2px 0; }

.creative-skill-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.creative-skill-chip {
    background: #fff;
    border: 1.5px solid var(--cr-primary, #1e3a8a);
    color: var(--cr-primary, #1e3a8a);
    border-radius: 20px;
    padding: 2px 9px;
    font-size: 9.5px;
    font-weight: 600;
    opacity: 0.85;
}

.creative-side-contact-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
    font-size: 10px;
    color: #475569;
}
.creative-side-contact-item a {
    color: inherit;
    text-decoration: none;
}
.creative-side-contact-item a:hover { color: #0f172a; }

.creative-side-label {
    font-size: 8.5px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 1px;
}

/* Print media for Executive, Minimal, Creative */
@media print {
    .resume-paper.template-executive,
    .resume-paper.template-minimal,
    .resume-paper.template-creative {
        width: 210mm !important;
        min-height: 297mm !important;
        padding: var(--print-pad, 0) !important;
        box-shadow: none !important;
        transform: none !important;
        margin: 0 !important;
    }
    .template-executive .exec-body,
    .template-creative .creative-body {
        min-height: 240mm !important;
    }
    .template-minimal {
        padding: 15mm 20mm !important;
        min-height: 297mm !important;
    }
}
