/* ==========================================
   GULF CV BUILDER - CUSTOM LOCAL STYLES
   ========================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f9;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.lang-header {
    display: flex;
    justify-content: center;
    gap: 10px;
    background-color: #1e293b;
    padding: 15px;
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.lang-header button {
    background: #334155;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.lang-header button:hover { background: #475569; }
.lang-header button.active { background: #2563eb !important; font-weight: bold; }

.form-card {
    background: #ffffff;
    width: 100%;
    max-width: 800px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    box-sizing: border-box;
    margin-bottom: 20px;
}

h2 {
    color: #0f172a;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label { font-weight: 600; color: #334155; font-size: 15px; }

input[type="text"], input[type="tel"], select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    background-color: #f8fafc;
    font-size: 14px;
}
input[type="text"]:focus, input[type="tel"]:focus, select:focus {
    border-color: #2563eb;
    outline: none;
    background-color: #ffffff;
}

input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px dashed #94a3b8;
    border-radius: 6px;
    box-sizing: border-box;
    background-color: #f8fafc;
    font-size: 13px;
    color: #334155;
}
input[type="file"]::file-selector-button {
    padding: 8px 14px;
    margin-right: 10px;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: #1d4ed8; }

/* Duty checklist items (built dynamically by onSectorChange) */
.checkbox-list { display: flex; flex-direction: column; gap: 6px; }
.sector-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.sector-item label { font-weight: 500; margin: 0; }

/* Group picker: icon buttons shown before the job dropdown, so the user
   never scrolls through all 30 categories at once. */
.group-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.group-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.group-btn:hover { border-color: #93c5fd; background: #eff6ff; }
.group-btn.active { border-color: #2563eb; background: #eff6ff; }
.group-icon { font-size: 26px; line-height: 1; }
.group-label { font-size: 12px; font-weight: 600; color: #334155; text-align: center; line-height: 1.3; }

button, input[type="button"] { cursor: pointer; }

#btn-generate {
    width: 100%;
    padding: 14px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
}
#btn-generate:hover { background: #1d4ed8; }

/* Language proficiency chips */
.lang-check-container { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 0; }
.circle-check {
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 20px;
    gap: 8px;
}
.circle-check input { display: none; }
.circle-check .checkmark {
    height: 16px;
    width: 16px;
    background-color: #cbd5e1;
    border-radius: 50%;
    display: inline-block;
    transition: all 0.2s ease;
}
.circle-check input:checked ~ .checkmark {
    background-color: #2563eb;
    box-shadow: inset 0 0 0 3px #ffffff;
}

/* Baladiya health card toggle */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background-color: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.toggle-text { font-size: 14px; color: #334155; font-weight: 500; }
.switch { position: relative; display: inline-block; width: 50px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1; transition: .3s;
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px;
    background-color: white; transition: .3s;
}
input:checked + .slider { background-color: #2563eb; }
input:focus + .slider { box-shadow: 0 0 1px #2563eb; }
input:checked + .slider:before { transform: translateX(24px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* ==========================================
   CV OUTPUT VIEW (shown after Generate CV, hidden by default)
   ========================================== */
#cv-controls {
    width: 100%;
    max-width: 800px;
    margin: 10px auto;
    display: flex;
    gap: 10px;
    padding: 0 10px;
    box-sizing: border-box;
}
.back-btn, .next-btn {
    flex: 1;
    margin: 0;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}
.back-btn { background: #64748b; }
.back-btn:hover { background: #475569; }
.next-btn { background: #059669; }
.next-btn:hover { background: #047857; }

.print-hint {
    max-width: 800px;
    margin: 8px auto 0 auto;
    padding: 0 10px;
    text-align: center;
    font-size: 12px;
    color: #64748b;
    box-sizing: border-box;
}

#whatsapp-row {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 10px auto;
    padding: 0 10px;
    box-sizing: border-box;
    text-align: center;
}
.whatsapp-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #25D366;
}
.whatsapp-btn:hover { background: #1ebe57; }
.whatsapp-hint {
    font-size: 12px;
    color: #64748b;
    margin: 6px 0 0 0;
}

#cv-template {
    background: #ffffff;
    width: 100%;
    max-width: 800px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    box-sizing: border-box;
    color: #000000;
    font-size: 16px;
}
.cv-doc-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    border-bottom: 2px solid #000000;
    padding-bottom: 8px;
    margin: 0 0 12px 0;
}
.cv-header-text { flex: 1; }
#cv-template .cv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 3px solid #000000;
    padding-bottom: 10px;
    margin-bottom: 12px;
}
.cv-photo-box {
    width: 110px;
    height: 140px;
    border: 2px dashed #666666;
    border-radius: 4px;
    margin-left: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}
.cv-photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cv-photo-placeholder { font-size: 11px; color: #888888; line-height: 1.4; }
.cv-name { font-size: 28px; font-weight: 700; color: #000000; line-height: 1.2; }
.cv-title { font-size: 17px; font-weight: 600; color: #333333; margin-top: 3px; }
.cv-contact { font-size: 14px; color: #333333; margin-top: 6px; }

.cv-section { margin-bottom: 12px; }
.cv-section h3 {
    color: #000000;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #333333;
    padding-bottom: 4px;
    margin: 0 0 6px 0;
}

.cv-summary-text {
    margin: 0;
    line-height: 1.5;
    color: #000000;
    font-size: 15px;
}

.cv-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 20px;
}
.cv-detail-cell { display: flex; flex-direction: row; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid #eeeeee; }
.cv-detail-label { font-size: 13px; color: #000000; font-weight: 700; }
.cv-detail-value { font-size: 14px; color: #000000; font-weight: 400; }

.cv-skills-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-chip {
    background: #f2f2f2;
    color: #000000;
    border: 1px solid #999999;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
}

.cv-declaration-text { font-size: 12px; color: #333333; font-style: italic; margin: 0 0 6px 0; }
.cv-signature-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #000000;
    border-top: 1px solid #999999;
    padding-top: 6px;
}
.cv-exp-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.cv-exp-dates { font-size: 13px; color: #555555; margin-bottom: 4px; }
.cv-exp-bullets { margin: 0; padding-left: 20px; line-height: 1.5; font-size: 14px; }
.cv-edu-country { font-size: 13px; color: #555555; margin-top: 0; }

/* Form section dividers (Work Experience / Education headings inside the form itself) */
.form-subheading {
    margin: 30px 0 10px 0;
    padding-top: 10px;
    border-top: 2px solid #e2e8f0;
    color: #0f172a;
    font-size: 17px;
}

/* ==========================================
   MOBILE RESPONSIVENESS
   Primary users are on phones, not desktops — this is the default
   experience, not an afterthought.
   ========================================== */
@media (max-width: 480px) {
    body { padding: 10px; }
    .form-card, #cv-template { padding: 18px; }
    .lang-header { flex-wrap: wrap; padding: 10px; gap: 6px; }
    .lang-header button { padding: 8px 12px; font-size: 13px; }
    .cv-details-grid { grid-template-columns: 1fr; }
    .cv-name { font-size: 20px; }
    .cv-doc-title { font-size: 17px; letter-spacing: 1.5px; }
    .cv-photo-box { width: 72px; height: 92px; }
    .cv-signature-row { flex-direction: column; gap: 6px; }
}

/* ==========================================================================
   PRINT ENGINE - CONVERTS #cv-template TO A CLEAN PDF, EVERYTHING ELSE HIDDEN
   ========================================================================== */
/* Reduces the browser's default print margins. NOTE: this cannot remove the
   browser's own header/footer (URL, date, page number) — that is controlled
   by the browser's print dialog, not by any webpage. Users must turn off
   "Headers and footers" in the print dialog's "More settings" for a clean
   result. We can only shrink margins and force page size here. */
@page {
    size: A4 portrait;
    margin: 12mm;
}

@media print {
    body, html { background: white !important; color: black !important; }
    body {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .lang-header,
    .form-card,
    #cv-controls,
    .print-hint,
    #whatsapp-row {
        display: none !important;
    }

    #cv-template {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: white !important;
        color: black !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
