/* ==========================================================================
   CV BUILDER - TEMPLATE NEAT (CHỈN CHU)
   Á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 hẹp nền sáng xám-xanh nhạt (col-3: Avatar, Liên hệ, Kỹ năng
   với heading dạng thanh nền đậm bo góc) + Main rộng trắng (col-9: kiểu liệt kê
   thời gian cổ điển căn trái)
   ========================================================================== */

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

/* 1.1. Theme Ink (Mực đen chuyên nghiệp - Mặc định) */
.cv-template-neat,
.cv-template-neat[data-theme="ink"],
[data-theme="ink"] .cv-template-neat,
[data-theme="ink"]#cvNeatComponent,
#cvNeatComponent[data-theme="ink"],
[data-theme="ink"] {
    --cv-primary: #1e293b;
    --cv-primary-subtle: #f8fafc;
    --cv-primary-dark: #0f172a;
    --cv-primary-rgb: 30, 41, 59;
    --cv-sidebar-bg: #eef2f7;
    --cv-label-bar: #0f172a;
    --cv-accent: #334155;
    --cv-border: #cbd5e1;
    --cv-text-dark: #1e293b;
    --cv-mock-border: #cbd5e1;

    --cv-theme-primary: #1e293b;
    --cv-theme-sidebar-bg: #eef2f7;
    --cv-theme-label-bar: #0f172a;
    --cv-theme-accent: #334155;
    --cv-theme-border: #cbd5e1;
    --cv-theme-text-dark: #1e293b;
}

/* 1.2. Theme Lagoon (Xanh dầu / Xanh ngọc sẫm - Đổi từ teal do trùng hex toàn cục) */
.cv-template-neat[data-theme="lagoon"],
[data-theme="lagoon"] .cv-template-neat,
[data-theme="lagoon"]#cvNeatComponent,
#cvNeatComponent[data-theme="lagoon"],
[data-theme="lagoon"] {
    --cv-primary: #0f766e;
    --cv-primary-subtle: #f0fdfa;
    --cv-primary-dark: #134e4a;
    --cv-primary-rgb: 15, 118, 110;
    --cv-sidebar-bg: #ecfdf5;
    --cv-label-bar: #0f766e;
    --cv-accent: #14b8a6;
    --cv-border: #99f6e4;
    --cv-text-dark: #134e4a;
    --cv-mock-border: #99f6e4;

    --cv-theme-primary: #0f766e;
    --cv-theme-sidebar-bg: #ecfdf5;
    --cv-theme-label-bar: #0f766e;
    --cv-theme-accent: #14b8a6;
    --cv-theme-border: #99f6e4;
    --cv-theme-text-dark: #134e4a;
}

/* 1.3. Theme Wine (Đỏ vang) */
.cv-template-neat[data-theme="wine"],
[data-theme="wine"] .cv-template-neat,
[data-theme="wine"]#cvNeatComponent,
#cvNeatComponent[data-theme="wine"],
[data-theme="wine"] {
    --cv-primary: #9f1239;
    --cv-primary-subtle: #fff1f2;
    --cv-primary-dark: #881337;
    --cv-primary-rgb: 159, 18, 57;
    --cv-sidebar-bg: #fff1f2;
    --cv-label-bar: #881337;
    --cv-accent: #e11d48;
    --cv-border: #fecdd3;
    --cv-text-dark: #881337;
    --cv-mock-border: #fecdd3;

    --cv-theme-primary: #9f1239;
    --cv-theme-sidebar-bg: #fff1f2;
    --cv-theme-label-bar: #881337;
    --cv-theme-accent: #e11d48;
    --cv-theme-border: #fecdd3;
    --cv-theme-text-dark: #881337;
}

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

.cv-swatch-lagoon {
    background-color: #0f766e;
}

.cv-swatch-wine {
    background-color: #9f1239;
}

/* 3. Class định hình cấu trúc Template Neat chuẩn gốc */
.cv-template-neat {
    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 (Sidebar hẹp nhạt 3/12) */
.cv-neat-sidebar {
    background-color: var(--cv-theme-sidebar-bg, #eef2f7);
    border-right: 1px solid var(--cv-theme-border, #cbd5e1);
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

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

.cv-neat-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.cv-neat-avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background-color: var(--cv-primary-subtle, #f8fafc);
    border: 3px solid #ffffff;
    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.08);
}

/* Heading dạng thanh nền đậm bo góc trong Sidebar */
.cv-neat-sidebar-heading {
    background-color: var(--cv-theme-label-bar, var(--cv-primary-dark, #0f172a));
    color: #ffffff;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    text-align: center;
    padding: 5px 8px;
    border-radius: 3px;
    margin-bottom: 12px;
    transition: background-color 0.15s ease-in-out;
}

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

.cv-neat-skill-item {
    line-height: 1.4;
}

.cv-neat-bullet {
    color: var(--cv-theme-primary);
    font-weight: bold;
    font-size: 1rem;
    line-height: 1;
}

/* 3.2. Cột phải (Main rộng 9/12) */
.cv-neat-main {
    background-color: #ffffff;
}

.cv-neat-fullname {
    color: var(--cv-primary-dark, #0f172a);
    letter-spacing: 0.5px;
}

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

.cv-neat-section-heading {
    color: var(--cv-primary-dark, #0f172a);
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.cv-neat-title {
    color: var(--cv-theme-primary);
}

.cv-neat-exp-time,
.cv-neat-edu-time {
    font-size: 0.75rem;
    line-height: 1.4;
}

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

/* 3.3. Direct Mode Styles */
.cv-neat-sidebar .cv-direct-add-btn,
.cv-neat-main .cv-direct-add-btn {
    color: var(--cv-theme-primary);
    background: transparent;
    border: 1px dashed var(--cv-theme-primary);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.cv-neat-sidebar .cv-direct-add-btn:hover,
.cv-neat-main .cv-direct-add-btn:hover {
    background-color: var(--cv-primary-subtle, #f8fafc);
    border-color: var(--cv-theme-primary);
    color: var(--cv-primary-dark, #0f172a);
}

.cv-neat-direct-exp-card,
.cv-neat-direct-edu-card,
.cv-neat-direct-award-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 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-neat. */

/* 4.1. Alias .cv-simple-title -> màu primary trên nền sáng */
.cv-template-neat .cv-simple-title {
    color: var(--cv-theme-primary) !important;
}

/* 4.2. Khối Kinh nghiệm & Giải thưởng (JS chèn .cv-simple-timeline-card) */
.cv-template-neat .cv-simple-timeline-card {
    border-left: 2px solid var(--cv-theme-border) !important;
    padding-left: 10px;
    margin-bottom: 14px;
    background-color: transparent !important;
}

/* 4.3. Khối Học vấn (JS dựng .cv-simple-education-header/-body) */
.cv-template-neat .cv-simple-education-header {
    background-color: transparent !important;
    color: #0f172a !important;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 0 !important;
    padding: 0 !important;
    margin-bottom: 2px;
}

.cv-template-neat .cv-simple-education-header .cv-live-edu-school {
    color: #0f172a !important;
    font-weight: 700;
}

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

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

.cv-template-neat .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 hẹp nhạt (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-neat .cv-neat-sidebar .cv-live-skill-item.col-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

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

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

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

/* 4.5. Tag pill Nơi làm việc/Ngành nghề/Lĩnh vực từ syncVSelectTags() */
.cv-template-neat .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, #f8fafc);
    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-neat {
        width: 100% !important;
        background-color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-template-neat .cv-neat-sidebar {
        background-color: var(--cv-theme-sidebar-bg, #eef2f7) !important;
        border-right: 1px solid var(--cv-theme-border, #cbd5e1) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

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

    .cv-template-neat .cv-neat-sidebar-heading {
        background-color: var(--cv-theme-label-bar, var(--cv-primary-dark, #0f172a)) !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-neat .break-inside-avoid,
    .cv-neat-contact-item,
    .cv-neat-skill-item,
    .cv-neat-exp-item,
    .cv-neat-edu-item,
    .cv-neat-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;
    }
}
