/* ========================================
   CV Styles - Modern Professional Design
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Colors - Light Theme */
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-secondary: #64748b;
    --color-accent: #0ea5e9;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-bg-sidebar: #0f172a;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-text-sidebar: #e2e8f0;
    --color-text-sidebar-muted: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-sidebar: #1e293b;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;

    --sidebar-width: 280px;
    --header-height: 64px;
    --container-max: 900px;
}

/* Dark Theme */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0f172a;
        --color-bg-alt: #1e293b;
        --color-bg-sidebar: #020617;
        --color-text: #f1f5f9;
        --color-text-light: #94a3b8;
        --color-border: #334155;
        --color-primary-light: #1e3a5f;
    }
}

/* 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-sans);
    font-size: 0.9375rem; /* 15px */
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 0.75rem; }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

ul { list-style: none; }

img { max-width: 100%; height: auto; display: block; }

svg { display: block; }

/* ContentEditable Styling */
[contenteditable="true"] {
    outline: none;
    transition: background-color var(--transition-fast);
}

[contenteditable="true"]:focus,
[contenteditable="true"]:hover {
    background-color: var(--color-primary-light);
    border-radius: var(--radius-sm);
}

[contenteditable="true"]:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-light);
    opacity: 0.6;
}

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

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    background: var(--color-bg-sidebar);
    color: var(--color-text-sidebar);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
}

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

.profile-section {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border-sidebar);
}

.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: box-shadow var(--transition-base);
}

.avatar-wrapper:hover {
    box-shadow: var(--shadow-xl);
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--color-primary);
    box-sizing: border-box;
    transition: transform var(--transition-base);
}

.avatar:hover {
    transform: scale(1.05);
}

.avatar:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}


.avatar-wrapper {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: box-shadow var(--transition-base);
}


.avatar-edit:hover {
    background: var(--color-primary-dark);
    transform: scale(1.1);
}

.name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--color-text-sidebar);
}

.title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: left;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text-sidebar-muted);
    font-size: 0.8125rem;
    transition: color var(--transition-fast);
}

.contact-item:hover {
    color: var(--color-text-sidebar);
    text-decoration: none;
}

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

.contact-item a {
    color: inherit;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.contact-item a:hover {
    color: var(--color-accent);
    text-decoration: none;
}

/* Sidebar Sections */
.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    width: 20px;
    height: 2px;
    background: var(--color-accent);
}

/* Skills */
.skills-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.skill-category-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-sidebar);
    margin-bottom: 0.5rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.skill-tag {
    background: var(--color-border-sidebar);
    color: var(--color-text-sidebar-muted);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: default;
}

.skill-tag:hover,
.skill-tag:focus {
    background: var(--color-primary);
    color: white;
}

/* Languages */
.languages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.language-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lang-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.lang-level {
    display: flex;
    gap: 2px;
}

.lang-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border-sidebar);
    transition: background var(--transition-fast);
}

.lang-dot.filled {
    background: var(--color-primary);
    box-shadow: 0 0 8px var(--color-primary);
}

/* Interests */
.interests {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.interest-tag {
    background: var(--color-border-sidebar);
    color: var(--color-text-sidebar-muted);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    transition: all var(--transition-fast);
}

.interest-tag:hover {
    background: var(--color-accent);
    color: var(--color-bg-sidebar);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    padding: 2.5rem 3rem;
    overflow-y: auto;
}

.section {
    margin-bottom: 3rem;
}

.section:last-child {
    margin-bottom: 0;
}

.section-title-main {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
    position: relative;
}

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

/* Summary */
.summary {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-text-light);
    max-width: 700px;
}

/* ========================================
   Timeline (Experience)
   ======================================== */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--color-primary), var(--color-accent));
}

.timeline-item {
    position: relative;
    padding-bottom: 2.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -1.5rem;
    top: 0.125rem;
    width: 14px;
    height: 14px;
    background: var(--color-bg);
    border: 3px solid var(--color-primary);
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 0 4px var(--color-bg), 0 0 0 6px var(--color-primary-light);
}

.timeline-content {
    background: var(--color-bg-alt);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.timeline-content:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-light);
}

.timeline-header {
    margin-bottom: 0.5rem;
}

.job-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.company {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-primary);
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    color: var(--color-text-light);
}

.timeline-meta .date::before {
    content: '📅 ';
}

.timeline-meta .location::before {
    content: '📍 ';
}

.job-description {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

.job-description li {
    position: relative;
    padding-left: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-light);
    line-height: 1.6;
}

.job-description li::before {
    content: '▸';
    position: absolute;
    left: -1.25rem;
    color: var(--color-primary);
    font-weight: bold;
}

.job-description li:last-child {
    margin-bottom: 0;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tech-tag {
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
}

/* ========================================
   Projects Grid
   ======================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-light);
}

.project-image {
    height: 140px;
    width: 100%;
}

.project-content {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.project-desc {
    font-size: 0.875rem;
    color: var(--color-text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.project-links {
    display: flex;
    gap: 1rem;
}

.project-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
    transition: all var(--transition-fast);
}

.project-link:hover {
    background: var(--color-primary);
    color: white;
    text-decoration: none;
}

/* ========================================
   Education
   ======================================== */
.education-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.education-item {
    display: flex;
    gap: 1.25rem;
    padding: 1.5rem;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.education-item:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}

.education-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    opacity: 0.8;
}

.education-content {
    flex: 1;
}

.degree {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.school {
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.education-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-light);
}

.education-meta .date::before {
    content: '📅 ';
}

.education-meta .grade::before {
    content: '📊 ';
}

.education-desc {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0;
}

/* ========================================
   Certificates
   ======================================== */
.certificates {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cert-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.cert-item:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.cert-icon {
    font-size: 2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.cert-content h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.cert-content p {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    margin-bottom: 0;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    @page {
        margin: 0;
        size: A4;
    }

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

    .sidebar {
        padding: 1.5rem 1rem;
        background: #0f172a !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

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

    .section {
        margin-bottom: 2rem;
        break-inside: avoid;
    }

    .timeline-item {
        break-inside: avoid;
        padding-bottom: 1.5rem;
    }

    .project-card {
        break-inside: avoid;
    }

    .education-item,
    .cert-item {
        break-inside: avoid;
    }

    .avatar-edit,
    .contact-item a[href^="mailto:"]::after,
    .contact-item a[href^="tel:"]::after,
    .contact-item a[href*="linkedin"]::after,
    .contact-item a[href*="github"]::after {
        display: none;
    }

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

    a[href]::after {
        content: none !important;
    }

    [contenteditable="true"] {
        background: transparent !important;
    }

    .skill-tag,
    .tech-tag,
    .project-link {
        border: 1px solid currentColor !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .lang-dot.filled {
        background: var(--color-primary) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 900px) {
    .cv-container {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .sidebar {
        padding: 2rem 1.5rem;
        border-radius: 0;
    }

    .sidebar::before {
        height: 3px;
    }

    .profile-section {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .avatar-wrapper {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        overflow: hidden;
    }

    .name {
        font-size: 1.375rem;
    }

    .contact-info {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        text-align: center;
    }

    .contact-item {
        font-size: 0.75rem;
    }

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

    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .cv-container {
        box-shadow: none;
    }

    .sidebar {
        padding: 1.5rem 1rem;
    }

    .contact-info {
        flex-direction: column;
        align-items: center;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .section-title-main {
        font-size: 1.125rem;
    }

    .timeline {
        padding-left: 1rem;
    }

    .timeline::before {
        left: 4px;
    }

    .timeline-marker {
        left: -1rem;
        width: 10px;
        height: 10px;
    }

    .timeline-content {
        padding: 1rem;
    }

    .education-item,
    .cert-item {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .education-icon,
    .cert-icon {
        align-self: center;
    }

    .timeline-meta {
        flex-direction: column;
        gap: 0.375rem;
    }

    .education-meta {
        flex-direction: column;
        gap: 0.375rem;
    }
}

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

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --color-border: #000;
        --color-border-sidebar: #fff;
    }

    .skill-tag,
    .tech-tag,
    .project-link {
        border: 2px solid currentColor;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.5rem; }
.mt-6 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.5rem; }
.mb-6 { margin-bottom: 2rem; }