@import url('index.css');

/* Builder Layout */
.builder-container {
    display: flex;
    min-height: calc(100vh - 70px);
    background: transparent;
}

/* Left Panel (Form) */
.editor-panel {
    flex: 0 0 400px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 30px;
    overflow-y: auto;
    height: calc(100vh - 70px);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 15px rgba(0,0,0,0.05);
    z-index: 10;
}

.panel-header {
    margin-bottom: 30px;
}

.panel-header h2 {
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.panel-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    background: transparent;
    color: var(--text-main);
    transition: border-color 0.3s, box-shadow 0.3s;
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

select option {
    background: var(--bg-card);
    color: var(--text-main);
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

hr {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 25px 0;
}

/* Right Panel (Preview) */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    overflow-y: auto;
    height: calc(100vh - 70px);
}

.preview-actions {
    width: 100%;
    max-width: 210mm;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

/* Ad Banner Above CV */
.cv-ad-banner {
    width: 100%;
    max-width: 210mm;
    background: linear-gradient(to right, #fffdf5, #fff);
    border: 1px solid var(--accent);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.cv-ad-banner a {
    text-decoration: none;
    font-weight: 600;
    color: var(--text-main);
}

.cv-ad-banner a:hover {
    color: var(--primary);
}

/* The A4 Paper (CV Styling) */
.a4-paper {
    --cv-color: #0097e6; /* Default color */
    width: 21cm;
    min-height: 29.7cm;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 1.2cm 1.5cm; /* Reduced padding (top-bottom 1.2cm, left-right 1.5cm) */
    margin-bottom: 50px;
    font-family: 'Inter', sans-serif;
    color: #2b2b2b;
    position: relative;
    border-top: 15px solid var(--cv-color);
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s;
}

/* Accordion Styles */
.settings-panel {
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.accordion-btn {
    background-color: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    padding: 15px;
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    outline: none;
    font-size: 1rem;
    font-weight: 600;
    transition: 0.3s;
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.accordion-btn:hover, .accordion-btn.active {
    background-color: rgba(0, 151, 230, 0.1);
    border-color: var(--primary);
}
.accordion-content {
    padding: 15px 20px;
    display: none;
    background-color: transparent;
    border-left: 2px solid var(--primary);
    margin-bottom: 15px;
    margin-left: 10px;
}
.btn-outline {
    background: transparent;
    border: 1px dashed var(--primary);
    color: var(--primary);
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    width: 100%;
    margin-top: 10px;
    transition: 0.2s;
}
.btn-outline:hover {
    background: rgba(0, 151, 230, 0.1);
}
.btn-small-danger {
    background: #ff7675;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* CV Internal Styles */
.cv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #2b2b2b;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

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

.cv-photo {
    width: 3.5cm;
    height: 4.5cm;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #ddd;
    margin-left: 20px;
}

.cv-header h1 {
    font-size: 26pt;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
    color: #111;
}

.cv-header h2 {
    font-size: 14pt;
    color: var(--cv-color);
    font-weight: 600;
    margin-bottom: 15px;
}

.cv-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 10pt;
    color: #555;
}

.cv-contact span {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

/* Template: Modern (2 Columns) */
.template-modern .cv-body {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 40px;
    align-items: stretch;
    flex: 1;
}

/* Template: Classic ATS (1 Column) */
.template-classic .cv-body {
    display: block;
}
.template-classic .cv-main, .template-classic .cv-sidebar {
    width: 100%;
}
.template-classic .cv-photo {
    display: none !important;
}
.template-classic .cv-header {
    text-align: center;
    border-bottom: 2px solid #000;
}
.template-classic .cv-contact {
    justify-content: center;
}
.template-classic .a4-paper {
    border-top: none;
    font-family: 'Times New Roman', serif;
}
.template-classic .cv-footer-shape {
    display: none;
}
.template-classic .cv-sidebar {
    background: transparent;
    padding: 0;
    border-left: none;
    margin-top: 25px;
}
.template-classic .section-title {
    color: #000;
}
.template-classic .skill-tag {
    background: transparent;
    color: #000;
    border: 1px solid #000;
    padding: 4px 8px;
}
.template-classic .cv-header h2 {
    color: #000;
}

.cv-main, .cv-sidebar {
    display: flex;
    flex-direction: column;
    gap: 25px; /* Reduced from 35px */
    min-width: 0; 
    word-break: break-word; 
}

.cv-sidebar {
    background: #f8f9fc;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #4a69bd;
}

.cv-section {
    /* Menghapus margin-bottom karena sudah pakai gap di container */
}

.section-title {
    font-size: 14pt;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--cv-color);
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.cv-section p {
    font-size: 10.5pt;
    line-height: 1.6;
    color: #444;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.cv-item {
    margin-bottom: 20px;
}

.cv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3px;
    gap: 10px;
}

.cv-item-header h4 {
    font-size: 11pt;
    font-weight: 700;
    flex: 1;
    word-break: break-word;
}

.cv-date {
    font-size: 9.5pt;
    color: #555;
    font-weight: 600;
}

.cv-company {
    font-size: 11pt;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
    word-break: break-word;
}

.cv-desc {
    font-size: 10pt;
    line-height: 1.6;
    color: #555;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap; /* Respects line breaks from textarea */
}

.cv-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.skill-tag {
    font-size: 10.5pt;
    background: #eef1f7;
    color: #2b2b2b;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #dce1ef;
    font-weight: 500;
    word-break: break-word;
}

/* Minimalist Bottom Accent Shape */
.cv-footer-shape {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 15px;
    background: var(--cv-color);
    border-top-left-radius: 12px;
}

/* Template: Minimalis */
.template-minimal {
    font-family: 'Poppins', sans-serif;
    border-top: none;
    border-left: 15px solid var(--cv-color);
}
.template-minimal .cv-header {
    border-bottom: none;
}
.template-minimal .cv-header h1 {
    font-weight: 400;
    letter-spacing: 2px;
}
.template-minimal .cv-photo {
    border-radius: 50%;
    width: 4cm;
    height: 4cm;
}
.template-minimal .cv-sidebar {
    background: transparent;
    border-left: 1px solid #eee;
}

/* Template: Kreatif */
.template-creative {
    background: #fafafa;
    border-top: 15px solid var(--cv-color);
    border-bottom: 15px solid var(--cv-color);
}
.template-creative .cv-header {
    background: var(--cv-color);
    color: white;
    padding: 30px;
    margin: -1.2cm -1.5cm 30px -1.5cm;
    border-bottom: none;
    border-radius: 0 0 20px 20px;
}
.template-creative .cv-header h1,
.template-creative .cv-header h2,
.template-creative .cv-contact,
.template-creative .cv-contact span {
    color: white;
}
.template-creative .cv-photo {
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.template-creative .section-title {
    background: var(--cv-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
    border-bottom: none;
}
.template-creative .skill-tag {
    background: rgba(0,0,0,0.05);
    border: 1px dashed var(--cv-color);
}

/* Template: Corporate Pro */
.template-corporate {
    font-family: 'Georgia', serif;
    border-top: 8px solid var(--cv-color);
}
.template-corporate .cv-header h1 {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    color: var(--cv-color);
}
.template-corporate .cv-header h2 {
    color: #444;
}
.template-corporate .cv-sidebar {
    background: #fdfdfd;
    border-left: 2px dashed #ccc;
    border-radius: 0;
}
.template-corporate .section-title {
    border-bottom: 2px solid var(--cv-color);
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    font-size: 12pt;
    color: #222;
}
.template-corporate .cv-photo {
    border-radius: 4px;
}
.template-corporate p, .template-corporate .cv-desc, .template-corporate .cv-date {
    font-family: 'Inter', sans-serif;
}

/* Template: Timeline */
.template-timeline {
    border-top: none;
    border-right: 15px solid var(--cv-color);
    background: #fff;
}
.template-timeline .cv-header {
    text-align: right;
    flex-direction: row-reverse;
}
.template-timeline .cv-photo {
    margin-left: 0;
    margin-right: 20px;
    border-radius: 15px;
}
.template-timeline .cv-sidebar {
    background: transparent;
    border-left: none;
    border-right: 3px solid var(--cv-color);
    text-align: right;
}
.template-timeline .cv-main .cv-item {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--cv-color);
}
.template-timeline .cv-main .cv-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 5px;
    width: 10px;
    height: 10px;
    background: var(--cv-color);
    border-radius: 50%;
}
.template-timeline .section-title {
    color: #333;
    border-bottom: none;
    position: relative;
    padding-bottom: 0;
}
.template-timeline .section-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--cv-color);
    margin-top: 5px;
}
.template-timeline .cv-sidebar .section-title::after {
    margin-left: auto;
}

/* Modal specific styles for CV Maker */
.hidden { display: none !important; }

/* Responsive Builder */
@media (max-width: 900px) {
    .builder-container {
        flex-direction: column;
    }
    .editor-panel {
        flex: none;
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 2px solid var(--border);
    }
    .preview-panel {
        height: auto;
    }
    .a4-paper {
        width: 100%; /* Scale down on mobile */
        padding: 1.5cm;
    }
}

/* =======================================================
   MAGIC PRINT RULES (Hides everything except the CV)
   ======================================================= */
@media print {
    @page {
        size: A4;
        margin: 0; /* Let the paper padding handle margins */
    }
    
    body {
        background: white;
    }

    .no-print,
    .editor-panel,
    .preview-actions,
    .cv-ad-banner,
    .modal-overlay {
        display: none !important;
    }

    .builder-container {
        display: block;
    }

    .preview-panel {
        padding: 0;
        height: auto;
        overflow: visible;
        display: block;
    }

    .a4-paper {
        box-shadow: none;
        margin: 0;
        padding: 2cm;
        width: 21cm;
        height: 29.7cm;
    }

    /* Adjust font rendering for print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
