/* ========================================
   CV Template - Nguyễn Văn Chung
   Modern, clean, print-friendly design
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Colors - Professional palette */
    --color-primary: #1e3a5f;
    --color-primary-light: #2d5a8a;
    --color-secondary: #0f766e;
    --color-accent: #e85d04;
    --color-text: #1f2937;
    --color-text-light: #4b5563;
    --color-text-muted: #6b7280;
    --color-background: #ffffff;
    --color-surface: #f8fafc;
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;
    --color-sidebar-bg: #1e3a5f;
    --color-sidebar-text: #f1f5f9;
    --color-sidebar-muted: #94a3b8;
    --color-tag-bg: #dbeafe;
    --color-tag-text: #1e40af;
    --color-success: #059669;
    --color-error: #dc2626;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 15px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 22px;
    --font-size-3xl: 28px;
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --line-height-tight: 1.3;
    --line-height-normal: 1.6;
    --line-height-relaxed: 1.8;

    /* Layout */
    --sidebar-width: 280px;
    --container-max-width: 900px;
    --border-radius: 6px;
    --border-radius-lg: 10px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-surface);
    min-height: 100vh;
}

/* Container */
.cv-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    max-width: var(--container-max-width);
    margin: 0 auto;
    min-height: 100vh;
    box-shadow: var(--shadow-lg);
    background: var(--color-background);
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
    position: relative;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-secondary));
}

/* Profile Section */
.profile-section {
    text-align: center;
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-accent), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    color: white;
    box-shadow: var(--shadow-md);
}

.name {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

.title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--color-sidebar-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Sidebar Sections */
.sidebar h2 {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Contact List */
.contact-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.contact-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

.contact-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--color-accent);
    margin-top: 2px;
}

.contact-list a {
    color: var(--color-sidebar-text);
    text-decoration: none;
    transition: color var(--transition-fast);
    word-break: break-all;
}

.contact-list a:hover {
    color: var(--color-accent);
}

/* Skills */
.skill-category {
    margin-bottom: var(--space-lg);
}

.skill-category h3 {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-sidebar-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.skill-tags li {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-sidebar-text);
    padding: 4px 10px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    transition: background var(--transition-fast);
}

.skill-tags li:hover {
    background: var(--color-accent);
}

/* Languages */
.language-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.language-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-sm);
}

.proficiency {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    padding: 2px 8px;
    border-radius: var(--border-radius);
    text-transform: capitalize;
}

.proficiency.native {
    background: var(--color-accent);
    color: white;
}

.proficiency.fluent {
    background: var(--color-secondary);
    color: white;
}

.proficiency.basic {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-sidebar-muted);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    padding: var(--space-xl) var(--space-xl) var(--space-2xl);
}

.section {
    margin-bottom: var(--space-xl);
}

.section h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--color-primary);
    position: relative;
}

.section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--color-accent);
}

/* Objective */
.objective {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-light);
    text-align: justify;
}

/* Experience */
.experience-item {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border-light);
}

.experience-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.experience-header h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    line-height: var(--line-height-tight);
}

.company {
    font-size: var(--font-size-base);
    color: var(--color-primary);
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-xs);
}

.experience-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
    text-align: right;
    flex-shrink: 0;
}

.experience-meta .date {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-light);
    background: var(--color-surface);
    padding: 4px 10px;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

.experience-meta .location {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.experience-details {
    list-style: none;
    margin-bottom: var(--space-md);
}

.experience-details li {
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    color: var(--color-text-light);
}

.experience-details li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid var(--color-background);
    box-shadow: 0 0 0 2px var(--color-primary);
}

.experience-details li:last-child {
    margin-bottom: 0;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tech-stack span {
    background: var(--color-tag-bg);
    color: var(--color-tag-text);
    padding: 4px 10px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
}

/* Projects */
.project-item {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.project-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.project-header h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.project-type {
    background: var(--color-primary);
    color: white;
    padding: 2px 8px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-md);
}

.project-highlights {
    list-style: none;
    margin-bottom: var(--space-md);
}

.project-highlights li {
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.project-highlights li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: var(--font-weight-bold);
}

.project-highlights li:last-child {
    margin-bottom: 0;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.project-tech span {
    background: var(--color-tag-bg);
    color: var(--color-tag-text);
    padding: 4px 10px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
}

/* Education */
.education-item {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
}

.education-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.education-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-xs);
    flex-wrap: wrap;
}

.education-header h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.school {
    font-size: var(--font-size-base);
    color: var(--color-primary);
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-xs);
}

.education-header .date {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-light);
    background: var(--color-surface);
    padding: 4px 10px;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}

.education-details {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    font-style: italic;
}

/* Achievements */
.achievement-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.achievement-list li {
    padding: var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    color: var(--color-text-light);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.achievement-list li:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.achievement-list strong {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .cv-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: var(--space-lg);
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-xl);
    }

    .profile-section {
        flex: 1;
        min-width: 200px;
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 0;
        padding-right: var(--space-xl);
    }

    .avatar-placeholder {
        width: 80px;
        height: 80px;
    }

    .name {
        font-size: var(--font-size-xl);
    }

    .sidebar > div:not(.profile-section) {
        flex: 1;
        min-width: 200px;
    }

    .main-content {
        padding: var(--space-lg);
    }

    .experience-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .experience-meta {
        align-items: flex-start;
        text-align: left;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .achievement-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-base: 14px;
        --font-size-lg: 15px;
        --font-size-xl: 17px;
        --font-size-2xl: 22px;
    }

    .sidebar {
        flex-direction: column;
    }

    .profile-section {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-right: 0;
        padding-bottom: var(--space-lg);
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    @page {
        margin: 1cm;
        size: A4;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: white;
        font-size: 12pt;
    }

    .cv-container {
        display: grid;
        grid-template-columns: 240px 1fr;
        box-shadow: none;
        max-width: none;
        min-height: auto;
    }

    .sidebar {
        page-break-inside: avoid;
        background: var(--color-sidebar-bg) !important;
        padding: 1.5cm 1cm;
    }

    .sidebar::before {
        display: none;
    }

    .main-content {
        padding: 1.5cm 1.5cm 2cm;
    }

    .section {
        page-break-inside: avoid;
        margin-bottom: 1.5em;
    }

    .experience-item,
    .project-item,
    .education-item {
        page-break-inside: avoid;
    }

    .project-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--color-border);
    }

    .achievement-list {
        break-inside: avoid;
    }

    a {
        text-decoration: none;
        color: inherit;
    }

    .skill-tags li,
    .tech-stack span,
    .project-tech span {
        border: 1px solid currentColor;
        background: transparent !important;
    }

    .experience-meta .date,
    .education-header .date {
        border: 1px solid currentColor;
        background: transparent !important;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --color-border: #000;
        --color-text-light: #000;
        --color-text-muted: #333;
    }
}

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Selection */
::selection {
    background: var(--color-accent);
    color: white;
}