/* ==========================================================================
   CV BUILDER - TEMPLATE VERTICAL (CHỮ DỌC)
   Á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:
   - Cột trái (~32%): Nền trắng thanh nhã, Avatar nhỏ đỉnh cột, Họ tên & Chức danh
     xoay dọc 90 độ in hoa lớn phong cách serif/editorial, Dấu trích dẫn lớn “
     màu primary/accent, Giới thiệu bản thân (Summary) bên dưới.
   - Cột phải (~68%): Phủ kín toàn bộ nền màu theme ấm áp (right_bg), Thông tin liên hệ
     inline 2 cột, Kinh nghiệm làm việc & Học vấn có đường kẻ ngang mỏng phân cách,
     Kỹ năng bullet phẳng thanh nhã (DUY NHẤT 1 lần, ẩn sao rating), Giải thưởng/Chứng chỉ,
     Mong muốn công việc & Thông tin cá nhân compact giữ trọn AC06.
   ========================================================================== */

/* 1. THEME VARIABLES CHO CÁC BẢNG MÀU CỦA TEMPLATE VERTICAL */

/* 1.1. Theme Ochre (Vàng Nghệ Ấm - Mặc định) */
.cv-template-vertical,
.cv-template-vertical[data-theme="ochre"],
[data-theme="ochre"] .cv-template-vertical,
[data-theme="ochre"]#cvVerticalComponent,
#cvVerticalComponent[data-theme="ochre"],
[data-theme="ochre"] {
    --cv-primary: #b45309;
    --cv-primary-subtle: #fffbeb;
    --cv-primary-dark: #78350f;
    --cv-primary-rgb: 180, 83, 9;
    --cv-right-bg: #fef3c7;
    --cv-accent: #d97706;
    --cv-border: #fde68a;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #fde68a;

    --cv-theme-primary: #b45309;
    --cv-theme-primary-subtle: #fffbeb;
    --cv-theme-primary-dark: #78350f;
    --cv-theme-right-bg: #fef3c7;
    --cv-theme-accent: #d97706;
    --cv-theme-border: #fde68a;
    --cv-theme-text-dark: #1e293b;
}

/* 1.2. Theme Deep Crimson (Đỏ Nhạt Quý Tộc) */
.cv-template-vertical[data-theme="deep_crimson"],
[data-theme="deep_crimson"] .cv-template-vertical,
[data-theme="deep_crimson"]#cvVerticalComponent,
#cvVerticalComponent[data-theme="deep_crimson"],
[data-theme="deep_crimson"] {
    --cv-primary: #991b1b;
    --cv-primary-subtle: #fef2f2;
    --cv-primary-dark: #7f1d1d;
    --cv-primary-rgb: 153, 27, 27;
    --cv-right-bg: #fee2e2;
    --cv-accent: #dc2626;
    --cv-border: #fecaca;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #fecaca;

    --cv-theme-primary: #991b1b;
    --cv-theme-primary-subtle: #fef2f2;
    --cv-theme-primary-dark: #7f1d1d;
    --cv-theme-right-bg: #fee2e2;
    --cv-theme-accent: #dc2626;
    --cv-theme-border: #fecaca;
    --cv-theme-text-dark: #1e293b;
}

/* 1.3. Theme Slate Dark (Xám Ấm Tối Thanh Lịch) */
.cv-template-vertical[data-theme="slate_dark"],
[data-theme="slate_dark"] .cv-template-vertical,
[data-theme="slate_dark"]#cvVerticalComponent,
#cvVerticalComponent[data-theme="slate_dark"],
[data-theme="slate_dark"] {
    --cv-primary: #334155;
    --cv-primary-subtle: #f8fafc;
    --cv-primary-dark: #0f172a;
    --cv-primary-rgb: 51, 65, 85;
    --cv-right-bg: #e2e8f0;
    --cv-accent: #475569;
    --cv-border: #cbd5e1;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #cbd5e1;

    --cv-theme-primary: #334155;
    --cv-theme-primary-subtle: #f8fafc;
    --cv-theme-primary-dark: #0f172a;
    --cv-theme-right-bg: #e2e8f0;
    --cv-theme-accent: #475569;
    --cv-theme-border: #cbd5e1;
    --cv-theme-text-dark: #1e293b;
}

/* 2. CLASS ĐỊNH HÌNH CẤU TRÚC TEMPLATE VERTICAL CHUẨN */
.cv-template-vertical {
    background-color: #ffffff;
    width: 100%;
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
    font-size: 0.85rem;
    line-height: 1.5;
    overflow: hidden;
}

.cv-vertical-layout {
    min-height: 100%;
}

/* 2.1. Cột trái (Sidebar ~32%): Nền trắng thanh nhã */
.cv-vertical-sidebar {
    width: 32%;
    min-width: 32%;
    background-color: #ffffff !important;
    border-right: 1px solid var(--cv-theme-border, #fde68a);
    box-sizing: border-box;
}

/* Avatar nhỏ ở đỉnh cột */
.cv-vertical-avatar-wrap {
    width: 84px;
    height: 84px;
}

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

.cv-vertical-avatar-placeholder {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background-color: var(--cv-theme-primary-subtle, #fffbeb);
    color: var(--cv-theme-primary, #b45309);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border: 2px solid var(--cv-theme-border, #fde68a);
}

/* Khối chữ dọc 90 độ (Vertical Writing Mode) */
.cv-vertical-name-box {
    width: 100%;
    padding: 10px 0;
}

.cv-vertical-writing-mode {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-orientation: mixed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.cv-vertical-fullname {
    font-family: "Playfair Display", "Merriweather", "Georgia", serif;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #1e293b;
    line-height: 1.1;
    white-space: nowrap;
}

.cv-vertical-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--cv-theme-primary, #b45309);
    line-height: 1.1;
    white-space: nowrap;
}

/* Dấu trích dẫn lớn “ */
.cv-vertical-quote-mark {
    font-family: "Playfair Display", "Georgia", serif;
    font-size: 4.8rem;
    font-weight: 700;
    line-height: 0.7;
    color: var(--cv-theme-primary, #b45309);
    user-select: none;
    opacity: 0.9;
}

/* Tóm tắt bản thân */
.cv-vertical-summary {
    color: #334155 !important;
    text-align: justify;
    font-size: 0.78rem !important;
    line-height: 1.55 !important;
}

/* 2.2. Cột phải (Main ~68%): Phủ kín toàn bộ nền màu theme ấm */
.cv-vertical-main {
    width: 68%;
    background-color: var(--cv-theme-right-bg, #fef3c7) !important;
    color: var(--cv-theme-text-dark, #1e293b);
    box-sizing: border-box;
}

/* Headings chuyên mục cột phải */
.cv-vertical-heading {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #1e293b;
    border-bottom: 1.5px solid var(--cv-theme-border, #fde68a);
    padding-bottom: 4px;
    margin-bottom: 12px;
}

/* Icon trong mục thông tin cá nhân */
.cv-vertical-icon {
    color: var(--cv-theme-primary, #b45309);
    font-size: 0.85rem;
}

.cv-vertical-sub-border {
    border-color: var(--cv-theme-border, #fde68a) !important;
}

/* Các dòng phân cách trong khối kinh nghiệm / học vấn / giải thưởng */
.cv-vertical-item {
    border-bottom: 1px dashed var(--cv-theme-border, #fde68a);
}

.cv-vertical-item:last-child {
    border-bottom: none;
}

.cv-vertical-item-title {
    color: #1e293b;
    font-weight: 700;
}

.cv-vertical-item-subtitle {
    color: var(--cv-theme-primary-dark, #78350f);
    font-weight: 600;
}

.cv-vertical-time {
    color: #475569 !important;
    font-weight: 500;
}

.cv-vertical-desc {
    color: #334155 !important;
    line-height: 1.5 !important;
}

/* Kỹ năng bullet phẳng thanh nhã */
.cv-vertical-bullet {
    color: var(--cv-theme-primary, #b45309);
    font-size: 1.25rem;
    line-height: 1;
}

.cv-vertical-skill-name {
    color: #1e293b;
    font-size: 0.8rem;
    font-weight: 500;
}

.cv-vertical-skill-row {
    padding: 2px 0;
}

/* Tag pills cho mong muốn công việc */
.cv-vertical-tag-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--cv-theme-border, #fde68a);
    background-color: rgba(255, 255, 255, 0.65);
    color: var(--cv-theme-primary-dark, #78350f);
    font-size: 0.75rem;
    font-weight: 500;
}

/* 3. CHẾ ĐỘ SOẠN THẢO TRỰC TIẾP (DIRECT MODE) */
.cv-template-vertical .hover-border {
    border: 1px dashed transparent !important;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.cv-template-vertical .hover-border:hover,
.cv-template-vertical .hover-border:focus {
    border-color: var(--cv-theme-primary, #b45309) !important;
    background-color: rgba(255, 255, 255, 0.85) !important;
    outline: none !important;
}

/* Ô nhập trong cột Main nền theme ấm */
.cv-template-vertical .cv-vertical-main .form-control-plaintext {
    color: #1e293b;
}

.cv-template-vertical .cv-vertical-main .form-control-plaintext::placeholder {
    color: rgba(30, 41, 59, 0.45);
}

/* Direct Mode: Nút thêm/xóa dòng */
.cv-template-vertical .cv-direct-add-btn {
    border: 1px dashed var(--cv-theme-border, #fde68a);
    background-color: rgba(255, 255, 255, 0.6);
    color: var(--cv-theme-primary-dark, #78350f);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cv-template-vertical .cv-direct-add-btn:hover {
    background-color: #ffffff;
    border-color: var(--cv-theme-primary, #b45309);
    color: var(--cv-theme-primary, #b45309);
}

.cv-template-vertical .cv-direct-remove-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    font-size: 0.85rem;
    transition: color 0.15s ease-in-out;
}

.cv-template-vertical .cv-direct-remove-btn:hover {
    color: #ef4444;
}

.cv-template-vertical .cv-avatar-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 26px;
    height: 26px;
    background-color: var(--cv-theme-primary, #b45309);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* 4. TƯƠNG THÍCH ĐỒNG BỘ JS REPEATER LIVE PREVIEW */
/* JS repeater syncAllRepeaters() dùng chung dựng lại markup cứng mang class gốc của simple (cv-simple-*)
   -> Quy tắc: Trung hòa các class này để ăn khớp với giao diện nền màu theme ấm và vạch phân cách mỏng */
.cv-template-vertical .cv-vertical-main .cv-simple-timeline-card,
.cv-template-vertical .cv-vertical-main .cv-live-exp-item,
.cv-template-vertical .cv-vertical-main .cv-live-edu-item,
.cv-template-vertical .cv-vertical-main .cv-live-award-item {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-left: none !important;
    padding-left: 0 !important;
    border-bottom: 1px dashed var(--cv-theme-border, #fde68a) !important;
}

.cv-template-vertical .cv-vertical-main .cv-simple-timeline-card:last-child {
    border-bottom: none !important;
}

.cv-template-vertical .cv-vertical-main .cv-simple-title {
    color: var(--cv-theme-primary-dark, #78350f) !important;
    font-weight: 600 !important;
}

.cv-template-vertical .cv-vertical-main .cv-simple-section-heading {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    border-bottom: 1.5px solid var(--cv-theme-border, #fde68a) !important;
    padding-bottom: 4px !important;
    margin-bottom: 12px !important;
}

/* Kỹ năng do JS dựng (JS tạo col-6 bg-light border + sao FontAwesome) -> chuyển thành bullet phẳng, ẩn sao */
.cv-template-vertical .cv-vertical-main .cv-live-skill-item.col-6 {
    width: 50% !important;
}

.cv-template-vertical .cv-vertical-main .cv-live-skill-item .bg-light {
    background-color: transparent !important;
    border: none !important;
    padding: 2px 0 !important;
}

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

.cv-template-vertical .cv-vertical-main .cv-live-skill-name::before {
    content: "• ";
    color: var(--cv-theme-primary, #b45309);
    font-weight: bold;
    font-size: 1.2rem;
    margin-right: 4px;
}

.cv-template-vertical .cv-vertical-main .cv-live-skill-name {
    color: #1e293b !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
}

.cv-template-vertical .cv-vertical-main .cv-simple-tag-pill {
    background-color: rgba(255, 255, 255, 0.65) !important;
    border: 1px solid var(--cv-theme-border, #fde68a) !important;
    color: var(--cv-theme-primary-dark, #78350f) !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
}

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

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

    .cv-template-vertical .cv-vertical-main {
        background-color: var(--cv-theme-right-bg, #fef3c7) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-vertical .cv-vertical-writing-mode {
        -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-vertical .break-inside-avoid,
    .cv-vertical-contact-item,
    .cv-vertical-skill-row,
    .cv-vertical-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,
    .cv-simple-education-card {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}
