/* ===== VARIABLES & THEME ===== */
:root {
    --sidebar-width: 300px;
    --topbar-height: 60px;
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    --transition: 0.3s ease;
    --radius: 10px;
    --radius-sm: 6px;
}

[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-tag: #eff6ff;
    --bg-tag-hover: #dbeafe;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-sidebar: #e2e8f0;
    --text-sidebar-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #dbeafe;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    --tag-text: #1e40af;
    --timeline-line: #e2e8f0;
    --timeline-dot: #3b82f6;
    --scrollbar-track: #f1f5f9;
    --scrollbar-thumb: #cbd5e1;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --bg-sidebar-hover: #0f172a;
    --bg-tag: #1e3a5f;
    --bg-tag-hover: #1e40af;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-sidebar: #e2e8f0;
    --text-sidebar-muted: #64748b;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-light: #1e3a5f;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.3);
    --tag-text: #93c5fd;
    --timeline-line: #334155;
    --timeline-dot: #60a5fa;
    --scrollbar-track: #1e293b;
    --scrollbar-thumb: #475569;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
}

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

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

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition), background var(--transition);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.menu-close {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.menu-close:hover {
    background: var(--bg-sidebar-hover);
}

/* Sidebar Header */
.sidebar-header {
    padding: 32px 24px 24px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    margin-bottom: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.sidebar-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.sidebar-name {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.sidebar-tagline {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 8px;
}

.sidebar-location {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-sidebar-muted);
    margin-bottom: 16px;
}

.sidebar-location svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sidebar-socials {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: var(--text-sidebar);
    transition: all var(--transition);
}
.social-link:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    text-decoration: none;
}
.social-link svg {
    width: 18px;
    height: 18px;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 20px 16px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-sidebar-muted);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
    text-decoration: none;
}

.sidebar-nav a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 2px;
    transition: transform var(--transition);
}

.sidebar-nav a:hover {
    color: var(--text-sidebar);
    background: var(--bg-sidebar-hover);
}

.sidebar-nav a.active {
    color: white;
    background: var(--bg-sidebar-hover);
}

.sidebar-nav a.active::before {
    transform: translateY(-50%) scaleY(1);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    gap: 8px;
}

.btn-download {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
}
.btn-download:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-theme {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-theme:hover {
    background: rgba(255,255,255,0.15);
}

[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ===== TOPBAR (Mobile) ===== */
.topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 90;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.topbar-name {
    font-weight: 700;
    font-size: 1.05rem;
}

.btn-theme-mobile {
    background: transparent;
    width: 36px;
    height: 36px;
}

.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 95;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.menu-overlay.active {
    display: block;
}

/* ===== MAIN CONTENT ===== */
.content {
    margin-left: var(--sidebar-width);
    padding: 40px 48px;
    min-height: 100vh;
    max-width: calc(var(--sidebar-width) + 900px);
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    color: var(--text-muted);
    gap: 16px;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== SECTIONS ===== */
.section {
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.section-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow);
    transition: background var(--transition), box-shadow var(--transition);
    border: 1px solid var(--border);
}

.section-card:hover {
    box-shadow: var(--shadow-lg);
}

/* About section */
.section-about p {
    font-size: 1.02rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ===== TIMELINE (Experience / Education) ===== */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--timeline-line);
}

.timeline-entry {
    position: relative;
    margin-bottom: 32px;
}

.timeline-entry:last-child {
    margin-bottom: 0;
}

.timeline-entry::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--bg-card);
    border: 2px solid var(--timeline-dot);
    border-radius: 50%;
    z-index: 1;
    transition: background var(--transition);
}

.timeline-entry:hover::before {
    background: var(--timeline-dot);
}

.entry-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.entry-org {
    font-weight: 400;
    color: var(--accent);
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.entry-meta svg {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 4px;
}

.timeline-entry ul {
    list-style: none;
    padding: 0;
}

.timeline-entry li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.93rem;
}

.timeline-entry li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

/* ===== SKILLS / TAGS ===== */
.skills-group {
    margin-bottom: 20px;
}

.skills-group:last-child {
    margin-bottom: 0;
}

.skills-category {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-tag {
    display: inline-block;
    padding: 5px 14px;
    background: var(--bg-tag);
    color: var(--tag-text);
    border-radius: 20px;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all var(--transition);
    cursor: default;
}

.skill-tag:hover {
    background: var(--bg-tag-hover);
    transform: translateY(-1px);
}

/* ===== PROJECTS ===== */
.project-entry {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.project-entry:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.project-title {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.project-link {
    font-size: 0.84rem;
    margin-bottom: 8px;
}

.project-link a::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    vertical-align: -2px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") center/contain no-repeat;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.project-entry ul {
    list-style: none;
    padding: 0;
}

.project-entry li {
    position: relative;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.project-entry li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

/* ===== LANGUAGES / INTERESTS (simple list) ===== */
.simple-list {
    list-style: none;
    padding: 0;
}

.simple-list li {
    position: relative;
    padding: 8px 0 8px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
}

.simple-list li:last-child {
    border-bottom: none;
}

.simple-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

.simple-list strong {
    color: var(--text-primary);
}

/* ===== FOOTER ===== */
.cv-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .content {
        padding: 40px 32px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-close {
        display: block;
    }

    .topbar {
        display: flex;
    }

    .content {
        margin-left: 0;
        padding: calc(var(--topbar-height) + 24px) 20px 40px;
        max-width: 100%;
    }

    .section-card {
        padding: 20px;
    }

    .section-title {
        font-size: 1.3rem;
    }

    html {
        scroll-padding-top: calc(var(--topbar-height) + 20px);
    }
}

@media (max-width: 480px) {
    .content {
        padding: calc(var(--topbar-height) + 16px) 14px 32px;
    }

    .section-card {
        padding: 16px;
    }

    .sidebar-photo {
        width: 90px;
        height: 90px;
    }

    .entry-meta {
        flex-direction: column;
        gap: 4px;
    }
}

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

    * {
        transition: none !important;
        animation: none !important;
    }

    body {
        background: white !important;
        color: #000 !important;
        font-size: 11pt;
        line-height: 1.5;
    }

    .sidebar, .topbar, .menu-overlay, .btn-download, .btn-theme, .btn-theme-mobile, .cv-footer {
        display: none !important;
    }

    .content {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    .section {
        opacity: 1 !important;
        transform: none !important;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    .section-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .section-title {
        font-size: 14pt;
        color: #000 !important;
        border-bottom-color: #000 !important;
    }

    .timeline::before {
        background: #ccc !important;
    }

    .timeline-entry::before {
        border-color: #333 !important;
    }

    .skill-tag {
        background: #f0f0f0 !important;
        color: #333 !important;
        border: 1px solid #ccc;
    }

    a {
        color: #000 !important;
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }

    .social-link::after {
        display: none;
    }

    /* Print header */
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 20px;
        padding-bottom: 16px;
        border-bottom: 2px solid #000;
    }

    .print-header h1 {
        font-size: 22pt;
        margin-bottom: 4px;
    }

    .print-header .print-tagline {
        font-size: 12pt;
        color: #444;
    }

    .print-header .print-contact {
        font-size: 10pt;
        color: #666;
        margin-top: 8px;
    }
}

.print-header {
    display: none;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
