/* ==========================================================================
   CV BUILDER - TEMPLATE EXECUTIVE (ĐIỀU HÀNH)
   Áp dụng kiến trúc CSS phân tầng độc lập & hỗ trợ đa bảng màu theo [data-theme]
   Bố cục: Header banner gradient hồng tím nhẹ full-width (Avatar + Họ tên + Liên hệ)
   + Dải Subheader pill tags kỹ năng nổi bật + Thân 2 cột trắng (Main 7/12 bullet kim cương `◆`
   / Aside 5/12 bullet phẳng)
   ========================================================================== */

/* 1. Theme Variables cho các gam màu của template Executive */

/* 1.1. Theme Rose Gold (Hồng vàng - Mặc định) */
.cv-template-executive,
.cv-template-executive[data-theme="rose_gold"],
[data-theme="rose_gold"] .cv-template-executive,
[data-theme="rose_gold"]#cvExecutiveComponent,
#cvExecutiveComponent[data-theme="rose_gold"],
[data-theme="rose_gold"] {
    --cv-primary: #be185d;
    --cv-primary-subtle: #fdf2f8;
    --cv-primary-dark: #9d174d;
    --cv-primary-rgb: 190, 24, 93;
    --cv-sidebar-bg: #fce7f3;
    --cv-accent: #e11d48;
    --cv-border: #fbcfe8;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #fbcfe8;

    --cv-theme-primary: #be185d;
    --cv-theme-primary-subtle: #fdf2f8;
    --cv-theme-primary-dark: #9d174d;
    --cv-theme-sidebar-bg: #fce7f3;
    --cv-theme-accent: #e11d48;
    --cv-theme-border: #fbcfe8;
    --cv-theme-text-dark: #1e293b;
}

/* ĐỔI TÊN: `sunset` đã có sẵn trong public/css/cv-builder.css với hex #ea580c
   -> đổi thành `warm_sunset` (#c2410c) để tránh xung đột [data-theme] (plan.md Mục 9.2) */
/* 1.2. Theme Warm Sunset (Cam hoàng hôn ấm) */
.cv-template-executive[data-theme="warm_sunset"],
[data-theme="warm_sunset"] .cv-template-executive,
[data-theme="warm_sunset"]#cvExecutiveComponent,
#cvExecutiveComponent[data-theme="warm_sunset"],
[data-theme="warm_sunset"] {
    --cv-primary: #c2410c;
    --cv-primary-subtle: #fff7ed;
    --cv-primary-dark: #9a3412;
    --cv-primary-rgb: 194, 65, 12;
    --cv-sidebar-bg: #ffedd5;
    --cv-accent: #ea580c;
    --cv-border: #fed7aa;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #fed7aa;

    --cv-theme-primary: #c2410c;
    --cv-theme-primary-subtle: #fff7ed;
    --cv-theme-primary-dark: #9a3412;
    --cv-theme-sidebar-bg: #ffedd5;
    --cv-theme-accent: #ea580c;
    --cv-theme-border: #fed7aa;
    --cv-theme-text-dark: #1e293b;
}

/* 1.3. Theme Amethyst (Tím thạch anh) */
.cv-template-executive[data-theme="amethyst"],
[data-theme="amethyst"] .cv-template-executive,
[data-theme="amethyst"]#cvExecutiveComponent,
#cvExecutiveComponent[data-theme="amethyst"],
[data-theme="amethyst"] {
    --cv-primary: #7e22ce;
    --cv-primary-subtle: #faf5ff;
    --cv-primary-dark: #6b21a8;
    --cv-primary-rgb: 126, 34, 206;
    --cv-sidebar-bg: #f3e8ff;
    --cv-accent: #9333ea;
    --cv-border: #e9d5ff;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #e9d5ff;

    --cv-theme-primary: #7e22ce;
    --cv-theme-primary-subtle: #faf5ff;
    --cv-theme-primary-dark: #6b21a8;
    --cv-theme-sidebar-bg: #f3e8ff;
    --cv-theme-accent: #9333ea;
    --cv-theme-border: #e9d5ff;
    --cv-theme-text-dark: #1e293b;
}

/* 2. Color Swatches cho Palette Buttons */
.cv-swatch-rose_gold {
    background-color: #be185d;
}

.cv-swatch-warm_sunset {
    background-color: #c2410c;
}

.cv-swatch-amethyst {
    background-color: #7e22ce;
}

/* 3. Class định hình cấu trúc Template Executive chuẩn */
.cv-template-executive {
    background-color: #ffffff;
    width: 100%;
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #334155;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* 3.1. Header Banner gradient hồng tím nhẹ full-width */
.cv-executive-banner {
    background-image: linear-gradient(135deg, var(--cv-theme-primary), var(--cv-theme-primary-dark));
    color: #ffffff;
    transition: background-image 0.15s ease-in-out;
}

.cv-executive-avatar-wrap {
    width: 96px;
    height: 96px;
}

.cv-executive-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cv-executive-avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.15);
    border: 3px solid #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 2rem;
}

.cv-executive-fullname {
    color: #ffffff;
}

.cv-executive-role {
    color: rgba(255, 255, 255, 0.85);
}

.cv-executive-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
}

.cv-executive-contact-item i {
    color: rgba(255, 255, 255, 0.75);
    flex-shrink: 0;
}

.cv-executive-basic-row {
    color: rgba(255, 255, 255, 0.75);
}

.cv-executive-text-faded {
    color: rgba(255, 255, 255, 0.65);
}

/* 3.2. Dải Subheader pill tags kỹ năng nổi bật */
.cv-executive-subheader {
    background-color: var(--cv-primary-subtle, #fdf2f8);
    border-bottom: 1px solid var(--cv-theme-border);
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.cv-executive-subheader-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--cv-theme-primary);
}

.cv-executive-skill-pill {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 9999px;
    border: 1px solid var(--cv-theme-border);
    background-color: #ffffff;
    color: var(--cv-theme-primary);
    font-size: 0.75rem;
    font-weight: 500;
}

/* 3.3. Thân CV 2 cột trắng (không sidebar màu) */
.cv-executive-main,
.cv-executive-aside {
    background-color: #ffffff;
}

.cv-executive-aside {
    border-left: 1px solid var(--cv-theme-border);
}

/* Heading với bullet kim cương "◆" */
.cv-executive-section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--cv-theme-primary);
    margin-bottom: 12px;
    transition: color 0.15s ease-in-out;
}

.cv-executive-section-heading::before {
    content: "\25C6";
    font-size: 0.7rem;
    color: var(--cv-theme-accent);
    flex-shrink: 0;
}

/* Dùng cho chữ nhấn (công ty, trường học, vị trí tham khảo) */
.cv-executive-title {
    color: var(--cv-theme-primary);
    transition: color 0.15s ease-in-out;
}

/* 3.4. Kinh nghiệm làm việc: card + badge thời gian bo góc tròn */
.cv-executive-exp-card {
    padding-bottom: 2px;
}

.cv-executive-date-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    background-color: var(--cv-primary-subtle, #fdf2f8);
    color: var(--cv-theme-primary);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

/* 3.5. Học vấn (Aside) */
.cv-executive-education-header {
    font-weight: 700;
    color: var(--cv-theme-text-dark);
}

.cv-executive-education-body {
    margin-top: 2px;
}

/* 3.6. Kỹ năng chi tiết (Aside) - bullet phẳng */
.cv-executive-bullet {
    color: var(--cv-theme-primary);
    font-weight: bold;
    flex-shrink: 0;
}

/* 3.7. Giải thưởng (Aside) */
.cv-executive-award-item {
    padding-bottom: 2px;
}

/* 3.8. Tag Pill cho Công việc mong muốn */
.cv-executive-tag-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--cv-theme-border);
    background-color: var(--cv-primary-subtle, #fdf2f8);
    color: var(--cv-theme-primary);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Khối Tham khảo: ẩn khi rỗng (spec.md Mục 5) bằng CSS thay vì d-none phía server */
.cv-template-executive #livePreviewReferenceSection:has(.cv-live-ref-empty) {
    display: none;
}

/* 3.9. Direct Mode (Soạn thảo trực tiếp): chữ/viền sáng trên nền banner tối */
.cv-executive-banner .form-control-plaintext {
    color: #ffffff !important;
}

.cv-executive-banner .form-control-plaintext::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.cv-executive-banner select.form-control-plaintext option {
    color: #1e293b;
}

.cv-executive-banner .hover-border:hover,
.cv-executive-banner .hover-border:focus {
    border-color: rgba(255, 255, 255, 0.5) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Direct Mode: nút "Thêm..." nằm ở Thân CV nền TRẮNG -> dùng primary */
.cv-executive-main .cv-direct-add-btn,
.cv-executive-aside .cv-direct-add-btn {
    background-color: transparent;
    border: 1px dashed var(--cv-theme-border);
    color: var(--cv-theme-primary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.cv-executive-main .cv-direct-add-btn:hover,
.cv-executive-aside .cv-direct-add-btn:hover {
    background-color: var(--cv-primary-subtle, #fdf2f8);
    border-color: var(--cv-theme-primary);
    color: var(--cv-theme-primary-dark);
}

/* Direct Mode: mẫu clone Học vấn dùng chung (create_direct.blade.php #resumeEducation) mang .cv-simple-education-header
   + input .text-white / nút .text-white-50 (thiết kế cho header nền primary của `simple`). Ở `executive` header trong suốt
   trên nền trắng (mục 4.4) -> ép chữ tối để không bị "vô hình" khi bấm "Thêm học vấn" (precedent highlight/timeline). */
.cv-template-executive .cv-simple-education-header .form-control-plaintext {
    color: var(--cv-theme-text-dark) !important;
}

.cv-template-executive .cv-simple-education-header .cv-direct-remove-btn {
    color: #ef4444 !important;
}

.cv-executive-direct-exp-card,
.cv-executive-direct-edu-card,
.cv-executive-direct-award-card,
.cv-executive-direct-ref-card {
    border-color: var(--cv-theme-border) !important;
}

/* 4. TƯƠNG THÍCH ĐỒNG BỘ JS REPEATER LIVE PREVIEW (KHI CHÈN CLASS .cv-simple-*)
   JS dùng chung `syncAllRepeaters()` trong create_form.blade.php dựng markup cứng mang class gốc
   của template `simple` (hộp sáng, sao đánh giá, chữ tối) cho MỌI template Form Mode.
   Khối dưới đây ghi đè để khớp giao diện executive (bullet kim cương + badge thời gian). */

/* 4.1. Alias .cv-simple-title -> màu primary */
.cv-template-executive .cv-simple-title {
    color: var(--cv-theme-primary) !important;
}

/* 4.2. Khối Kinh nghiệm trong Main (JS chèn .cv-simple-timeline-card) -> card phẳng, không đường kẻ dọc */
.cv-template-executive .cv-executive-main .cv-simple-timeline-card {
    border-left: 0 !important;
    padding-left: 0 !important;
    margin-bottom: 14px !important;
    background-color: transparent !important;
}

/* Thời gian Kinh nghiệm do JS dựng (span .text-muted .cv-live-exp-time) -> badge bo tròn như .cv-executive-date-badge */
.cv-template-executive #livePreviewExperienceContainer .cv-simple-timeline-card .cv-live-exp-time {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    background-color: var(--cv-primary-subtle, #fdf2f8);
    color: var(--cv-theme-primary) !important;
    font-size: 0.72rem !important;
    font-weight: 600;
    white-space: nowrap;
}

/* Ẩn badge thời gian rỗng (cả bản server lẫn bản JS) khi người dùng chưa nhập thời gian */
.cv-template-executive .cv-live-exp-time:empty {
    display: none;
}

/* 4.3. Khối Giải thưởng trong Aside (JS chèn .cv-simple-timeline-card) */
.cv-template-executive .cv-executive-aside .cv-simple-timeline-card {
    border-left: 0 !important;
    padding-left: 0 !important;
    margin-bottom: 10px !important;
    background-color: transparent !important;
}

/* 4.4. Khối Học vấn trong Aside (JS dựng .cv-simple-education-header/-body) */
.cv-template-executive .cv-executive-aside .cv-simple-education-header {
    background-color: transparent !important;
    color: var(--cv-theme-text-dark) !important;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 0 !important;
    padding: 0 !important;
    margin-bottom: 2px;
}

.cv-template-executive .cv-executive-aside .cv-simple-education-header .cv-live-edu-school {
    color: var(--cv-theme-text-dark) !important;
    font-weight: 700;
}

.cv-template-executive .cv-executive-aside .cv-simple-education-header .cv-live-edu-time {
    color: #64748b !important;
}

.cv-template-executive .cv-executive-aside .cv-simple-education-body {
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.cv-template-executive .cv-executive-aside .cv-simple-education-body .cv-live-edu-major {
    color: var(--cv-theme-primary) !important;
    font-weight: 600;
}

/* 4.5. Khối Kỹ năng trong Aside (JS dựng hộp "col-6 bg-light border" + sao)
   -> chuẩn hóa thành danh sách bullet phẳng 100% chiều rộng, ẩn sao */
.cv-template-executive .cv-executive-aside .cv-live-skill-item.col-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

.cv-template-executive .cv-executive-aside .cv-live-skill-item .bg-light {
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 2px 0 !important;
    display: flex !important;
    align-items: baseline !important;
    justify-content: flex-start !important;
    gap: 6px;
}

.cv-template-executive .cv-executive-aside .cv-live-skill-item .bg-light::before {
    content: "•";
    color: var(--cv-theme-primary);
    font-weight: bold;
    flex-shrink: 0;
}

.cv-template-executive .cv-executive-aside .cv-live-skill-stars {
    display: none !important;
}

.cv-template-executive .cv-executive-aside .cv-live-skill-name {
    color: #1e293b !important;
}

/* 4.6. Tag pill Nơi làm việc/Ngành nghề/Lĩnh vực từ syncVSelectTags() */
.cv-template-executive .cv-simple-tag-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--cv-theme-border);
    background-color: var(--cv-primary-subtle, #fdf2f8);
    color: var(--cv-theme-primary);
    font-size: 0.75rem;
    font-weight: 500;
}

/* 5. @MEDIA PRINT A4 CHUẨN: KHÔNG CẮT KHỐI, CHỐNG TRÀN LỀ, GIỮ MÀU SẮC */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    /* Ẩn toolbar, topbar, buttons khi in */
    .cv-show-topbar,
    .cv-public-topbar,
    .btn,
    .cv-preview-control,
    .cv-preview-actions,
    .no-print,
    header,
    footer,
    nav {
        display: none !important;
    }

    .cv-paper-stage {
        padding: 0 !important;
        background: transparent !important;
    }

    .cv-a4-sheet {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .cv-template-executive {
        width: 100% !important;
        background-color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-executive .cv-executive-banner {
        background-image: linear-gradient(135deg, var(--cv-theme-primary), var(--cv-theme-primary-dark)) !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-executive .cv-executive-subheader {
        background-color: var(--cv-primary-subtle, #fdf2f8) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-executive .cv-executive-main,
    .cv-template-executive .cv-executive-aside {
        background-color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Ngăn ngắt trang xấu giữa chừng các khối thông tin */
    .cv-template-executive .break-inside-avoid,
    .cv-executive-contact-item,
    .cv-executive-skill-pill,
    .cv-executive-skill-item,
    .cv-executive-exp-card,
    .cv-executive-award-item,
    .cv-live-exp-item,
    .cv-live-edu-item,
    .cv-live-skill-item,
    .cv-live-award-item,
    .cv-live-ref-item,
    .cv-simple-timeline-card {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}
