/* ==========================================================================
   CV BUILDER - TEMPLATE GEOMETRIC (HÌNH KHỐI)
   Á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: Sidebar 4/12 cắt vát chéo góc 45 độ (mảng màu đặc phía trên + nền xám-xanh
   phía dưới) với Avatar tròn viền trắng đè đúng giao điểm vát chéo, Học vấn timeline
   dọc, Kỹ năng thanh bar level + Main 8/12 trắng (Tóm tắt, Kinh nghiệm timeline
   chấm tròn, Giải thưởng, Mong muốn công việc)
   ========================================================================== */

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

/* 1.1. Theme Cobalt Angle (Xanh coban vát chéo - Mặc định) */
.cv-template-geometric,
.cv-template-geometric[data-theme="cobalt_angle"],
[data-theme="cobalt_angle"] .cv-template-geometric,
[data-theme="cobalt_angle"]#cvGeometricComponent,
#cvGeometricComponent[data-theme="cobalt_angle"],
[data-theme="cobalt_angle"] {
    --cv-primary: #1e40af;
    --cv-primary-subtle: #eff6ff;
    --cv-primary-dark: #1e3a8a;
    --cv-primary-rgb: 30, 64, 175;
    --cv-sidebar-top-bg: #1e40af;
    --cv-sidebar-bottom-bg: #f1f5f9;
    --cv-accent: #1e40af;
    --cv-border: #cbd5e1;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #cbd5e1;

    --cv-theme-primary: #1e40af;
    --cv-theme-primary-subtle: #eff6ff;
    --cv-theme-primary-dark: #1e3a8a;
    --cv-theme-sidebar-top-bg: #1e40af;
    --cv-theme-sidebar-bottom-bg: #f1f5f9;
    --cv-theme-accent: #1e40af;
    --cv-theme-border: #cbd5e1;
    --cv-theme-text-dark: #1e293b;
}

/* 1.2. Theme Forest Angle (Xanh rừng vát chéo) */
.cv-template-geometric[data-theme="forest_angle"],
[data-theme="forest_angle"] .cv-template-geometric,
[data-theme="forest_angle"]#cvGeometricComponent,
#cvGeometricComponent[data-theme="forest_angle"],
[data-theme="forest_angle"] {
    --cv-primary: #065f46;
    --cv-primary-subtle: #ecfdf5;
    --cv-primary-dark: #064e3b;
    --cv-primary-rgb: 6, 95, 70;
    --cv-sidebar-top-bg: #065f46;
    --cv-sidebar-bottom-bg: #f0fdf4;
    --cv-accent: #065f46;
    --cv-border: #a7f3d0;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #a7f3d0;

    --cv-theme-primary: #065f46;
    --cv-theme-primary-subtle: #ecfdf5;
    --cv-theme-primary-dark: #064e3b;
    --cv-theme-sidebar-top-bg: #065f46;
    --cv-theme-sidebar-bottom-bg: #f0fdf4;
    --cv-theme-accent: #065f46;
    --cv-theme-border: #a7f3d0;
    --cv-theme-text-dark: #1e293b;
}

/* 1.3. Theme Slate Angle (Xám chì vát chéo) */
.cv-template-geometric[data-theme="slate_angle"],
[data-theme="slate_angle"] .cv-template-geometric,
[data-theme="slate_angle"]#cvGeometricComponent,
#cvGeometricComponent[data-theme="slate_angle"],
[data-theme="slate_angle"] {
    --cv-primary: #334155;
    --cv-primary-subtle: #f1f5f9;
    --cv-primary-dark: #1e293b;
    --cv-primary-rgb: 51, 65, 85;
    --cv-sidebar-top-bg: #334155;
    --cv-sidebar-bottom-bg: #f8fafc;
    --cv-accent: #334155;
    --cv-border: #cbd5e1;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #cbd5e1;

    --cv-theme-primary: #334155;
    --cv-theme-primary-subtle: #f1f5f9;
    --cv-theme-primary-dark: #1e293b;
    --cv-theme-sidebar-top-bg: #334155;
    --cv-theme-sidebar-bottom-bg: #f8fafc;
    --cv-theme-accent: #334155;
    --cv-theme-border: #cbd5e1;
    --cv-theme-text-dark: #1e293b;
}

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

.cv-swatch-forest_angle {
    background-color: #065f46;
}

.cv-swatch-slate_angle {
    background-color: #334155;
}

/* 3. Class định hình cấu trúc Template Geometric chuẩn */
.cv-template-geometric {
    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. Sidebar cắt vát chéo góc */
.cv-geometric-sidebar {
    background-color: var(--cv-theme-sidebar-bottom-bg, #f1f5f9);
    overflow: hidden;
    transition: background-color 0.15s ease-in-out;
}

.cv-geometric-sidebar-angle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 160px;
    background-color: var(--cv-theme-sidebar-top-bg, #1e40af);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 62%);
    transition: background-color 0.15s ease-in-out;
}

.cv-geometric-sidebar-body {
    position: relative;
    z-index: 1;
    padding-top: 28px;
}

.cv-geometric-avatar-wrap {
    position: relative;
    width: 104px;
    height: 104px;
    margin-top: 30px;
    margin-bottom: 12px;
}

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

.cv-geometric-avatar-placeholder {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background-color: var(--cv-theme-primary-subtle, #eff6ff);
    border: 4px solid #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cv-theme-primary);
    font-size: 2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.cv-geometric-fullname {
    color: var(--cv-theme-text-dark, #1e293b);
    letter-spacing: 0.4px;
}

.cv-geometric-role {
    color: #64748b;
}

.cv-geometric-sidebar-heading {
    color: var(--cv-theme-primary);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--cv-theme-border);
    transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.cv-geometric-contact-item {
    line-height: 1.4;
}

.cv-geometric-title {
    color: var(--cv-theme-primary);
    transition: color 0.15s ease-in-out;
}

/* 3.2. Học vấn & Kinh nghiệm: Timeline dọc thanh mảnh + chấm tròn */
.cv-geometric-timeline-row {
    position: relative;
    padding-left: 16px;
    padding-bottom: 2px;
    border-left: 2px solid var(--cv-theme-border);
}

.cv-geometric-timeline-dot {
    position: absolute;
    left: -6px;
    top: 2px;
    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-border);
}

/* 3.3. Kỹ năng: thanh bar level ngang */
.cv-geometric-skill-bar-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background-color: #e2e8f0;
    overflow: hidden;
}

.cv-geometric-skill-bar-fill {
    height: 100%;
    border-radius: 3px;
    background-color: var(--cv-theme-primary);
    transition: background-color 0.15s ease-in-out, width 0.15s ease-in-out;
}

/* Mức độ kỹ năng rời rạc 1-5 (tương đồng config('web.resume.level_star')), tránh inline style width động */
.cv-geometric-skill-level-1 { width: 20%; }
.cv-geometric-skill-level-2 { width: 40%; }
.cv-geometric-skill-level-3 { width: 60%; }
.cv-geometric-skill-level-4 { width: 80%; }
.cv-geometric-skill-level-5 { width: 100%; }

/* 3.4. Main trắng (Tóm tắt, Kinh nghiệm, Giải thưởng, Mong muốn) */
.cv-geometric-main {
    background-color: #ffffff;
}

.cv-geometric-section-heading {
    color: var(--cv-theme-primary);
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 12px;
    transition: color 0.15s ease-in-out;
}

.cv-geometric-award-item {
    padding-bottom: 2px;
}

.cv-geometric-tag-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--cv-theme-border);
    background-color: var(--cv-theme-primary-subtle, #eff6ff);
    color: var(--cv-theme-primary);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Khối Tham khảo: ẩn khi rỗng cũng đồng bộ qua CSS cho an toàn khi JS dựng lại */
.cv-template-geometric #livePreviewReferenceSection:has(.cv-live-ref-empty) {
    display: none;
}

/* 3.5. Direct Mode (Soạn thảo trực tiếp): Họ tên/Tiêu đề CV nằm ở vùng nền sáng dưới
   avatar (không đè lên mảng vát chéo tối) nên giữ nguyên màu chữ tối chuẩn, không cần
   ghi đè riêng như các template có banner tối (sales/executive). */
.cv-geometric-sidebar .cv-direct-add-btn,
.cv-geometric-main .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-geometric-sidebar .cv-direct-add-btn:hover,
.cv-geometric-main .cv-direct-add-btn:hover {
    background-color: var(--cv-theme-primary-subtle, #eff6ff);
    border-color: var(--cv-theme-primary);
    color: var(--cv-theme-primary-dark);
}

.cv-geometric-direct-exp-card,
.cv-geometric-direct-edu-card,
.cv-geometric-direct-award-card,
.cv-geometric-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 geometric (timeline chấm tròn + thanh bar kỹ năng). */

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

.cv-template-geometric .cv-geometric-main .cv-simple-timeline-card.cv-live-exp-item::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 2px;
    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-border);
}

/* 4.2b. Khối Giải thưởng trong Main (JS chèn .cv-simple-timeline-card.cv-live-award-item)
   -> component thật (geometric.blade.php) KHÔNG vẽ chấm tròn/đường kẻ timeline cho Giải thưởng,
   nên ghi đè phẳng để Form Mode Live Preview khớp đúng bản render cuối. */
.cv-template-geometric .cv-geometric-main .cv-simple-timeline-card.cv-live-award-item {
    position: static;
    border-left: 0 !important;
    padding-left: 0 !important;
    margin-bottom: 10px !important;
    background-color: transparent !important;
}

.cv-template-geometric .cv-geometric-main .cv-simple-timeline-card.cv-live-award-item::before {
    content: none;
}

/* 4.3. Khối Học vấn trong Sidebar (JS dựng .cv-simple-education-header/-body) -> timeline chấm tròn mảnh */
.cv-template-geometric .cv-geometric-sidebar .cv-simple-education-header {
    background-color: transparent !important;
    color: var(--cv-theme-text-dark) !important;
    font-weight: 700;
    font-size: 0.78rem;
    border-radius: 0 !important;
    padding: 0 0 0 16px !important;
    margin-bottom: 2px;
    position: relative;
    border-left: 2px solid var(--cv-theme-border);
}

.cv-template-geometric .cv-geometric-sidebar .cv-simple-education-header::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 2px;
    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-border);
}

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

.cv-template-geometric .cv-geometric-sidebar .cv-simple-education-header .cv-live-edu-time {
    color: #64748b !important;
    font-size: 0.7rem !important;
}

.cv-template-geometric .cv-geometric-sidebar .cv-simple-education-body {
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 0 8px 16px !important;
    border-left: 2px solid var(--cv-theme-border);
    margin-left: 0;
    font-size: 0.7rem !important;
}

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

/* 4.4. Khối Kỹ năng trong Sidebar (JS dựng hộp "col-6 bg-light border" + sao FontAwesome)
   -> chuẩn hóa thành danh sách 100% chiều rộng, tái sử dụng chính hệ sao JS đã dựng
   (đổi màu theo theme) thay cho thanh bar (JS không có dữ liệu để tính % độ rộng động). */
.cv-template-geometric .cv-geometric-sidebar .cv-live-skill-item.col-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

.cv-template-geometric .cv-geometric-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: center !important;
    justify-content: space-between !important;
    gap: 6px;
}

.cv-template-geometric .cv-geometric-sidebar .cv-live-skill-stars .fa-solid {
    color: var(--cv-theme-primary) !important;
    font-size: 0.65rem !important;
}

.cv-template-geometric .cv-geometric-sidebar .cv-live-skill-stars .fa-regular {
    color: var(--cv-theme-border) !important;
    font-size: 0.65rem !important;
}

.cv-template-geometric .cv-geometric-sidebar .cv-live-skill-name {
    color: #1e293b !important;
    font-size: 0.72rem !important;
}

/* 4.5. Tag pill Nơi làm việc/Ngành nghề/Lĩnh vực từ syncVSelectTags() */
.cv-template-geometric .cv-simple-tag-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--cv-theme-border);
    background-color: var(--cv-theme-primary-subtle, #eff6ff);
    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-geometric {
        width: 100% !important;
        background-color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-geometric .cv-geometric-sidebar {
        background-color: var(--cv-theme-sidebar-bottom-bg, #f1f5f9) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-geometric .cv-geometric-sidebar-angle {
        background-color: var(--cv-theme-sidebar-top-bg, #1e40af) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-geometric .cv-geometric-main {
        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-geometric .break-inside-avoid,
    .cv-geometric-contact-item,
    .cv-geometric-skill-item,
    .cv-geometric-timeline-row,
    .cv-geometric-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;
    }
}
