/* ==========================================================================
   RESET Y TIPOGRAFÍA GLOBAL (Reemplazo de Elementor)
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    background-color: #f8f6f1; /* El color crema de tu web */
    color: #1a1a1a;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cormorant Garamond', serif;
    color: #2c4a3a;
    font-weight: 700;
}

/* ==========================================================================
   PANTALLA DE BIENVENIDA (ONBOARDING)
   ========================================================================== */
#cdm-welcome-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #f8f6f1; z-index: 9999; display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 20px; overflow-y: auto;
}
.welcome-container { max-width: 450px; width: 100%; margin: auto; padding-top: 30px; padding-bottom: 30px; }
.welcome-logo-small { width: 80px; height: 80px; border-radius: 18px; box-shadow: 0 8px 20px rgba(44,74,58,0.1); margin-bottom: 20px; }
.welcome-header h4 { color: #5a7a68; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; font-weight: 700; }
.welcome-header h1 { color: #2c4a3a; font-size: 28px; line-height: 1.1; margin-bottom: 8px; }
.welcome-subtitle { font-weight: 600; color: #3d7a6a; font-size: 15px; margin-bottom: 20px; }
.welcome-desc p { color: #4a4a4a; font-size: 15px; margin-bottom: 25px; padding: 0 10px; }

.welcome-stats { display: flex; flex-direction: column; gap: 12px; margin-bottom: 35px; }
.stat-item { background: #fff; padding: 16px; border-radius: 14px; display: flex; align-items: center; gap: 15px; text-align: left; box-shadow: 0 4px 10px rgba(0,0,0,0.04); border: 1px solid #e9e6df; }
.stat-num { font-size: 24px; font-weight: 700; color: #3d7a6a; min-width: 75px; text-align: center; }
.stat-text { font-size: 13px; color: #555; line-height: 1.4; }

.welcome-btn { font-size: 16px; padding: 15px 24px; box-shadow: 0 6px 15px rgba(44,74,58,0.2); width: 100%; max-width: 300px; margin: 0 auto; display: block; border-radius: 30px; cursor: pointer;}
.welcome-footer { margin-top: 35px; font-size: 13px; color: #888; }
.welcome-footer a { color: #3d7a6a; text-decoration: none; font-weight: 600; }

/* ==========================================================================
   ESTRUCTURA PRINCIPAL DE LA CALCULADORA
   ========================================================================== */
#cdm-calc-v3 {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 15px;
}

/* Navegación por pestañas */
.mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.mode-tab {
    padding: 12px 24px;
    background: #ffffff;
    border: 1px solid #e9e6df;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    color: #555;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.mode-tab.active {
    background: #2c4a3a;
    color: #ffffff;
    border-color: #2c4a3a;
}
.mode-panel { display: none; }
.mode-panel.active { display: block; animation: fadeIn 0.4s ease; }

/* Contenedor principal dividido (Sidebar y Main) */
.cdm-wrap {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.05);
    overflow: hidden;
}
@media (min-width: 768px) {
    .cdm-wrap { flex-direction: row; }
}

/* Barra lateral verde */
.cdm-sidebar {
    background: #2c4a3a;
    color: #ffffff;
    padding: 40px 30px;
    flex: 0 0 35%;
}
.cdm-brand h1 { color: #ffffff; font-size: 32px; margin-bottom: 10px; }
.cdm-brand p { opacity: 0.8; font-size: 15px; line-height: 1.5; }

/* Área principal (Formulario) */
.cdm-main {
    padding: 40px 30px;
    flex: 1;
}

/* ==========================================================================
   FORMULARIOS Y BOTONES
   ========================================================================== */
.cdm-fg { margin-bottom: 25px; }
.cdm-step-label {
    font-weight: 600;
    color: #2c4a3a;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cdm-step-num {
    background: #3d7a6a;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

select, input[type="number"], input[type="text"] {
    width: 100%;
    padding: 14px;
    border: 1px solid #d1d8d4;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    background: #faf8f4;
    color: #333;
    transition: border 0.3s;
}
select:focus, input:focus { outline: none; border-color: #3d7a6a; }

.cdm-btn {
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: opacity 0.3s;
    width: 100%;
}
.cdm-btn:hover { opacity: 0.9; }
.cdm-btn-primary { background: #3d7a6a; color: #ffffff; }
.cdm-btn-secondary { background: #f0fdf4; color: #065f46; border: 1px solid #a7f3d0; margin-top: 15px; }
.cdm-reset {
    background: transparent; border: none; color: #888; text-decoration: underline;
    cursor: pointer; font-family: inherit; margin-top: 15px; display: block; text-align: center; width: 100%;
}

/* ==========================================================================
   RESULTADOS (MODO SIMPLE)
   ========================================================================== */
.cdm-result-carbs, .cdm-result-ig {
    background: #faf8f4;
    border: 1px solid #e9e6df;
    padding: 25px;
    border-radius: 12px;
    margin-top: 25px;
}
.cdm-big-num { font-size: 42px; font-weight: 700; color: #2c4a3a; line-height: 1; margin-bottom: 5px; }
.cdm-big-num span { font-size: 16px; font-weight: 400; color: #555; }
.cdm-portion-info { color: #888; font-size: 14px; margin-bottom: 15px; }

.cdm-ig-row { display: flex; gap: 15px; margin-top: 20px; }
.cdm-ig-box { flex: 1; padding: 20px; border-radius: 12px; text-align: center; }
.cdm-ig-box.bg-bajo { background: #f0fdf4; color: #065f46; }
.cdm-ig-box.bg-medio { background: #fffbeb; color: #92400e; }
.cdm-ig-box.bg-alto { background: #fef2f2; color: #991b1b; }
.cdm-val { font-size: 32px; font-weight: 700; }
.cdm-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; margin-bottom: 8px;}
.cdm-badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.cdm-badge.badge-bajo { background: #d1fae5; }
.cdm-badge.badge-medio { background: #fef3c7; }
.cdm-badge.badge-alto { background: #fee2e2; }

/* ==========================================================================
   DISEÑO DE LOS SLOTS (COMBINAR Y DIA COMPLETO)
   ========================================================================== */
.slots-layout { display: flex; flex-direction: column; gap: 30px; }
@media (min-width: 992px) { .slots-layout { flex-direction: row; } }
#slots-combinar-col, #slots-dia-col { flex: 2; }
.totals-panel { flex: 1; background: #fff; padding: 30px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); align-self: flex-start; position: sticky; top: 20px; }

.slot-card { background: #ffffff; border: 1px solid #e9e6df; border-radius: 12px; margin-bottom: 20px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.slot-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid #f0f0f0; padding-bottom: 10px; }
.slot-label { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 700; color: #2c4a3a; }
.slot-clear { background: none; border: none; color: #dc2626; font-size: 12px; cursor: pointer; }

.slot-item-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; align-items: center; background: #faf8f4; padding: 10px; border-radius: 8px; }
.sir-fam, .sir-ali { flex: 1; min-width: 150px; margin-top: 0; }
.slot-item-qty { width: 70px; margin-top: 0; }
.slot-item-del { background: #fee2e2; color: #dc2626; border: none; border-radius: 6px; width: 40px; height: 40px; cursor: pointer; font-weight: bold; }
.slot-add-item-btn { width: 100%; background: #f0fdf4; color: #065f46; border: 1px dashed #a7f3d0; padding: 12px; border-radius: 8px; cursor: pointer; font-weight: 600; margin-top: 10px; }

.totals-title { font-family: 'Cormorant Garamond', serif; font-size: 24px; color: #2c4a3a; margin-bottom: 20px; border-bottom: 2px solid #e9e6df; padding-bottom: 10px; }
.totals-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.totals-key { color: #555; font-weight: 500; }
.totals-val { font-size: 20px; font-weight: 700; color: #2c4a3a; }
.totals-rec { padding: 15px; border-radius: 8px; margin-top: 20px; font-size: 14px; font-weight: 600; text-align: center; }
.totals-rec.verde { background: #f0fdf4; color: #065f46; }
.totals-rec.amarillo { background: #fffbeb; color: #92400e; }
.totals-rec.rojo { background: #fef2f2; color: #991b1b; }

/* ==========================================================================
   FAB EXPORTAR Y ACTUALIZACIONES
   ========================================================================== */
.export-fab { position: fixed; bottom: 30px; right: 30px; z-index: 1000; opacity: 0; pointer-events: none; transition: 0.3s; }
.export-fab.visible { opacity: 1; pointer-events: auto; }
.export-fab-btn { background: #c4a030; color: #fff; border: none; padding: 15px 25px; border-radius: 30px; font-family: inherit; font-weight: bold; box-shadow: 0 4px 15px rgba(196, 160, 48, 0.4); cursor: pointer; }

.update-banner {
    position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
    background: #2c4a3a; color: white; padding: 15px 25px; border-radius: 50px;
    display: flex; align-items: center; gap: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 10000; transition: bottom 0.5s ease;
    width: 90%; max-width: 400px;
}
.update-banner.visible { bottom: 30px; }
.update-banner button { background: #f8f6f1; color: #2c4a3a; border: none; padding: 8px 15px; border-radius: 20px; font-weight: 700; cursor: pointer; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }