:root {
    --primary: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary: #f59e0b;
    --accent: #10b981;
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    /* Adjusted for potential nav wrapping on mobile. Test and refine this value. */
    --nav-scroll-offset: 6rem;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
    font-size: 16px; /* Base font size */
}

/* Animated background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0% { background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%); }
    50% { background: linear-gradient(135deg, #f093fb 0%, #667eea 50%, #764ba2 100%); }
    100% { background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%); }
}

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

/* Header */
.header {
    padding: 2rem 0;
    position: relative;
    text-align: center;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.5;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    font-size: 2.5rem; /* Slightly reduced base size */
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #fff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    color: var(--secondary);
    text-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
    animation: pulse 2s infinite;
    font-size: inherit; /* Ensure icon scales with logo text */
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.subtitle {
    font-size: 1.1rem; /* Slightly reduced base size */
    opacity: 0.9;
    font-weight: 400;
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 0; /* Reduced padding slightly */
}

.nav-container {
    display: flex;
    justify-content: center;
    align-items: center; /* Added for vertical alignment if items wrap */
    gap: 1.5rem; /* Reduced base gap */
    flex-wrap: wrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem; /* Slightly reduced padding */
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem; /* Slightly reduced base size */
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Main Content */
.main {
    padding: 3rem 0; /* Reduced base padding */
}

.section {
    display: none;
    margin-bottom: 3rem; /* Reduced base margin */
    scroll-margin-top: var(--nav-scroll-offset);
}

.section.active {
    display: block;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px); /* Reduced animation distance */
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards */
.card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.75rem; /* Reduced base padding */
    margin-bottom: 1.75rem; /* Reduced base margin */
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

.card-title {
    font-size: 1.75rem; /* Reduced base size */
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Reduced gap */
}

.card-title i {
    color: var(--secondary);
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
    font-size: 1.5rem; /* Adjusted icon size */
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0; /* Reduced padding */
}

.hero-title {
    font-size: 3rem; /* Reduced base size */
    font-weight: 800;
    margin-bottom: 1.25rem; /* Reduced margin */
    background: linear-gradient(45deg, #fff, #e2e8f0, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.hero-description {
    font-size: 1.1rem; /* Reduced base size */
    opacity: 0.9;
    max-width: 700px; /* Slightly reduced max-width */
    margin: 0 auto 2.5rem; /* Reduced margin */
    line-height: 1.6;
}

.highlight-box {
    background: linear-gradient(135deg, var(--secondary), #ef4444);
    padding: 1.5rem; /* Reduced padding */
    border-radius: 20px;
    margin: 1.5rem 0; /* Reduced margin */
    text-align: center;
    position: relative;
    overflow: hidden;
}
.highlight-box h3 {
    font-size: 1.25rem; /* Adjusted for smaller box */
    margin-bottom: 0.75rem;
}
.highlight-box p {
    font-size: 1rem; /* Adjusted for smaller box */
}

.highlight-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(30deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(30deg); }
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Slightly smaller min */
    gap: 1.5rem; /* Reduced gap */
    margin: 2.5rem 0; /* Reduced margin */
}

.benefit-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem; /* Reduced padding */
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.benefit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

.benefit-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.benefit-icon {
    font-size: 2.5rem; /* Reduced size */
    margin-bottom: 0.75rem; /* Reduced margin */
    background: linear-gradient(45deg, var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.benefit-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* Phase Timeline */
.phases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Smaller min */
    gap: 1.25rem; /* Reduced gap */
    margin: 2.5rem 0; /* Reduced margin */
}

.phase-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem; /* Reduced padding */
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}
.phase-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.phase-card p {
    font-size: 0.9rem;
}

.phase-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
}

.phase-number {
    width: 50px; /* Reduced size */
    height: 50px; /* Reduced size */
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem; /* Reduced size */
    font-weight: 700;
    margin: 0 auto 0.75rem; /* Adjusted margin */
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

/* Chart Container */
.chart-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 1.5rem; /* Reduced padding */
    margin: 1.5rem 0; /* Reduced margin */
    border: 1px solid var(--glass-border);
    min-height: 250px;
    position: relative;
}

/* Responsive Tables */
.table-container {
    overflow-x: auto;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    margin: 1.5rem 0; /* Reduced margin */
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem; /* Reduced padding */
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem; /* Slightly smaller font for table content */
}

th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Code Blocks */
.code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.25rem; /* Reduced padding */
    margin: 1rem 0;
    font-family: 'Monaco', monospace;
    font-size: 0.85rem; /* Slightly smaller font for code */
    position: relative;
    overflow-x: auto;
}

.copy-btn {
    position: absolute;
    top: 0.75rem; /* Adjusted position */
    right: 0.75rem; /* Adjusted position */
    background: var(--secondary);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 0.4rem; /* Reduced padding */
    cursor: pointer;
    transition: all 0.3s ease;
}
.copy-btn i {
    font-size: 0.8rem;
}

.copy-btn:hover {
    background: #d97706;
    transform: scale(1.1);
}

/* Recommendations */
.rec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Adjusted min */
    gap: 1.5rem; /* Reduced gap */
    margin: 2.5rem 0; /* Reduced margin */
}

.rec-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem; /* Reduced padding */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.rec-card h3 { font-size: 1.1rem; }
.rec-card p { font-size: 0.9rem; }
.rec-card span { font-size: 0.7rem; padding: 0.2rem 0.4rem; }


.rec-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
}

.rec-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.rec-card > div:first-of-type { /* Targeting the div containing icon and title */
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.rec-card > div:first-of-type > div:first-child { /* Icon container */
    width: 50px;
    height: 50px;
}
.rec-card > div:first-of-type i { /* Icon itself */
    font-size: 1.25rem;
}


.priority-high { border-left: 4px solid #ef4444; }
.priority-medium { border-left: 4px solid var(--secondary); }
.priority-low { border-left: 4px solid var(--accent); }

/* Conclusion Cards (inside the "Conclusión" section) */
#recomendaciones .card:last-of-type .card-title { /* Targeting conclusion title specifically if needed */
    font-size: 1.75rem;
}
#recomendaciones .card:last-of-type > div[style*="display: grid"] { /* The grid of conclusion points */
    gap: 1.5rem;
    margin: 1.5rem 0;
}
#recomendaciones .card:last-of-type > div[style*="display: grid"] > div { /* Each conclusion point box */
    padding: 1.25rem;
    gap: 0.75rem;
}
#recomendaciones .card:last-of-type > div[style*="display: grid"] i {
    font-size: 1.25rem;
}
#recomendaciones .card:last-of-type > div[style*="display: grid"] h3 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}
#recomendaciones .card:last-of-type > div[style*="display: grid"] p {
    font-size: 0.9rem;
}
#recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] { /* Final recommendation box */
    padding: 1.5rem;
    margin-top: 1.5rem;
}
#recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] i {
    font-size: 1.75rem;
}
#recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] h3 {
    font-size: 1.25rem;
}
#recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] p {
    font-size: 1rem;
}


/* MEDIUM SCREENS (Tablets, Larger Mobiles) */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header {
        padding: 1.5rem 0;
    }

    .logo {
        font-size: 2rem; /* Smaller logo */
        gap: 0.75rem;
    }
    .logo > div > div:last-child { /* "Propuesta Tecnica" part of logo */
        font-size: 0.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .nav {
        padding: 0.5rem 0;
    }
    .nav-container {
        gap: 0.75rem; /* Smaller gap for wrapped items */
    }
    .nav-item {
        padding: 0.5rem 1rem;
        font-size: 0.85rem; /* Smaller nav items */
    }
    .nav-item i {
        font-size: 0.8rem;
    }

    .main {
        padding: 2rem 0;
    }
    .section {
        margin-bottom: 2rem;
    }

    .hero-title {
        font-size: 2.25rem; /* Smaller hero title */
    }
    .hero-description {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .benefits-grid,
    .phases-grid,
    .rec-grid,
    #costos .card > div[style*="grid-template-columns"] /* Cost summary boxes */
    {
        grid-template-columns: 1fr; /* Stack items in a single column */
    }
    /* Ensure gap for the cost summary boxes when stacked */
    #costos .card > div[style*="grid-template-columns"] {
        gap: 1.5rem;
    }


    .card {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }
    .card-title {
        font-size: 1.5rem; /* Smaller card titles */
    }
    .card-title i {
        font-size: 1.3rem;
    }

    .highlight-box h3 { font-size: 1.1rem; }
    .highlight-box p { font-size: 0.9rem; }

    .benefit-icon { font-size: 2rem; }
    .phase-number { width: 45px; height: 45px; font-size: 1.1rem; }

    .chart-container { padding: 1rem; min-height: 200px; }
    th, td { padding: 0.6rem; font-size: 0.85rem; }
    .code-block { padding: 1rem; font-size: 0.8rem; }
    .copy-btn { top: 0.5rem; right: 0.5rem; padding: 0.35rem; }
    .copy-btn i { font-size: 0.75rem; }

    .rec-card > div:first-of-type { gap: 0.5rem; margin-bottom: 0.5rem;}
    .rec-card > div:first-of-type > div:first-child { width: 45px; height: 45px; }
    .rec-card > div:first-of-type i { font-size: 1.1rem; }
    .rec-card h3 { font-size: 1rem; }
    .rec-card p { font-size: 0.85rem; }

    #recomendaciones .card:last-of-type > div[style*="display: grid"] { gap: 1rem; }
    #recomendaciones .card:last-of-type > div[style*="display: grid"] > div { padding: 1rem; }
    #recomendaciones .card:last-of-type > div[style*="display: grid"] i { font-size: 1.1rem; }
    #recomendaciones .card:last-of-type > div[style*="display: grid"] h3 { font-size: 1rem; }
    #recomendaciones .card:last-of-type > div[style*="display: grid"] p { font-size: 0.85rem; }

    #recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] i { font-size: 1.5rem; }
    #recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] h3 { font-size: 1.1rem; }
    #recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] p { font-size: 0.9rem; }

}

/* SMALL SCREENS (Smaller Mobiles) */
@media (max-width: 480px) {
    body {
        font-size: 14px; /* Further reduce base font size for small devices */
    }
    .container {
        padding: 0 0.75rem;
    }

    .header {
        padding: 1rem 0;
    }
    .logo {
        font-size: 1.6rem; /* Even smaller logo */
        gap: 0.5rem;
    }
    .logo i {
      /* font-size: 1.6rem; if you want icon to be same size as text */
    }
     .logo > div > div:last-child { /* "Propuesta Tecnica" part of logo */
        font-size: 0.7rem;
    }


    .subtitle {
        font-size: 0.85rem;
    }

    .nav {
        padding: 0.5rem 0;
    }
    .nav-container {
        gap: 0.5rem; /* Tighter gap */
        justify-content: space-around; /* Distribute items a bit */
    }
    .nav-item {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem; /* Smaller nav items */
    }
     .nav-item i {
        font-size: 0.7rem; /* Smaller icons in nav */
        margin-right: 0.25rem; /* Reduced gap for icon */
    }


    .main {
        padding: 1.5rem 0;
    }
    .section {
        margin-bottom: 1.5rem;
        scroll-margin-top: calc(var(--nav-scroll-offset) * 0.85); /* Adjust if nav height changes significantly */
    }


    .hero-title {
        font-size: 1.8rem; /* Smaller hero title */
        line-height: 1.3;
    }
    .hero-description {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }


    .card {
        padding: 1rem;
        border-radius: 15px; /* Slightly smaller radius */
    }
    .card-title {
        font-size: 1.25rem; /* Smaller card titles */
        gap: 0.5rem;
    }
    .card-title i {
        font-size: 1.1rem;
    }

    .highlight-box { padding: 1rem; margin: 1rem 0; }
    .highlight-box h3 { font-size: 1rem; }
    .highlight-box p { font-size: 0.8rem; }

    .benefits-grid { gap: 1rem; margin: 1.5rem 0; }
    .benefit-card { padding: 1rem; }
    .benefit-icon { font-size: 1.8rem; }
    .benefit-card h3 { font-size: 1rem; }


    .phases-grid { gap: 1rem; margin: 1.5rem 0; }
    .phase-card { padding: 1rem; }
    .phase-number { width: 40px; height: 40px; font-size: 1rem; margin-bottom: 0.5rem;}
    .phase-card h3 {font-size: 1rem;}
    .phase-card p {font-size: 0.8rem;}

    .chart-container { padding: 0.75rem; min-height: 180px; }
    th, td { padding: 0.5rem; font-size: 0.75rem; }

    .code-block { padding: 0.75rem; font-size: 0.7rem; }

    .rec-grid { gap: 1rem; margin: 1.5rem 0; }
    .rec-card { padding: 1rem; }
    .rec-card > div:first-of-type > div:first-child { width: 40px; height: 40px; }
    .rec-card > div:first-of-type i { font-size: 1rem; }
    .rec-card h3 { font-size: 0.9rem; }
    .rec-card p { font-size: 0.8rem; }
    .rec-card span { font-size: 0.65rem; }

    #recomendaciones .card:last-of-type > div[style*="display: grid"] { gap: 1rem; }
    #recomendaciones .card:last-of-type > div[style*="display: grid"] > div { padding: 0.75rem; }
    #recomendaciones .card:last-of-type > div[style*="display: grid"] i { font-size: 1rem; }
    #recomendaciones .card:last-of-type > div[style*="display: grid"] h3 { font-size: 0.9rem; }
    #recomendaciones .card:last-of-type > div[style*="display: grid"] p { font-size: 0.8rem; }

    #recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] { padding: 1rem;}
    #recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] i { font-size: 1.3rem; }
    #recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] h3 { font-size: 1rem; }
    #recomendaciones .card:last-of-type > div[style*="background: linear-gradient"] p { font-size: 0.85rem; }

}


/* Scroll animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px); /* Consistent with fadeInUp */
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    100% { left: 100%; }
}