/* ==========================================================================
   CV BUILDER - TEMPLATE CLARITY (RÕ RÀNG)
   Á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 2 cột đảo ngược:
   - Cột TRÁI (Main trắng rộng 8/12): Avatar tròn trên trái, Họ tên, Chức danh,
     Giới thiệu (dấu ngoặc kép lớn), Kinh nghiệm (timeline chấm tròn & vạch dọc)
   - Cột PHẢI (Sidebar nhạt 4/12): Nền xanh lơ nhạt, Khối Liên hệ icon tròn nhỏ,
     Học vấn / Chứng chỉ / Kỹ năng với icon tròn lớn nền primary chữ trắng
   ========================================================================== */

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

/* 1.1. Theme Cyan (Xanh lơ - Mặc định) */
.cv-template-clarity,
.cv-template-clarity[data-theme="cyan"],
[data-theme="cyan"] .cv-template-clarity,
[data-theme="cyan"]#cvClarityComponent,
#cvClarityComponent[data-theme="cyan"],
[data-theme="cyan"] {
    --cv-primary: #0284c7;
    --cv-primary-subtle: #f0f8ff;
    --cv-primary-dark: #0369a1;
    --cv-primary-rgb: 2, 132, 199;
    --cv-sidebar-bg: #f0f8ff;
    --cv-badge-icon-bg: #0284c7;
    --cv-accent: #0284c7;
    --cv-border: #bae6fd;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #bae6fd;

    --cv-theme-primary: #0284c7;
    --cv-theme-primary-subtle: #f0f8ff;
    --cv-theme-primary-dark: #0369a1;
    --cv-theme-sidebar-bg: #f0f8ff;
    --cv-theme-badge-icon-bg: #0284c7;
    --cv-theme-accent: #0284c7;
    --cv-theme-border: #bae6fd;
    --cv-theme-text-dark: #1e293b;
}

/* 1.2. Theme Mint Fresh (Xanh bạc hà tươi mát) */
.cv-template-clarity[data-theme="mint_fresh"],
[data-theme="mint_fresh"] .cv-template-clarity,
[data-theme="mint_fresh"]#cvClarityComponent,
#cvClarityComponent[data-theme="mint_fresh"],
[data-theme="mint_fresh"] {
    --cv-primary: #0d9488;
    --cv-primary-subtle: #f0fdfa;
    --cv-primary-dark: #0f766e;
    --cv-primary-rgb: 13, 148, 136;
    --cv-sidebar-bg: #f0fdfa;
    --cv-badge-icon-bg: #0d9488;
    --cv-accent: #0d9488;
    --cv-border: #99f6e4;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #99f6e4;

    --cv-theme-primary: #0d9488;
    --cv-theme-primary-subtle: #f0fdfa;
    --cv-theme-primary-dark: #0f766e;
    --cv-theme-sidebar-bg: #f0fdfa;
    --cv-theme-badge-icon-bg: #0d9488;
    --cv-theme-accent: #0d9488;
    --cv-theme-border: #99f6e4;
    --cv-theme-text-dark: #1e293b;
}

/* 1.3. Theme Indigo (Xanh chàm thanh lịch) */
.cv-template-clarity[data-theme="indigo"],
[data-theme="indigo"] .cv-template-clarity,
[data-theme="indigo"]#cvClarityComponent,
#cvClarityComponent[data-theme="indigo"],
[data-theme="indigo"] {
    --cv-primary: #4f46e5;
    --cv-primary-subtle: #eef2ff;
    --cv-primary-dark: #3730a3;
    --cv-primary-rgb: 79, 70, 229;
    --cv-sidebar-bg: #eef2ff;
    --cv-badge-icon-bg: #4f46e5;
    --cv-accent: #4f46e5;
    --cv-border: #c7d2fe;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #c7d2fe;

    --cv-theme-primary: #4f46e5;
    --cv-theme-primary-subtle: #eef2ff;
    --cv-theme-primary-dark: #3730a3;
    --cv-theme-sidebar-bg: #eef2ff;
    --cv-theme-badge-icon-bg: #4f46e5;
    --cv-theme-accent: #4f46e5;
    --cv-theme-border: #c7d2fe;
    --cv-theme-text-dark: #1e293b;
}

/* 2. Color Swatches cho Palette Buttons */
.cv-swatch-cyan {
    background-color: #0284c7;
}

.cv-swatch-mint_fresh {
    background-color: #0d9488;
}

.cv-swatch-indigo {
    background-color: #4f46e5;
}

/* 3. Class định hình cấu trúc Template Clarity chuẩn */
.cv-template-clarity {
    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. Cột Trái (Main trắng rộng 8/12) */
.cv-clarity-main {
    background-color: #ffffff;
}

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

.cv-clarity-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--cv-theme-border, #bae6fd);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.cv-clarity-avatar-placeholder {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background-color: var(--cv-primary-subtle, #f0f8ff);
    border: 2px solid var(--cv-theme-border, #bae6fd);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cv-theme-primary);
    font-size: 2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.cv-clarity-fullname {
    color: var(--cv-theme-primary, #0284c7);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.cv-clarity-title {
    color: var(--cv-theme-primary, #0284c7);
    letter-spacing: 0.3px;
}

/* Dấu ngoặc kép trích dẫn đôi lớn */
.cv-clarity-quote-mark {
    font-family: Georgia, serif;
    font-size: 2.8rem;
    line-height: 0.8;
    color: #94a3b8;
    opacity: 0.5;
    margin-bottom: -4px;
    user-select: none;
}

.cv-clarity-section-heading {
    color: var(--cv-theme-primary, #0284c7);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.85rem;
    letter-spacing: 0.3px;
}

/* Timeline kinh nghiệm làm việc: vạch dọc + chấm tròn */
.cv-clarity-timeline {
    position: relative;
    padding-left: 18px;
    border-left: 2px solid var(--cv-theme-border, #bae6fd);
    margin-left: 6px;
}

.cv-clarity-timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
}

.cv-clarity-timeline-item:last-child {
    margin-bottom: 0;
}

.cv-clarity-timeline-dot {
    position: absolute;
    left: -24px;
    top: 3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--cv-theme-primary, #0284c7);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px var(--cv-theme-primary, #0284c7);
}

.cv-clarity-company {
    color: var(--cv-theme-primary, #0284c7);
}

.cv-clarity-subtext {
    color: var(--cv-theme-primary, #0284c7);
}

/* Tag Pill cho các thẻ thành phố/ngành nghề/lĩnh vực */
.cv-clarity-tag-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--cv-theme-border, #bae6fd);
    background-color: var(--cv-primary-subtle, #f0f8ff);
    color: var(--cv-theme-primary, #0284c7);
    font-size: 0.75rem;
    font-weight: 500;
}

/* 3.2. Cột Phải (Sidebar nhạt 4/12) */
.cv-clarity-sidebar {
    background-color: var(--cv-theme-sidebar-bg, #f0f8ff);
    border-left: 1px solid var(--cv-theme-border, #bae6fd);
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

/* Khối liên hệ */
.cv-clarity-contact-item {
    margin-bottom: 6px;
}

.cv-clarity-contact-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--cv-theme-badge-icon-bg, var(--cv-theme-primary, #0284c7));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    margin-right: 10px;
}

.cv-clarity-contact-label {
    font-size: 9.5px;
    color: #64748b;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.cv-clarity-contact-val {
    font-size: 11px;
    color: #1e293b;
    font-weight: 500;
    line-height: 1.3;
}

/* Sidebar Headings với Badge Icon tròn lớn */
.cv-clarity-sidebar-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--cv-theme-primary, #0284c7);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.cv-clarity-sidebar-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--cv-theme-badge-icon-bg, var(--cv-theme-primary, #0284c7));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.cv-clarity-bullet {
    color: var(--cv-theme-primary, #0284c7);
    font-weight: bold;
    flex-shrink: 0;
}

/* Direct Mode Helper Classes */
.cv-clarity-main .cv-direct-add-btn,
.cv-clarity-sidebar .cv-direct-add-btn {
    background-color: transparent;
    border: 1px dashed var(--cv-theme-border, #bae6fd);
    color: var(--cv-theme-primary, #0284c7);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.cv-clarity-main .cv-direct-add-btn:hover,
.cv-clarity-sidebar .cv-direct-add-btn:hover {
    background-color: var(--cv-primary-subtle, #f0f8ff);
    border-color: var(--cv-theme-primary, #0284c7);
}

.cv-clarity-direct-exp-card,
.cv-clarity-direct-edu-card,
.cv-clarity-direct-award-card,
.cv-clarity-direct-ref-card {
    border-color: var(--cv-theme-border, #bae6fd) !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 mang class
   của template `simple` (hộp sáng col-6, sao đánh giá, card timeline .cv-simple-timeline-card).
   Khối dưới đây chuẩn hóa các class này trong scope .cv-template-clarity. */

/* 4.1. Alias .cv-simple-title -> màu primary */
.cv-template-clarity .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) */
.cv-template-clarity .cv-clarity-main .cv-simple-timeline-card {
    border-left: 2px solid var(--cv-theme-border) !important;
    padding-left: 14px;
    margin-bottom: 14px;
    position: relative;
    background-color: transparent !important;
}

.cv-template-clarity .cv-clarity-main .cv-simple-timeline-card::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--cv-theme-primary);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px var(--cv-theme-primary);
}

/* 4.3. Khối Giải thưởng trong Sidebar (JS chèn .cv-simple-timeline-card) */
.cv-template-clarity .cv-clarity-sidebar .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 Sidebar (JS dựng .cv-simple-education-header/-body) */
.cv-template-clarity .cv-clarity-sidebar .cv-simple-education-header {
    background-color: transparent !important;
    color: #1e293b !important;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 0 !important;
    padding: 0 !important;
    margin-bottom: 2px;
}

.cv-template-clarity .cv-clarity-sidebar .cv-simple-education-header .cv-live-edu-school {
    color: #1e293b !important;
    font-weight: 700;
}

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

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

.cv-template-clarity .cv-clarity-sidebar .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 Sidebar (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-clarity .cv-clarity-sidebar .cv-live-skill-item.col-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

.cv-template-clarity .cv-clarity-sidebar .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-clarity .cv-clarity-sidebar .cv-live-skill-item .bg-light::before {
    content: "•";
    color: var(--cv-theme-primary);
    font-weight: bold;
    flex-shrink: 0;
}

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

.cv-template-clarity .cv-clarity-sidebar .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-clarity .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, #f0f8ff);
    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-clarity {
        width: 100% !important;
        background-color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

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

    .cv-template-clarity .cv-clarity-sidebar {
        background-color: var(--cv-theme-sidebar-bg, #f0f8ff) !important;
        border-left: 1px solid var(--cv-theme-border, #bae6fd) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-clarity .cv-clarity-sidebar-icon,
    .cv-template-clarity .cv-clarity-contact-icon {
        background-color: var(--cv-theme-badge-icon-bg, var(--cv-theme-primary, #0284c7)) !important;
        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-clarity .break-inside-avoid,
    .cv-clarity-contact-item,
    .cv-clarity-skill-item,
    .cv-clarity-timeline-item,
    .cv-clarity-edu-item,
    .cv-clarity-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;
    }
}
