@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0f172a;
    /* Dark Navy/Slate */
    --accent-color: #0ea5e9;
    /* Sky Blue */
    --text-primary: #334155;
    --text-secondary: #64748b;
    --light-bg: #f8fafc;
    --white: #ffffff;
    --border-color: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #ebf3f8;
    /* Soft blue-grey background for the page */
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    line-height: 1.6;
}

.resume-container {
    background-color: var(--white);
    width: 100%;
    max-width: 1000px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: 300px 1fr;
    /* Sidebar | Main Content */
    border-radius: 8px;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    background-color: var(--primary-color);
    color: #e2e8f0;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sidebar h3 {
    color: var(--white);
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 1.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-size: 0.9em;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.2s;
}

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

.contact-item span {
    font-size: 1.2em;
    /* Emoji size */
}

.education-item {
    margin-bottom: 15px;
}

.degree {
    font-weight: 600;
    color: var(--white);
    display: block;
}

.school {
    font-size: 0.9em;
    color: #94a3b8;
}

.year {
    font-size: 0.85em;
    color: #64748b;
    font-style: italic;
}

.skill-category {
    margin-bottom: 20px;
}

.category-title {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 8px;
    display: block;
}

.skill-list {
    font-size: 0.9em;
    color: #cbd5e1;
    line-height: 1.5;
}

.cert-item {
    margin-bottom: 15px;
    font-size: 0.9em;
}

.cert-name {
    display: block;
    color: var(--white);
    font-weight: 500;
}

/* Main Content Styles */
.main-content {
    padding: 40px 50px;
    background-color: var(--white);
}

header {
    margin-bottom: 40px;
    border-bottom: 2px solid var(--light-bg);
    padding-bottom: 20px;
}

h1 {
    font-size: 2.5em;
    margin: 0;
    color: var(--primary-color);
    letter-spacing: -1px;
    line-height: 1.2;
}

.job-headline {
    font-size: 1.2em;
    color: var(--accent-color);
    font-weight: 500;
    margin-top: 5px;
}

section {
    margin-bottom: 35px;
}

h2 {
    color: var(--primary-color);
    font-size: 1.4em;
    border-left: 4px solid var(--accent-color);
    padding-left: 15px;
    margin-bottom: 20px;
}

.profile-text {
    color: var(--text-secondary);
    text-align: justify;
}

.experience-item,
.project-item {
    margin-bottom: 30px;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Align top in case title wraps */
    margin-bottom: 4px;
    gap: 20px;
    /* Force space between title and date */
}

.job-role {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.company {
    font-size: 1em;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
    /* Added spacing before the list */
    display: block;
}

.date {
    font-size: 0.9em;
    color: var(--text-secondary);
    background: var(--light-bg);
    padding: 4px 10px;
    border-radius: 15px;
    font-weight: 500;
    white-space: nowrap;
    /* Prevent date text from breaking */
    flex-shrink: 0;
    /* Prevent date badge from shrinking/disappearing */
    margin-top: -2px;
    /* Optical alignment with title */
}

.description-list {
    padding-left: 20px;
    margin-top: 10px;
}

.description-list li {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.description-list li::marker {
    color: var(--accent-color);
}

/* Footer & Counter */
.footer {
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    text-align: center;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.visitor-badge {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .resume-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 30px;
        order: 2;
        /* Put sidebar at bottom on mobile? Or top? Usually bottom for secondary info, but Contact is important. Let's keep it orderly. */
    }

    header {
        text-align: center;
    }

    .job-header {
        flex-direction: column;
        gap: 5px;
    }

    .main-content {
        padding: 30px;
    }
}

/* Print Styles for PDF Saving */
@media print {
    @page {
        margin: 0;
        /* Elimina los márgenes predeterminados del navegador */
        size: A4 portrait;
        /* Fuerza el tamaño A4 */
    }

    body {
        background-color: var(--white);
        padding: 0;
        margin: 0;
        font-size: 11px;
        /* Reducimos ligeramente el tamaño de fuente para que encaje todo en 1 página */
    }

    .resume-container {
        box-shadow: none;
        max-width: 100%;
        width: 100%;
        height: 100%;
        grid-template-columns: 260px 1fr;
        /* Mantiene las dos columnas */
        border-radius: 0;
    }

    .sidebar {
        padding: 30px 20px !important;
        background-color: var(--primary-color) !important;
        color: #e2e8f0 !important;
        /* Asegura el color del texto de la barra lateral */
    }

    .main-content {
        padding: 30px 40px !important;
    }

    header {
        margin-bottom: 20px;
        padding-bottom: 10px;
    }

    section {
        margin-bottom: 20px;
    }

    .experience-item,
    .project-item {
        margin-bottom: 15px;
    }

    /* Prevent page breaks */
    .experience-item,
    .project-item,
    .skill-category,
    section {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    h1 {
        font-size: 2.2em;
    }

    h2 {
        margin-bottom: 10px;
    }

    /* Hide elements not needed in PDF */
    .download-btn,
    .footer {
        display: none !important;
    }

    /* Ensure colors print correctly */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}