:root {
    --primary: #0f172a; /* Deep Navy */
    --accent: #3b82f6;  /* Electric Blue */
    --text-dark: #1e293b;
    --text-light: #64748b;
    --white: #ffffff;
    --bg-light: #f8fafc;
    --sidebar-bg: #1e293b;
}

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

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

/* Container limits for A4-like feel but responsive */
.cv-container {
    width: 100%;
    max-width: 1000px;
    background: var(--white);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 1200px;
    border-radius: 8px;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--sidebar-bg) !important;
    color: var(--white) !important;
    padding: 25px 20px; /* Reducido de 40px/25px */
    display: flex;
    flex-direction: column;
    gap: 20px; /* Reducido de 30px */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.image-container {
    width: 140px; /* Reducido de 160px */
    height: 140px;
    margin: 0 auto 10px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    overflow: hidden;
    background: #334155;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.profile-section {
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

.profile-section h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem; /* Reducido de 2.2rem */
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 8px;
    color: var(--white) !important;
}

.tagline {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.contact-info h3, .skills-section h3, .languages h3, .propios-section h3, .personal-section h3 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    margin-bottom: 20px;
    color: var(--accent);
}

.propios-section, .personal-section {
    margin-top: 10px;
}

.personal-bio p {
    font-size: 0.95rem; /* Aumentado para mejor legibilidad */
    color: #cbd5e1;
    line-height: 1.5;
    margin-bottom: 12px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.contact-item .icon {
    font-size: 1.2rem;
}

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

.skill-group h4 {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 10px;
}

.contact-item p a, .sidebar-link {
    color: inherit;
    text-decoration: none;
}

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

.sidebar-link:hover {
    color: inherit; /* Mantener el color original sin volverse azul */
    text-decoration: underline; /* Añadir un subrayado sutil en lugar de cambiar color */
}

.skill-group ul li {
    font-size: 0.9rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.skill-group ul li::before {
    content: "•";
    color: var(--accent);
}

/* Main Content Styling */
.main-content {
    padding: 20px 30px; /* Reducido de 30px 40px */
    display: flex;
    flex-direction: column;
    gap: 15px; /* Reducido de 25px */
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem; /* Reducido de 1.3rem */
    color: var(--primary);
    margin-bottom: 8px; /* Reducido de 12px */
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, var(--accent), transparent);
}

.intro p {
    margin-bottom: 15px;
    font-size: 1.05rem;
    color: var(--text-dark);
}

.project-card {
    background: #f1f5f9;
    padding: 10px 12px; /* Reducido de 15px */
    border-radius: 6px;
    margin-bottom: 8px; /* Reducido de 12px */
    border-left: 3px solid var(--accent);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px; /* Reducido de 5px */
}

.project-header h3 {
    font-size: 1.2rem;
    color: var(--primary);
}

.badge {
    font-size: 0.7rem;
    background: var(--accent);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
}

.project-card p {
    font-size: 0.95rem;
    color: var(--text-light);
}

.project-entry {
    margin-bottom: 10px; /* Reducido de 15px */
    padding-bottom: 5px;
    border-bottom: 1px solid #f1f5f9;
}

.project-info strong {
    display: block;
    font-size: 1.05rem;
    color: var(--primary);
}

.project-info em {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.p-url a {
    color: var(--accent);
    text-decoration: none;
    font-family: monospace;
}

.p-url a:hover {
    text-decoration: underline;
}

.subtitle {
    margin-top: -15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

.why-me ul {
    list-style: none;
}

.why-me li {
    margin-bottom: 12px;
    padding-left: 30px;
    position: relative;
}

/* Screenshot Handling */
.project-images {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.screenshot {
    flex: 1;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    object-fit: contain;
    background: #f8fafc;
    width: 48%;
    max-height: 140px; /* Reducido de 180px */
}

.mobile-shots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.mobile-shots .screenshot {
    flex: 0 0 18% !important;
    width: 18% !important;
    max-width: 18% !important;
    min-width: 18% !important;
    height: 180px !important;
    object-fit: cover !important;
    object-position: top !important;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.three-imgs .screenshot {
    width: 31% !important;
    max-width: 31% !important;
    flex: 0 0 31% !important;
    height: 140px !important;
    object-fit: cover !important;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.portfolio-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-decoration: none; /* Quitar subrayado del enlace */
    color: inherit; /* Mantener colores de texto */
    transition: all 0.2s ease;
}

.portfolio-item:hover {
    border-color: var(--accent);
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.portfolio-item img {
    width: 100%;
    height: 80px; /* Reducido de 100px */
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #f1f5f9;
}

.portfolio-item h4 {
    font-size: 0.75rem;
    color: var(--primary);
    line-height: 1.2;
    font-weight: 700;
}

.portfolio-item .p-url {
    font-size: 0.65rem;
}

/* Sidebar Profile Fix */
.profile-section {
    width: 100%;
    margin-bottom: 5px;
}

.image-container {
    width: 150px;
    height: 150px;
    margin: 0 auto 15px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    overflow: hidden;
    background: #334155;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Global Margins */
body {
    padding: 0;
    margin: 0;
}

.cv-container {
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 0;
}

@media print {
    @page { margin: 0; }
    .cv-container {
        width: 100% !important;
        grid-template-columns: 260px 1fr !important;
    }
    .sidebar {
        padding: 20px 15px !important;
    }
    .main-content {
        padding: 20px 30px !important;
    }
    .screenshot {
        max-height: 150px !important;
    }
    .mobile-shots .screenshot {
        max-height: 200px !important;
    }
}
