:root {
    --primary: #cefbf8;
    --primary-dark: #a8e8e4;
    --bg-dark: #000000;
    --bg-light: #ffffff;
    --border: #e0e0e0;
    --text-main: #000000;
    --text-light: #444444;
    
    /* CV Specific */
    --cv-accent: #000000;
    --cv-text: #000000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* App Header */
.app-header {
    background: #000000;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}
.logo-container h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.btn-primary { background: var(--primary); color: #000000; }
.btn-primary:hover { background: white; color: #000000; }
.btn-outline { background: transparent; border: 1px solid #000000; color: #000000; }
.btn-outline:hover { background: var(--primary); color: #000000; border-color: var(--primary); }
.btn-outline.active { background: var(--primary); color: #000000; border-color: var(--primary); }

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Panel */
.control-panel {
    width: 350px;
    background: white;
    border-right: 1px solid var(--border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.control-panel h3 { margin-bottom: 5px; font-size: 1.1rem; color: var(--primary-dark); }
.help-text { font-size: 0.8rem; color: var(--text-light); margin-bottom: 15px; }

textarea {
    flex: 1;
    width: 100%;
    min-height: 250px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    resize: none;
    outline: none;
}
textarea:focus { border-color: var(--primary); }

.input-group { margin-bottom: 15px; }
.input-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--text-main); }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; outline: none; }
.form-control:focus { border-color: var(--primary); }

.fixed-fields {
    margin-top: 20px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.fixed-fields h4 { font-size: 0.9rem; margin-bottom: 10px; color: #475569; }

/* Right Panel Preview area */
.preview-panel {
    flex: 1;
    background: #cbd5e1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* CV Document Wrappers */
#cv-document {
    display: flex;
    flex-direction: column;
    gap: 40px;
}
.layout-landscape #cv-document {
    gap: 50px;
}

/* Individual A4 Pages */
.cv-page {
    background-color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
    width: 210mm;
    height: 297mm; /* Fixed A4 height - no overflow */
    font-family: 'Inter', sans-serif;
    color: #000000;
    font-size: 0.88rem;
}
}

.cv-page-ar {
    font-family: 'Cairo', sans-serif;
}

/* The content wrapper provides padding to avoid the letterhead graphics */
.cv-content-wrapper {
    padding: 10mm 15mm 25mm 15mm; /* Aggressively reduced bottom padding to fill page */
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* CV Layouts Base */
.cv-body {
    display: grid;
    gap: 20px;
    margin-top: 10px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.cv-col-main { display: flex; flex-direction: column; gap: 30px; }
.cv-col-side { display: flex; flex-direction: column; gap: 30px; }

/* 1. Executive (Two Column) */
.layout-executive .cv-body {
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}
.layout-executive .section-title {
    border-bottom: 2px solid #000000;
}

/* 2. Corporate (Single Column) */
.layout-corporate .cv-body {
    grid-template-columns: 1fr;
    gap: 20px;
}
.layout-corporate .cv-header {
    border-bottom: 3px solid #000000;
}

/* 3. Minimal (No Lines) */
.layout-minimal .cv-header, .layout-minimal .section-title {
    border: none;
}
.layout-minimal .cv-body {
    grid-template-columns: 1fr;
}

/* 4. Sidebar Pro */
.layout-sidebar-pro .cv-body {
    grid-template-columns: 1.2fr 2.8fr;
    gap: 40px;
}
.layout-sidebar-pro .cv-col-side {
    order: 1;
    background: #fcfcfc;
    padding: 15px;
    border-radius: 8px;
}
.layout-sidebar-pro .cv-col-main {
    order: 2;
}

/* CV Typography & Details */
.cv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    margin-bottom: 15px;
    min-height: 160px;
}

.cv-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--cv-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.cv-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cv-contact-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 15px;
    font-size: 0.75rem;
    line-height: 1.2;
}
.cv-contact-strip span { display: flex; align-items: center; white-space: nowrap; }
.cv-contact-strip span.hidden { display: none; }
.cv-contact-strip i { color: #000000; margin-right: 5px; font-size: 0.85rem; }
.cv-page-ar .cv-contact-strip i { margin-right: 0; margin-left: 5px; }

.cv-photo-container {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #f1f2f6;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.cv-photo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cv-accent);
    text-transform: uppercase;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 3px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.cv-section {
    margin-bottom: 20px; /* Increased margin to spread sections */
}

.section-content {
    font-size: 0.85rem;
    line-height: 1.5; /* Increased line height to fill vertical space */
}

/* Parsed Items Styling */
.exp-item { margin-bottom: 15px; }
.exp-title { font-weight: 700; font-size: 0.92rem; color: var(--cv-accent); line-height: 1.3; }
.exp-meta { font-size: 0.82rem; color: #576574; margin-bottom: 5px; font-style: italic; }
.exp-desc ul { margin-left: 12px; padding-left: 0; list-style-type: none; }
.exp-desc li { margin-bottom: 5px; font-size: 0.84rem; line-height: 1.5; position: relative; padding-left: 15px; }
.exp-desc li::before { content: "•"; position: absolute; left: 0; color: #000000; }

.skill-list { list-style: none; padding: 0; }
.skill-list li {
    display: inline-block;
    background: #ecf0f1;
    padding: 6px 14px; /* Slightly larger tags */
    border-radius: 4px;
    margin: 0 8px 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cv-accent);
}

/* Footer Logo */
.cv-footer-logo {
    position: absolute;
    bottom: 15px;
    right: 20px;
    opacity: 0.15; /* Subtle watermark style */
    width: 150px;
}
.cv-footer-logo img {
    width: 100%;
    height: auto;
}

/* AI Section */
.ai-section {
    margin-top: 20px;
    background: linear-gradient(135deg, #f5eef8, #fdfefe);
    border: 1px solid #d2b4de;
    border-radius: 10px;
    padding: 15px;
}
.ai-section .btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 52, 131, 0.3);
}
