
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* =========================================
   RESETEO DE MÁRGENES (Elimina los bordes blancos)
   ========================================= */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    overflow-x: hidden;
}

/* =========================================
   ANIMACIONES: FLORECIMIENTO Y BOTONES
   ========================================= */
@keyframes florecimiento {
    0% { 
        opacity: 0; 
        transform: scale(0.97) translateY(15px); 
        filter: blur(5px);
    }
    100% { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
        filter: blur(0);
    }
}

.vista-activa {
    animation: florecimiento 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}

.btn-dinamico {
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
}

.btn-dinamico:hover {
    transform: translateY(-4px) scale(1.03) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4) !important;
    filter: brightness(1.1);
}

:root {
  --color-brand-forest: #063F1F;
  --color-brand-forest-900: #06351F;
  --color-brand-forest-700: #063F1F;
  --color-brand-forest-500: #3C775C;
  --color-brand-sage-100: #DCE8E0;
  --color-brand-cream: #F5F1E8;
  --color-surface-white: #FFFFFF;
  --color-text-primary: #183126;
  --color-text-muted: #63736B;
  --color-border-subtle: #D9E1DC;
  --color-accent-sun: #D8A93B;

  --font-display: Poppins, Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  --text-h1: 56px;
  --text-h2: 40px;
  --text-h3: 28px;
  --text-body-lg: 20px;
  --text-body: 16px;
  --text-body-sm: 14px;
  --text-caption: 12px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 80px;
  --space-10: 120px;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --shadow-card: 0 10px 30px rgba(6,53,31,.08);
  --shadow-float: 0 18px 45px rgba(6,53,31,.14);
}

.btn-primary {
  background: var(--color-brand-forest);
  color: var(--color-surface-white);
  border: 0;
  border-radius: var(--radius-pill);
  padding: var(--space-4) var(--space-5);
  font: 600 var(--text-body) / 1 var(--font-body);
}

.btn-secondary {
  background: transparent;
  color: var(--color-brand-forest);
  border: 1px solid var(--color-brand-forest);
  border-radius: var(--radius-pill);
  padding: var(--space-4) var(--space-5);
  font: 600 var(--text-body) / 1 var(--font-body);
}


body { 
    font-family: 'Poppins', sans-serif; 
    /* Fondo general: Blanco perla luminoso hacia un verde agua muy suave */
    background: linear-gradient(135deg, #fdfefe 0%, #e0ece4 100%); 
    color: #0d2818; 
    padding: 20px; 
    min-height: 100vh;
    margin: 0;
}

/* --- HERO SECTION ORIGINAL --- */
.hero-section {
    position: relative;
    width: 100%;
    min-height: 380px;
    background-image: url('https://i.imgur.com/jbebAua.jpeg');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-bottom: 4px solid #2d6a4f;
}

.hero-overlay {
    width: 100%;
    height: 100%;
    min-height: 380px;
    background: radial-gradient(circle, rgba(10, 25, 18, 0.75) 0%, rgba(5, 15, 10, 0.92) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    box-sizing: border-box;
}

.hero-logo {
    width: 100%;
    max-width: 320px;       /* Evita que se desborde y mantiene la nitidez */
    height: auto;           /* Conserva la proporción original del PNG */
    object-fit: contain;
    margin-bottom: 16px;
    display: block;
}

.hero-title {
    color: #ffffff;
    font-size: 38px;
    font-weight: 700;
    margin: 0 0 6px 0;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    color: #52b788;
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 14px 0;
}

.hero-text {
    color: #e5e7eb;
    font-size: 14px;
    max-width: 580px;
    line-height: 1.5;
    margin: 0 auto;
}

/* --- PANEL DE ADMINISTRACIÓN --- */
.tarjeta-admin { 
    background: #ffffff; padding: 25px; border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(27, 67, 50, 0.08); 
    max-width: 600px; margin: 0 auto 30px auto; 
    border-top: 5px solid #2d6a4f; 
}

/* Panel de Estadísticas / Totales */
.inventory-stats {
    display: flex; justify-content: space-between; margin-bottom: 20px; gap: 10px;
}
.stat {
    background-color: #f1f7f3; padding: 15px 5px; border-radius: 12px; width: 32%; text-align: center;
    border: 1px solid #d8eadd;
}
.stat h4 { margin: 0 0 10px 0; font-size: 0.85em; color: #2d6a4f; }
.stat p { margin: 0; font-size: 1.8em; font-weight: bold; color: #1b4332; }
.total-general {
    text-align: center; color: #1b4332; font-size: 1.4em; margin-bottom: 20px;
    border-top: 2px solid #d8eadd; padding-top: 15px;
}

/* Formularios y Botones */
input, select, textarea, button { 
    display: block; width: 100%; margin-bottom: 12px; 
    padding: 12px; box-sizing: border-box; 
    border: 1px solid #c7dcd0; border-radius: 10px;
    background-color: #fafcfa;
    font-family: 'Poppins', sans-serif; font-size: 14px; color: #0d2818;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { 
    outline: none; border-color: #40916c; 
    box-shadow: 0 0 0 3px rgba(64, 145, 108, 0.15); 
}

button.btn-principal { 
    background: #2d6a4f; color: white; border: none; cursor: pointer; font-weight: 600; border-radius: 10px;
    transition: background 0.3s;
}
button.btn-principal:hover { background: #1b4332; }

/* --- DISEÑO EN MOSAICO (GRID) --- */
#listaPlantulas {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px;
    padding: 0; margin: 0; list-style: none; max-width: 1200px; margin: 0 auto;
}

.item-planta { 
    background: #ffffff; border-radius: 16px; overflow: hidden; border: 1px solid #eef4f0;
    box-shadow: 0 8px 20px rgba(27, 67, 50, 0.06); 
    display: flex; flex-direction: column; transition: transform 0.3s, box-shadow 0.3s;
}
.item-planta:hover { 
    transform: translateY(-5px); box-shadow: 0 15px 30px rgba(27, 67, 50, 0.12);
}

.img-arbol {
    width: 100%; height: 200px; object-fit: cover; background: #e0ece4; 
    border-bottom: 3px solid #74c69d; 
}
.info-arbol { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; text-align: left; }
.info-arbol h3 { margin: 0 0 2px 0; color: #1b4332; font-size: 19px; font-weight: 600; }
.info-arbol i { color: #52796f; font-size: 13px; display: block; margin-bottom: 12px; }
.info-arbol p { font-size: 13.5px; color: #354f52; line-height: 1.6; margin-bottom: 15px; flex-grow: 1; }

.estadisticas { 
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid #eef4f0; padding-top: 15px;
}
.estado-tag {
    background: #d8eadd; color: #1b4332; padding: 5px 12px;
    border-radius: 20px; font-size: 11px; font-weight: bold;
}

/* Botones de acción en tarjetas */
.btn-retirar {
    background:#a1b00b; color: white; border: none; padding: 8px 12px; 
    font-size: 12px; border-radius: 8px; cursor: pointer; font-weight: bold; margin-top: 10px; width: 100%;
}
.btn-retirar:hover { background: #a1b00b; }

.btn-editar {
    background: #40916c; color: white; border: none; padding: 8px 12px; 
    font-size: 12px; border-radius: 8px; cursor: pointer; font-weight: bold; margin-top: 10px; width: 100%;
}
.btn-editar:hover { background: #2d6a4f; }

/* --- PIE DE PÁGINA (VISITANTES) --- */
.footer-discreto {
    text-align: center;
    margin-top: 60px;
    padding: 30px 20px;
    border-top: 1px solid #c7dcd0;
    color: #52796f;
    font-size: 14px;
}

.footer-discreto span {
    color: #888;
    cursor: pointer;
    font-size: 12px;
    transition: color 0.3s;
    display: inline-block;
    margin-top: 10px;
}

.footer-discreto span:hover {
    color: #2d6a4f;
    text-decoration: underline;
}

/* Ocultar el viejo boton gigante */
.footer-admin { display: none; }

/* --- VENTANAS FLOTANTES (MODALES) --- */
.oculto { display: none !important; }

.modal {
    position: fixed !important; z-index: 9999 !important; left: 0 !important; top: 0 !important; 
    width: 100vw !important; height: 100vh !important;
    background-color: rgba(8, 28, 21, 0.75) !important; 
    backdrop-filter: blur(5px) !important; 
    display: flex; justify-content: center !important; align-items: center !important;
}

.modal-contenido {
    background: #ffffff !important; padding: 30px !important; border-radius: 16px !important; 
    width: 90% !important; max-width: 500px !important; position: relative !important; 
    border-top: 6px solid #40916c !important; 
    box-shadow: 0 15px 50px rgba(8, 28, 21, 0.4) !important; 
    max-height: 85vh !important; overflow-y: auto !important; text-align: left;
}

.cerrar-modal {
    position: absolute !important; top: 15px !important; right: 20px !important; 
    font-size: 28px !important; cursor: pointer !important; color: #52796f !important;
    font-weight: bold !important; line-height: 1 !important;
}
.cerrar-modal:hover { color: #e07a5f !important; }

/* --- CARRITO DE COTIZACIONES --- */
.carrito-flotante {
    position: fixed; bottom: 30px; right: 30px;
    background: #2d6a4f; color: white;
    padding: 15px 25px; border-radius: 50px;
    font-size: 20px; cursor: pointer;
    box-shadow: 0 10px 20px rgba(27, 67, 50, 0.4);
    display: flex; align-items: center; gap: 10px;
    transition: transform 0.3s, background 0.3s;
    z-index: 1000;
}
.carrito-flotante:hover { transform: scale(1.05); background: #1b4332; }
.carrito-flotante span {
    background: #e07a5f; font-size: 15px; padding: 2px 10px;
    border-radius: 20px; font-weight: bold;
}

.lista-carrito { list-style: none; padding: 0; margin: 0 0 20px 0; max-height: 250px; overflow-y: auto; }
.lista-carrito li { 
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #eef4f0; font-size: 14px;
}
.lista-carrito button.btn-quitar { 
    background: #e07a5f; border: none; color: white; border-radius: 5px;
    cursor: pointer; padding: 4px 8px; font-size: 12px; margin-bottom: 0; width: auto;
}
.total-carrito { font-size: 15px; color: #1b4332; margin-bottom: 20px; text-align: right; }

/* Botón añadir en la tarjeta */
.btn-add-carrito {
    background: #f1f7f3; color: #2d6a4f; border: 1px solid #d8eadd;
    padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;
    width: 100%; margin-top: 15px; transition: background 0.3s;
}
.btn-add-carrito:hover { background: #d8eadd; }
/* --- ESTILO CLÁSICO ESTRUCTURADO (INSPIRACIÓN GITHUB) --- */
.item-planta {
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(31, 35, 40, 0.08);
    transition: border-color 0.2s;
}

.item-planta:hover {
    border-color: #0969da;
}

.img-arbol {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
}

.info-arbol {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-arbol h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2328;
}

.info-arbol i {
    font-size: 12px;
    color: #57606a;
}

.info-arbol p {
    font-size: 13px;
    color: #57606a;
    line-height: 1.4;
    margin: 4px 0 8px 0;
}

.estadisticas {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid #d0d7de;
    border-bottom: 1px solid #d0d7de;
    font-size: 12px;
    color: #57606a;
}

.acciones-tarjeta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

/* Botones con estilo tipo repositorio / interfaz técnica */
.btn-classic-primary {
    background-color: #2da44e;
    color: #ffffff;
    border: 1px solid rgba(27, 31, 36, 0.15);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    width: 100%;
}
.btn-classic-primary:hover {
    background-color: #2c974b;
}

.btn-classic-secondary {
    background-color: #f6f8fa;
    color: #24292f;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    width: 100%;
}
.btn-classic-secondary:hover {
    background-color: #f3f4f6;
    border-color: #b1bac4;
}

.btn-classic-danger {
    background-color: #f6f8fa;
    color: #cf222e;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
.btn-classic-danger:hover {
    background-color: #ffebe9;
    border-color: rgba(255, 129, 130, 0.4);
}
/* =========================================
   SUPERPOSICIÓN DE TOKENS (PALETA DISTRIBUIDA)
   ========================================= */

/* 1. Tarjetas, Árbol Madre y Login (Verde Bosque Oscuro) */
.btn-classic-primary,
#formArbolMatriz button.btn-principal,
#modalLogin button.btn-principal,
#modalBosquesino button.btn-principal {
    background-color: var(--color-brand-forest) !important;
    color: var(--color-surface-white) !important;
    border: none !important;
    border-radius: var(--radius-pill) !important;
    font-family: var(--font-body) !important;
    font-weight: 600 !important;
}
.btn-classic-primary:hover,
#formArbolMatriz button.btn-principal:hover {
    background-color: var(--color-brand-forest-900) !important;
}

/* 2. Semilleros, Cosechas y Carrito Flotante (Acento Sol / Dorado) */
#formLote button.btn-principal,
.carrito-flotante,
#modalDetalleEspecie button[onclick="apadrinarArbol()"] {
    background-color: var(--color-accent-sun) !important;
    color: var(--color-text-primary) !important; /* Texto verde oscuro para que lea bien sobre el dorado */
    border: none !important;
    border-radius: var(--radius-pill) !important;
    font-family: var(--font-body) !important;
    font-weight: 700 !important;
}
#formLote button.btn-principal:hover,
.carrito-flotante:hover {
    background-color: #c99b2e !important; /* Un dorado ligeramente más oscuro al pasar el mouse */
    transform: scale(1.03);
}

/* 3. Vitrina Pública y Adquisiciones (Verde Medio Vibrante) */
#formEspecie button.btn-principal,
#modalDetalleEspecie button[onclick="adquirirEjemplar()"] {
    background-color: var(--color-brand-forest-500) !important;
    color: var(--color-surface-white) !important;
    border: none !important;
    border-radius: var(--radius-pill) !important;
    font-family: var(--font-body) !important;
    font-weight: 600 !important;
}
#formEspecie button.btn-principal:hover,
#modalDetalleEspecie button[onclick="adquirirEjemplar()"]:hover {
    background-color: var(--color-brand-forest) !important;
}

/* 4. Botones Secundarios (Blancos con borde Verde Salvia) */
.btn-classic-secondary, 
.btn-add-carrito {
    background-color: var(--color-surface-white) !important;
    color: var(--color-brand-forest) !important;
    border: 2px solid var(--color-brand-sage-100) !important;
    border-radius: var(--radius-pill) !important;
    font-family: var(--font-body) !important;
    font-weight: 600 !important;
}
.btn-classic-secondary:hover, 
.btn-add-carrito:hover {
    background-color: var(--color-brand-sage-100) !important;
    border-color: var(--color-brand-forest-500) !important;
}

/* 5. Botones de Pérdida o Eliminar (Se mantienen Rojos por seguridad) */
.btn-classic-danger, 
.btn-quitar {
    background-color: #fff0f0 !important;
    color: #cf222e !important;
    border: 1px solid rgba(207, 34, 46, 0.4) !important;
    border-radius: var(--radius-pill) !important;
    font-family: var(--font-body) !important;
    font-weight: 600 !important;
}
.btn-classic-danger:hover, 
.btn-quitar:hover {
    background-color: #cf222e !important;
    color: #ffffff !important;
}

/* =========================================
   CORRECCIÓN DE MODALES (MICROSITIOS AL CENTRO)
   ========================================= */
.modal:not(.oculto) {
    position: fixed !important; /* Lo ancla a la pantalla, no al documento */
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important; /* Ocupa el 100% del ancho visual */
    height: 100vh !important; /* Ocupa el 100% del alto visual */
    background-color: rgba(6, 63, 31, 0.85) !important; /* Fondo verde oscuro semitransparente */
    z-index: 99999 !important; /* Obliga a tapar la barra de navegación que tiene 1000 */
    display: flex !important;
    align-items: center !important; /* Lo centra verticalmente */
    justify-content: center !important; /* Lo centra horizontalmente */
    overflow-y: auto !important; /* Permite scroll interno si la tarjeta es muy larga */
}

/* Ajuste para que la cajita blanca no se pegue a los bordes en celulares */
.modal-contenido {
    max-height: 90vh !important;
    overflow-y: auto !important;
    margin: auto !important;
    position: relative !important;
}