:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --accent-color: #0f172a;
    --background-color: #ffffff;
    --surface-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
    padding: 3rem 0;
    margin: -2rem -1rem 3rem -1rem;
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
}

.profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
}

.header-info h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header-info .title {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.contact-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.95rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.summary {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.skill-category {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.skill-category h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

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

.skill-tag {
    background: white;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

.experience-item {
    margin-bottom: 2.5rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.experience-header {
    background: var(--surface-color);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.experience-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 0.25rem;
}

.experience-company {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.experience-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.experience-content {
    padding: 1.5rem;
}

.experience-description {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.achievements {
    list-style: none;
}

.achievements li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.achievements li::before {
    content: "▸";
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.education {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.education h3 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.print-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
}

.print-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

@media (max-width: 768px) {
    .header-content {
        text-align: center;
    }

    .header-info h1 {
        font-size: 2rem;
    }

    .contact-info {
        justify-content: center;
    }

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

    .print-button {
        bottom: 1rem;
        right: 1rem;
    }
}

@media print {
    /* Reset and base styles for print */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        font-family: 'Times New Roman', 'Georgia', serif;
        font-size: 11pt;
        line-height: 1.3;
        color: #000;
        background: #fff;
        max-width: 8.5in;
        margin: 0 auto;
        padding: 0.5in;
    }

    .container {
        max-width: none;
        padding: 0;
        margin: 0;
    }

    /* Header styles for print - Professional layout */
    .header {
        margin: 0 0 0.2in 0;
        background: #fff !important;
        color: #000 !important;
        padding: 0.15in 0;
        border-bottom: 1px solid #000;
        text-align: center;
        page-break-inside: avoid;
    }

    .header-content {
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: 0.25in;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .profile-image {
        display: none;
    }

    .header-info {
        flex: 1;
    }

    .header-info h1 {
        font-size: 20pt;
        font-weight: bold;
        margin-bottom: 0.05in;
        letter-spacing: 0.5px;
        line-height: 1.1;
    }

    .header-info .title {
        font-size: 12pt;
        font-weight: normal;
        margin-bottom: 0.1in;
        color: #333;
        font-style: italic;
    }

    .contact-info {
        font-size: 9pt;
        display: flex;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.15in;
        margin-top: 0.05in;
        line-height: 1.2;
    }

    .contact-item {
        display: flex;
        align-items: center;
        gap: 0.03in;
        white-space: nowrap;
    }

    .contact-item::after {
        content: "|";
        margin-left: 0.08in;
        color: #666;
        font-weight: normal;
    }

    .contact-item:last-child::after {
        display: none;
    }

    .contact-item svg {
        display: none;
    }

    .contact-item a {
        color: #000 !important;
        text-decoration: none;
    }

    /* Section styles for print */
    .section {
        margin-bottom: 0.25in;
        page-break-inside: avoid;
    }

    .section-title {
        font-size: 11pt;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 0.08in;
        border-bottom: 1px solid #000;
        padding-bottom: 0.03in;
        color: #000;
        page-break-after: avoid;
    }

    /* Summary section */
    .summary {
        font-size: 10pt;
        line-height: 1.4;
        text-align: left;
        margin-bottom: 0.15in;
        background: #fff !important;
        padding: 0.1in;
        border-left: 2px solid #000;
        border-radius: 0;
        page-break-inside: avoid;
    }

    /* Skills section - Optimized layout */
    .skills-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.1in;
        margin-bottom: 0.15in;
        page-break-inside: avoid;
    }

    .skill-category {
        margin-bottom: 0.08in;
        background: #fff !important;
        padding: 0.08in;
        border: 1px solid #ccc;
        border-radius: 0;
        page-break-inside: avoid;
    }

    .skill-category h3 {
        font-weight: bold;
        font-size: 9pt;
        margin-bottom: 0.03in;
        color: #000;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .skill-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 0.02in;
        line-height: 1.2;
    }

    .skill-tag {
        font-size: 8pt;
        line-height: 1.2;
        background: #fff !important;
        color: #000 !important;
        padding: 0.01in 0.03in;
        border: 1px solid #ccc;
        border-radius: 0;
        margin-right: 0.02in;
        margin-bottom: 0.01in;
        white-space: nowrap;
    }

    .skill-tag:not(:last-child)::after {
        content: ",";
        margin-left: 0.02in;
        color: #000;
    }

    /* Experience section - Professional layout */
    .experience-item {
        margin-bottom: 0.2in;
        background: #fff !important;
        border: 1px solid #ccc;
        border-radius: 0;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .experience-header {
        background: #f8f8f8 !important;
        padding: 0.08in;
        border-bottom: 1px solid #ccc;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 0.05in;
    }

    .experience-title {
        font-weight: bold;
        font-size: 10pt;
        color: #000;
        line-height: 1.2;
    }

    .experience-company {
        font-weight: bold;
        font-size: 9pt;
        color: #333;
        line-height: 1.2;
    }

    .experience-date {
        font-size: 8pt;
        color: #666;
        font-style: italic;
        white-space: nowrap;
        line-height: 1.2;
    }

    .experience-content {
        padding: 0.08in;
    }

    .experience-description {
        font-size: 9pt;
        margin-bottom: 0.05in;
        line-height: 1.3;
        color: #333;
        text-align: justify;
    }

    .achievements {
        list-style: none;
        padding-left: 0;
        margin: 0;
    }

    .achievements li {
        font-size: 8pt;
        margin-bottom: 0.02in;
        padding-left: 0.08in;
        position: relative;
        line-height: 1.3;
        color: #333;
        text-align: justify;
        page-break-inside: avoid;
    }

    .achievements li::before {
        content: "•";
        position: absolute;
        left: 0;
        font-weight: bold;
        color: #000;
        font-size: 8pt;
    }

    /* Education section */
    .education {
        background: #fff !important;
        padding: 0.08in;
        border: 1px solid #ccc;
        border-radius: 0;
        margin-bottom: 0.1in;
        page-break-inside: avoid;
    }

    .education h3 {
        font-weight: bold;
        font-size: 9pt;
        color: #000;
        margin-bottom: 0.03in;
    }

    .education p {
        font-size: 8pt;
        color: #333;
        margin: 0;
    }

    /* Hide print button */
    .print-button {
        display: none;
    }

    /* Page breaks and flow control */
    .page-break {
        page-break-before: always;
    }

    .no-break {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Prevent orphaned content */
    .section-title + * {
        page-break-before: avoid;
    }

    /* Ensure education section stays with last experience */
    .education {
        page-break-before: avoid;
    }

    /* Ensure proper spacing */
    .section:last-child {
        margin-bottom: 0;
    }

    /* Optimize for proper page layout */
    @page {
        margin: 0.5in;
        size: letter;
    }

    /* Two-column layout for skills on smaller print areas */
    @media print and (max-width: 7in) {
        .skills-grid {
            grid-template-columns: 1fr;
        }
    }
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}