/* ==========================================================================
   CV BUILDER - TEMPLATE HIGHLIGHT (NỔI BẬT)
   Á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 trắng (thanh accent dọc + avatar + họ tên + liên hệ) + Ribbon ngang
   full-width (Kỹ năng, DUY NHẤT 1 lần) + Thân 2 cột trắng (không sidebar màu)
   ========================================================================== */

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

/* 1.1. Theme Royal Blue (Xanh coban - Mặc định) */
.cv-template-highlight,
.cv-template-highlight[data-theme="royal_blue"],
[data-theme="royal_blue"] .cv-template-highlight,
[data-theme="royal_blue"]#cvHighlightComponent,
#cvHighlightComponent[data-theme="royal_blue"],
[data-theme="royal_blue"] {
    --cv-primary: #1d4ed8;
    --cv-primary-subtle: #eff6ff;
    --cv-primary-dark: #1e3a8a;
    --cv-primary-rgb: 29, 78, 216;
    --cv-sidebar-bg: #dbeafe;
    --cv-accent: #3b82f6;
    --cv-border: #bfdbfe;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #bfdbfe;

    --cv-theme-primary: #1d4ed8;
    --cv-theme-sidebar-bg: #dbeafe;
    --cv-theme-accent: #3b82f6;
    --cv-theme-border: #bfdbfe;
    --cv-theme-text-dark: #1e293b;
}

/* 1.2. Theme Rose (Hồng san hô) */
.cv-template-highlight[data-theme="rose"],
[data-theme="rose"] .cv-template-highlight,
[data-theme="rose"]#cvHighlightComponent,
#cvHighlightComponent[data-theme="rose"],
[data-theme="rose"] {
    --cv-primary: #e11d48;
    --cv-primary-subtle: #fff1f2;
    --cv-primary-dark: #9f1239;
    --cv-primary-rgb: 225, 29, 72;
    --cv-sidebar-bg: #ffe4e6;
    --cv-accent: #fb7185;
    --cv-border: #fecdd3;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #fecdd3;

    --cv-theme-primary: #e11d48;
    --cv-theme-sidebar-bg: #ffe4e6;
    --cv-theme-accent: #fb7185;
    --cv-theme-border: #fecdd3;
    --cv-theme-text-dark: #1e293b;
}

/* 1.3. Theme Marigold (Cam hổ phách) */
.cv-template-highlight[data-theme="marigold"],
[data-theme="marigold"] .cv-template-highlight,
[data-theme="marigold"]#cvHighlightComponent,
#cvHighlightComponent[data-theme="marigold"],
[data-theme="marigold"] {
    --cv-primary: #d97706;
    --cv-primary-subtle: #fffbeb;
    --cv-primary-dark: #92400e;
    --cv-primary-rgb: 217, 119, 6;
    --cv-sidebar-bg: #fef3c7;
    --cv-accent: #fbbf24;
    --cv-border: #fde68a;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #fde68a;

    --cv-theme-primary: #d97706;
    --cv-theme-sidebar-bg: #fef3c7;
    --cv-theme-accent: #fbbf24;
    --cv-theme-border: #fde68a;
    --cv-theme-text-dark: #1e293b;
}

/* 2. Color Swatches cho Palette Buttons */
.cv-swatch-royal_blue {
    background-color: #1d4ed8;
}

.cv-swatch-rose {
    background-color: #e11d48;
}

.cv-swatch-marigold {
    background-color: #d97706;
}

/* 3. Class định hình cấu trúc Template Highlight chuẩn gốc */
.cv-template-highlight {
    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 trắng: thanh accent dọc trái + avatar + họ tên + liên hệ */
.cv-highlight-header {
    background-color: #ffffff;
    border-left: 6px solid var(--cv-theme-primary);
    transition: border-color 0.15s ease-in-out;
}

.cv-highlight-avatar-wrap {
    width: 88px;
    height: 88px;
}

.cv-highlight-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--cv-theme-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.cv-highlight-avatar-placeholder {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background-color: var(--cv-primary-subtle, #dbeafe);
    border: 3px solid var(--cv-theme-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cv-theme-primary);
    font-size: 1.8rem;
}

.cv-highlight-fullname {
    color: #0f172a;
}

.cv-highlight-role {
    color: var(--cv-theme-primary);
    font-weight: 600;
}

.cv-highlight-basic-row {
    color: #64748b;
}

.cv-highlight-contact-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: right;
}

.cv-highlight-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    word-break: break-word;
    font-size: 0.78rem;
}

.cv-highlight-contact-item i {
    color: var(--cv-theme-primary);
    flex-shrink: 0;
}

.cv-highlight-text-faded {
    color: #94a3b8;
}

/* 3.2. Ribbon ngang full-width - nền nhạt theo theme (biến --cv-theme-sidebar-bg tái dùng làm ribbon_bg,
   đúng precedent Mục 2.2/2.3 plan.md: timeline đã tái dùng sidebar_bg cho banner_bg), DUY NHẤT nơi hiển thị Kỹ năng */
.cv-highlight-ribbon {
    background-color: var(--cv-theme-sidebar-bg, #dbeafe);
    transition: background-color 0.15s ease-in-out;
}

.cv-highlight-ribbon-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cv-theme-primary);
}

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

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

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

.cv-highlight-section-heading {
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cv-theme-primary);
    border-bottom: 2px solid var(--cv-theme-border);
    padding-bottom: 6px;
    margin-bottom: 14px;
    transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

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

/* 3.4. Card Kinh nghiệm (Cột chính) với badge ngày dạng pill */
.cv-highlight-exp-card {
    border-left: 3px solid var(--cv-theme-border);
    padding-left: 12px;
}

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

/* 3.5. Cột phụ: Học vấn, Giải thưởng, Tag pill Công việc mong muốn */
.cv-highlight-education-header {
    color: var(--cv-theme-text-dark);
}

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

.cv-highlight-award-item {
    border-left: 3px solid var(--cv-theme-border);
    padding-left: 10px;
}

.cv-highlight-tag-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid var(--cv-theme-border);
    background-color: var(--cv-primary-subtle, #dbeafe);
    color: var(--cv-theme-primary);
    font-size: 0.72rem;
    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-highlight #livePreviewReferenceSection:has(.cv-live-ref-empty) {
    display: none;
}

/* 3.6. Direct Mode (Soạn thảo trực tiếp) */
.cv-highlight-header .cv-direct-add-btn,
.cv-highlight-ribbon .cv-direct-add-btn,
.cv-highlight-main .cv-direct-add-btn,
.cv-highlight-aside .cv-direct-add-btn {
    color: var(--cv-theme-primary);
}

.cv-highlight-header .cv-direct-add-btn:hover,
.cv-highlight-ribbon .cv-direct-add-btn:hover,
.cv-highlight-main .cv-direct-add-btn:hover,
.cv-highlight-aside .cv-direct-add-btn:hover {
    background-color: var(--cv-primary-subtle, #dbeafe);
    border-color: var(--cv-theme-primary);
    color: var(--cv-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`). Ở `highlight` header trong suốt
   trên nền trắng -> ép chữ tối để không bị "vô hình" khi người dùng bấm "Thêm trình độ học vấn". */
.cv-template-highlight .cv-simple-education-header .form-control-plaintext {
    color: var(--cv-theme-text-dark) !important;
}

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

/* Direct Mode: ô nhập Kỹ năng dạng pill - kế thừa màu primary từ .cv-highlight-skill-pill cha */
.cv-highlight-skill-pill.cv-direct-skill-row {
    border-bottom: 0 !important;
}

.cv-highlight-skill-input {
    color: inherit !important;
    width: auto;
    min-width: 60px;
}

/* 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 .text-dark/.text-muted/.text-secondary)
   cho MỌI template Form Mode. Khối dưới đây ghi đè để khớp giao diện highlight (card badge ngày dạng
   pill ở Cột chính, pill kỹ năng ở Ribbon, danh sách phẳng ở Cột phụ) - theo đúng precedent đã áp dụng
   ở default.css/it.css/fresher.css/unique.css/sales.css/timeline.css. */

/* 4.1. Alias .cv-simple-timeline-card/.cv-simple-title -> tương đương .cv-highlight-exp-card/.cv-highlight-title
   (áp dụng cho Kinh nghiệm & Giải thưởng & Tham khảo) */
.cv-template-highlight .cv-simple-timeline-card {
    border-left: 3px solid var(--cv-theme-border) !important;
    padding-left: 12px;
}

.cv-template-highlight .cv-simple-title {
    color: var(--cv-theme-primary) !important;
}

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

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

/* Giải thưởng ở Cột phụ (Mục 5.1 plan.md): giữ border-left như .cv-highlight-award-item */
.cv-template-highlight #livePreviewAwardContainer .cv-simple-timeline-card {
    border-left: 3px solid var(--cv-theme-border) !important;
    padding-left: 10px;
}

/* Pill tag Nơi làm việc/Ngành nghề/Lĩnh vực: syncVSelectTags() trong create_form.blade.php dựng .cv-simple-tag-pill
   (chỉ định nghĩa trong simple.css, không được nạp ở `highlight`) -> alias về .cv-highlight-tag-pill */
.cv-template-highlight .cv-simple-tag-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid var(--cv-theme-border);
    background-color: var(--cv-primary-subtle, #dbeafe);
    color: var(--cv-theme-primary);
    font-size: 0.72rem;
    font-weight: 500;
}

/* 4.2. Khối Học vấn (JS dựng .cv-simple-education-header/-body dạng hộp badge của `simple`)
   -> chuyển thành khối phẳng chữ tối đồng bộ .cv-highlight-education-header/-body */
.cv-template-highlight .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;
}

/* Chỉ áp xếp dọc cho Form Mode (JS syncEducations dựng header "d-flex justify-content-between align-items-center").
   Phải ép align-items: flex-start !important để thắng .align-items-center (!important) của Bootstrap, nếu không
   tên trường/thời gian bị căn GIỮA theo chiều ngang. Không áp cho Direct Mode (mẫu clone #resumeEducation dùng
   chung header này chứa ô nhập + nút xóa, cần giữ hàng ngang). */
.cv-template-highlight #livePreviewEducationContainer .cv-simple-education-header {
    flex-direction: column;
    align-items: flex-start !important;
}

.cv-template-highlight .cv-simple-education-header > span:last-child {
    font-weight: 400;
}

/* Chuyên ngành do JS dựng mang .text-dark -> đồng bộ màu primary như .cv-highlight-title của bản server */
.cv-template-highlight #livePreviewEducationContainer .cv-live-edu-major {
    color: var(--cv-theme-primary) !important;
}

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

/* 4.3. Khối Kỹ năng (JS dựng hộp "col-6 bg-light border rounded" + sao .cv-simple-star/.cv-simple-star-empty)
   -> chuyển thành pill badge đồng bộ .cv-highlight-skill-pill (trong Ribbon), ẩn sao đánh giá
   (thiết kế `highlight` không hiển thị thang điểm sao) */
.cv-template-highlight .cv-live-skill-item.col-6 {
    width: auto !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
}

.cv-template-highlight .cv-live-skill-item .bg-light {
    background-color: #ffffff !important;
    border: 1px solid var(--cv-theme-border) !important;
    border-radius: 9999px !important;
    padding: 4px 14px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
}

.cv-template-highlight .cv-live-skill-item .cv-live-skill-name {
    color: var(--cv-theme-primary) !important;
}

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

/* 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-highlight {
        width: 100% !important;
        background-color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

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

    .cv-template-highlight .cv-highlight-ribbon {
        background-color: var(--cv-theme-sidebar-bg, #dbeafe) !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-highlight .break-inside-avoid,
    .cv-highlight-contact-item,
    .cv-highlight-exp-card,
    .cv-highlight-skill-pill,
    .cv-highlight-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;
    }
}
