/* ========================================
   VARIABLES CSS Y COLORES
   ======================================== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --background: #ffffff;
    --surface: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   RESET Y BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    font-size: 1.75rem;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    position: absolute;
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

/* ========================================
   NAVEGACIÓN
   ======================================== */
.nav-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: white;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.nav-menu.open {
    left: 0;
}

.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.nav-menu.open ~ .nav-overlay,
.nav-menu.open .nav-overlay {
    display: block;
}

.nav-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.nav-list {
    list-style: none;
    padding: 1rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--surface);
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.25rem;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* ========================================
   BREADCRUMB
   ======================================== */
.breadcrumb {
    padding: 1rem 0;
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    font-size: 0.875rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: '›';
    margin-left: 0.5rem;
    color: var(--text-secondary);
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero-section {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 3rem;
}

.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* ========================================
   CALCULATOR CARDS GRID
   ======================================== */
.calculators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.calculator-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.calculator-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.925rem;
    margin-bottom: 1rem;
}

.card-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-color);
    font-weight: 500;
}

/* ========================================
   CALCULATOR PAGE LAYOUT
   ======================================== */
.calculator-page {
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.page-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.calculator-layout .full-width {
    grid-column: 1 / -1;
}

/* ========================================
   FORM STYLES
   ======================================== */
.form-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.form-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.textarea-large {
    min-height: 300px;
    resize: vertical;
    font-family: inherit;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-primary,
.btn-secondary {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ========================================
   RESULT DISPLAY
   ======================================== */
.result-display {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
}

.result-display.visible {
    opacity: 1;
    transform: translateY(0);
}

.result-header h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item.highlight {
    background: var(--surface);
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    margin-bottom: 1rem;
}

.result-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.result-summary {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-card.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* ========================================
   ADSENSE STYLES
   ======================================== */
.ad-container {
    margin: 2rem 0;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ad-loading {
    background: var(--surface);
    border-radius: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ad-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.ad-container.header {
    margin-top: 1rem;
}

.ad-container.footer {
    margin-top: 3rem;
}

/* ========================================
   EDUCATIONAL CONTENT
   ======================================== */
.contenido-educativo {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.contenido-educativo h2 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem;
    font-weight: 600;
}

.contenido-educativo h3 {
    font-size: 1.35rem;
    margin: 1.5rem 0 0.75rem;
    font-weight: 600;
}

.contenido-educativo p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.contenido-educativo ul,
.contenido-educativo ol {
    margin: 1rem 0 1rem 2rem;
    line-height: 1.8;
}

.contenido-educativo li {
    margin-bottom: 0.5rem;
}

.formula-container {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin: 1.5rem 0;
}

.formula-container code {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* ========================================
   TIPS AND FAQ
   ======================================== */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.tip-card {
    background: white;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.tip-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.faq-section {
    margin: 2rem 0;
}

.faq-item {
    background: white;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.faq-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* ========================================
   RELATED CALCULATORS
   ======================================== */
.related-calculators {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.related-card {
    display: flex;
    flex-direction: column;
    background: white;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.related-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.related-card .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.related-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.related-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    display: block;
    padding: 0.25rem 0;
}

.footer-section a:hover {
    color: white;
    padding-left: 0.5rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* ========================================
   FEATURES SECTION
   ======================================== */
.features-section {
    margin: 3rem 0;
    text-align: center;
}

.features-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem 1rem;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.feature-card p {
    color: var(--text-secondary);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .calculator-layout {
        grid-template-columns: 1fr;
    }

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

    .page-header h1 {
        font-size: 1.5rem;
    }

    .form-card {
        padding: 1.5rem;
    }

    .result-display {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Hide sidebar ads on mobile */
    .ad-container.sidebar {
        display: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-section {
        padding: 2rem 1rem;
    }

    .form-card,
    .result-display {
        padding: 1rem;
    }

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

/* ========================================
   UTILITIES
   ======================================== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}


/* Estilos adicionales para Calculadora de Calorías */

/* Radio buttons personalizados */
.radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-option:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.radio-option input[type="radio"] {
    margin-right: 0.5rem;
}

.radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #2563eb;
}

.radio-option input[type="radio"]:checked {
    accent-color: #2563eb;
}

/* Macronutrientes */
.macro-item {
    margin-bottom: 1.5rem;
}

.macro-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.macro-name {
    font-size: 0.95rem;
}

.macro-value {
    color: #2563eb;
    font-size: 1rem;
}

.macro-bar {
    height: 12px;
    background: #f3f4f6;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.macro-fill {
    height: 100%;
    transition: width 0.6s ease;
    border-radius: 6px;
}

.macro-fill.proteinas {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.macro-fill.carbohidratos {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.macro-fill.grasas {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.macro-item small {
    color: #6b7280;
    font-size: 0.85rem;
}

/* Proyecciones */
.projection-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.projection-item:last-child {
    border-bottom: none;
}

.projection-period {
    font-weight: 500;
    color: #374151;
}

.projection-value {
    font-weight: 700;
    color: #2563eb;
    font-size: 1.1rem;
}

/* Tips list */
.tips-list {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.tips-list li {
    margin-bottom: 0.75rem;
    color: #374151;
    line-height: 1.6;
}

/* Alert boxes */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.alert-info {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    color: #1e40af;
}

.alert strong {
    font-weight: 600;
}

/* Form sections */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #f3f4f6;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    font-size: 1.1rem;
    color: #111827;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Utility classes */
.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.text-muted {
    color: #6b7280;
    font-size: 0.9rem;
}

/* FAQ items */
.faq-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid #2563eb;
}

.faq-item h4 {
    color: #111827;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

.faq-item p {
    color: #374151;
    line-height: 1.7;
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.action-buttons .btn-secondary {
    flex: 1;
    min-width: 200px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .radio-group {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn-secondary {
        width: 100%;
    }
}