/* =========================================
   GENESIS APP - DISEÑO HÍBRIDO + SPOTLIGHT + STEPPER
========================================= */
:root {
    --genesis-gold: #C5A065;
    --genesis-green: #1a2f24;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #333333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    display: block;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =========================================
   MARCO PRINCIPAL
========================================= */
.app-frame {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-color);
    position: relative;
    color: var(--text-main);
}

.view {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
    padding-bottom: 100px;
    min-height: 100vh;
    background-color: var(--bg-color);
    position: relative;
}

.absolute-view {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    min-height: 100%;
    background-color: var(--bg-color);
    /* CORRECCIÓN CRÍTICA: Z-INDEX 200 PARA TAPAR EL BUSCADOR */
    z-index: 200;
}

.hidden {
    display: none !important;
}

/* =========================================
   HOME
========================================= */
#view-home {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

.brand-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    animation: fadeIn 0.8s ease-out;
}

.brand-logo-img {
    width: 80%;
    max-width: 300px;
    height: auto;
    object-fit: contain;
    display: block;
}

.primary-btn {
    width: 100%;
    background-color: var(--genesis-green);
    color: #fff;
    border: none;
    padding: 22px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 16px;
    box-shadow: 0 10px 20px rgba(26, 47, 36, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.1s, background-color 0.2s;
}

.primary-btn:hover {
    background-color: #233d30;
}

.primary-btn:active {
    transform: scale(0.98);
}

.secondary-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.secondary-btn {
    flex: 1;
    background: transparent;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 12px;
    color: #999;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: default;
}

/* =========================================
   CABECERAS
========================================= */
.header-nav.minimal-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    margin-bottom: 25px;
}

.header-title-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--genesis-green);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    background: transparent;
    border: none;
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.back-icon-btn,
.sync-icon-btn {
    color: var(--genesis-gold);
}

.sync-icon-btn.loading svg {
    animation: spin 1s linear infinite;
    opacity: 0.5;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================
   BUSCADOR ESTILO "SPOTLIGHT"
========================================= */
.search-section {
    margin-bottom: 20px;
    position: relative;
    z-index: 50;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    background: #fff;
    border: 1px solid #333;
    /* Borde oscuro elegante */
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    height: 50px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.search-icon-svg {
    color: #333;
    margin-right: 10px;
}

#main-search,
#station-search {
    border: none;
    background: transparent;
    width: 100%;
    height: 100%;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    outline: none;
    padding: 0;
}

#main-search::placeholder,
#station-search::placeholder {
    color: #ccc;
    font-family: sans-serif;
    font-weight: 400;
}

.search-clear {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0 5px;
}

/* LISTA DE RESULTADOS FLOTANTE */
.search-results-box {
    position: absolute;
    top: 60px;
    /* Debajo del input */
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 100;
    padding: 5px 0;
}

.result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background-color: #f0f0f0;
}

.result-title {
    font-size: 16px;
    font-weight: 900;
    color: #000;
    font-family: 'Playfair Display', serif;
    margin-bottom: 4px;
}

.result-meta {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* =========================================
   TOGGLE
========================================= */
.toggle-container {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    padding: 4px;
    display: flex;
    position: relative;
    margin-bottom: 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    height: 50px;
}

.toggle-bg {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background-color: var(--genesis-green);
    border-radius: 40px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(26, 47, 36, 0.3);
    z-index: 1;
}

.toggle-bg.right {
    transform: translateX(100%);
}

.toggle-btn {
    flex: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #999;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.3s;
    border-radius: 40px;
}

.toggle-btn.active {
    color: #ffffff;
}

/* =========================================
   LISTAS Y GRILLAS
========================================= */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    padding-bottom: 40px;
}

.station-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.station-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.station-card:active {
    border-color: var(--genesis-gold);
    background: #fcfbf8;
}

.recipe-item-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    border: 1px solid #eee;
    cursor: pointer;
    transition: border-color 0.2s;
}

.recipe-item-card:hover {
    border-color: var(--genesis-gold);
}

/* =========================================
   DETALLE DE RECETA
========================================= */
#recipe-image-container {
    margin-bottom: 30px;
}

.main-image-frame {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #fff;
    border-radius: 20px;
    border: 5px solid var(--genesis-gold);
    outline: 2px solid #fff;
    outline-offset: -7px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.main-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumbnails-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.thumb-frame {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    overflow: hidden;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: 0.3s;
}

.thumb-frame.active {
    opacity: 1;
    border-color: var(--genesis-gold);
    transform: scale(1.15);
}

.thumb-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Texto y Tablas */
.section-title {
    margin-top: 20px;
    color: var(--genesis-green);
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-bottom: 30px;
}

td {
    padding: 14px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

td:first-child {
    font-weight: 600;
    color: var(--genesis-green);
    border-left: 3px solid transparent;
}

tr:hover td:first-child {
    border-left-color: var(--genesis-gold);
}

td:last-child {
    text-align: right;
    font-weight: 700;
    color: #555;
}

.steps-box {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.step-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    color: var(--genesis-gold);
    font-weight: 700;
    line-height: 1;
    min-width: 30px;
    text-align: right;
}

.step-card {
    flex: 1;
    background-color: var(--card-bg);
    padding: 16px;
    border-radius: 0 12px 12px 12px;
    font-size: 15px;
    color: #444;
    line-height: 1.5;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* =========================================
   LIGHTBOX
========================================= */
#toast-container {
    position: fixed;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 999;
}

.toast {
    background: var(--genesis-green);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border: 2px solid var(--genesis-gold);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 35px;
    cursor: pointer;
}

.lb-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    font-size: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s;
}

.lb-prev {
    left: 20px;
}

.lb-next {
    right: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   CALCULADORA & RENDIMIENTO (FINAL)
========================================= */
.header-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    flex-wrap: nowrap;
}

.header-split .section-title {
    margin: 0;
    border: none;
    font-size: 16px;
    white-space: nowrap;
}

/* Contenedor Herramientas */
.scale-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.scale-info-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.scale-label {
    font-size: 9px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    text-align: right;
    line-height: 1;
}

/* Stepper (Botones + Input) */
.stepper-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--genesis-gold);
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    height: 38px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.scale-btn {
    background-color: var(--genesis-gold);
    color: #fff;
    border: none;
    width: 36px;
    height: 100%;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 4px;
    margin: 0;
}

.scale-btn:active {
    background-color: #8f7243;
}

#scale-input {
    width: 50px;
    height: 100%;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    font-size: 16px;
    font-weight: normal;
    /* Sin negrita para que se vea limpio */
    color: var(--genesis-green);
    background: #fff;
    -moz-appearance: textfield;
    border-radius: 0;
    padding: 0;
}

#scale-input:focus {
    outline: none;
    background-color: #fcfbf8;
}

#scale-input::-webkit-outer-spin-button,
#scale-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#unit-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--genesis-gold);
    white-space: nowrap;
}

/* Botón Reset */
.reset-btn {
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    margin-left: 2px;
    transition: color 0.3s;
}

.reset-btn:active {
    color: var(--genesis-green);
    transform: rotate(-30deg);
}

/* Banner Rendimiento */
.yield-info-banner {
    background-color: var(--genesis-green);
    color: #ffffff;
    padding: 12px 15px;
    border-radius: 10px;
    margin: 20px 0 15px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 13px;
    border-left: 4px solid var(--genesis-gold);
    box-shadow: 0 4px 12px rgba(26, 47, 36, 0.1);
}

.yield-label {
    letter-spacing: 0.5px;
    opacity: 0.9;
    font-size: 10px;
    text-transform: uppercase;
}

#yield-value-display {
    font-size: 14px;
    color: var(--genesis-gold);
    text-align: right;
}

/* Indicador de Multiplicador (Lotes) */
.batch-badge {
    background-color: var(--genesis-green);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    margin-left: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.station-count {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    font-weight: 600;
}
