/* Base reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: #f3f4f6;
    color: #111827;
}

/* Page wrapper */
.page {
    max-width: 900px;
    margin: 32px auto;
    padding: 32px 40px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
    border-radius: 12px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.header-left {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.profile-photo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #2563eb;
    flex-shrink: 0;
}

.header-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.name {
    font-size: 32px;
    margin: 0 0 4px 0;
    color: #111827;
}

.title {
    font-size: 16px;
    font-weight: 500;
    color: #2563eb;
    margin: 0 0 4px 0;
}

.location {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

.contact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 13px;
}

.contact-item {
    display: block;
}

.contact-label {
    font-weight: 500;
    margin-right: 4px;
}

.contact a,
.contact span {
    text-decoration: none;
    color: #1f2937;
    word-break: break-all;
}

.contact a:hover {
    color: #2563eb;
}

/* Sections */
.section {
    margin-bottom: 24px;
}

.section:last-of-type {
    margin-bottom: 16px;
}

.section h2 {
    font-size: 18px;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2563eb;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 4px;
}

/* Prevent small sections from breaking */
.section-education,
.section-certification,
.section-languages,
.section-additional {
    page-break-inside: avoid;
}

/* Summary */
.section-summary p {
    margin: 0;
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.skills-grid h3 {
    font-size: 14px;
    margin: 0 0 4px 0;
    color: #2563eb;
}

.skills-grid ul {
    margin: 0;
    padding-left: 18px;
}

/* Experience */
.job {
    margin-bottom: 16px;
}

.job-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.job-title {
    font-size: 15px;
    margin: 0;
}

.job-company {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: #2563eb;
    font-weight: 500;
}

.job-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
    color: #6b7280;
}

.job-summary {
    margin: 4px 0 0 0;
    font-size: 13px;
}

.job-bullets {
    margin: 4px 0 0 0;
    padding-left: 18px;
}

/* Education */
.education-item {
    page-break-inside: avoid;
    margin-bottom: 14px;
}

.education-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.education-degree {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.education-institution {
    margin: 3px 0 0 0;
    font-size: 13px;
    color: #2563eb;
    font-weight: 500;
}

.education-timeline {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.education-location {
    font-size: 12px;
    color: #6b7280;
}

.education-thesis {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

.education-thesis a {
    color: #2563eb;
    text-decoration: none;
}

/* Languages */
.languages-list {
    margin: 0;
    padding-left: 18px;
    list-style-type: disc;
}

.languages-list li {
    margin-bottom: 2px;
}

/* Additional Info */
.additional-info {
    margin: 0;
    font-size: 13px;
}

.education-thesis {
    margin: 4px 0 0 0;
    font-size: 13px;
}

/* Languages */
.simple-list {
    margin: 0;
    padding-left: 18px;
    list-style-type: disc;
}

/* Additional info */
.additional-info {
    margin: 0;
    font-size: 13px;
}

/* Footer */
.footer {
    border-top: 1px solid #e5e7eb;
    margin-top: 16px;
    padding-top: 8px;
    font-size: 11px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
}

/* Mobile */
@media (max-width: 640px) {
    .page {
        margin: 16px;
        padding: 20px;
    }

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

    .header-left {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .header-main {
        align-items: center;
        text-align: center;
    }

    .contact {
        align-items: flex-start;
    }

    .contact-label {
        display: inline;
    }

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

    .job-meta {
        align-items: flex-start;
    }

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

    .education-timeline {
        align-items: flex-start;
    }

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

/* Print styles - for PDF */
@media print {
    body {
        background: #ffffff;
    }

    .page {
        box-shadow: none;
        border-radius: 0;
        max-width: none;
        margin: 0;
        padding: 8mm 10mm;
    }

    .section h2 {
        border-bottom: 1px solid #cccccc;
        margin-bottom: 6px;
    }

    .header {
        border-bottom-color: #2563eb;
        margin-bottom: 16px;
    }

    /* Photo styles for print */
    .profile-photo {
        width: 70px;
        height: 70px;
        border: 2px solid #2563eb;
    }

    /* Reduce section spacing */
    .section {
        margin-bottom: 14px;
    }

    /* Don't break layout */
    .header,
    .job-header,
    .footer {
        page-break-inside: avoid;
    }

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

    /* Compact job spacing */
    .job {
        margin-bottom: 10px;
    }

    .job-bullets {
        margin: 2px 0 0 0;
        padding-left: 16px;
    }

    .job-bullets li {
        margin-bottom: 1px;
    }

    /* Reduce font size to save space */
    body {
        font-size: 10.5px;
        line-height: 1.4;
    }

    .name {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .title {
        font-size: 11px;
    }

    .location {
        font-size: 10px;
    }

    .contact {
        font-size: 10px;
    }

    .section h2 {
        font-size: 11px;
    }

    .job-title {
        font-size: 13px;
    }

    .job-company {
        font-size: 11px;
    }

    .job-meta {
        font-size: 10px;
    }

    .job-summary {
        font-size: 11px;
    }

    .education-item h3 {
        font-size: 12px;
    }

    .education-degree {
        font-size: 13px;
    }

    .education-institution {
        font-size: 11px;
    }

    .education-timeline {
        font-size: 10px;
    }

    .education-location {
        font-size: 10px;
    }

    .education-thesis {
        font-size: 10.5px;
    }

    .education-meta {
        font-size: 11px;
    }

    .skills-grid {
        gap: 12px;
    }

    .skills-grid h3 {
        font-size: 12px;
    }

    .skills-grid ul {
        font-size: 10.5px;
    }

    /* Remove shadows */
    .page {
        box-shadow: none;
        border: none;
    }

    /* Remove URLs from links */
    a[href]:after {
        content: "";
    }
}