/* Estilos actualizados para imágenes reales y galerías */
:root {
    --bg-primary: #121814;
    --bg-secondary: #1a231c;
    --bg-card: #202b22;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-primary: #22c55e;
    --accent-secondary: #16a34a;
    --border-color: #2e3d31;
}

body.light {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent-primary: #16a34a;
    --accent-secondary: #15803d;
    --border-color: #e2e8f0;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: var(--accent-primary);
    border-radius: 8px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-primary);
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.theme-toggle, .hamburger {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.2rem;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-main);
}

/* Hero */
.hero {
    padding: 10rem 0 5rem 0;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-subtitle {
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.hero-description {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-image-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.hero-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 12px;
}

/* Contact Icon Buttons */
.contact-icon-btn {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.contact-icon-btn:hover,
.contact-icon-btn:focus {
    background-color: var(--bg-card);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    color: var(--accent-primary);
    outline: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-secondary);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* Sections */
section {
    padding: 5rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--accent-primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-muted);
}

/* Grids & Cards */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

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

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.card-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tag-mini {
    background-color: var(--bg-primary);
    color: var(--accent-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

/* Gallery Section */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 220px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #ffffff;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: center;
}

.about-text p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.skills-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.skill-tag {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Hydroponics Highlight */
.hydro-highlight {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 3rem;
}

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

.hydro-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.hydro-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.hydro-item h4 {
    margin-bottom: 0.25rem;
}

.hydro-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Stats */
.stats-section {
    background-color: var(--bg-secondary);
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

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

.stat-item h3 {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
}

.stat-item p {
    color: var(--text-muted);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.filter-btn.active, .filter-btn:hover {
    background-color: var(--accent-primary);
    color: #ffffff;
    border-color: var(--accent-primary);
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Modal / Lightbox */
.modal-overlay, .lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-overlay.active, .lightbox.active {
    display: flex;
}

.modal-container, .lightbox-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 600px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close, .lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .hero-grid, .about-grid {
        grid-template-columns: 1fr;
    }
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: var(--bg-primary);
        padding: 1.5rem;
        border-bottom: 1px solid var(--border-color);
    }
    .nav-menu.active {
        display: flex;
    }
    .hamburger {
        display: flex;
    }
}
/* Efecto botones de contacto */
a[title="Correo"],
a[title="WhatsApp"],
a[title="LinkedIn"] {
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
    -webkit-tap-highlight-color: transparent;
}

a[title="Correo"]:active,
a[title="WhatsApp"]:active,
a[title="LinkedIn"]:active {
    transform: scale(.94);
    background: rgba(34, 197, 94, 0.18) !important;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.18);
}

/* Buscador del blog */
.search-bar-wrapper {
    max-width: 680px;
    margin: 0 auto 1.25rem;
}
.search-input {
    width: 100%;
    box-sizing: border-box;
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    font: inherit;
    outline: none;
}
.search-input::placeholder {
    color: var(--text-muted);
}
.search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

/* Ajustes móviles del inicio */
@media (max-width: 768px) {
    .hero {
        padding: 6.5rem 0 3rem;
    }
    .hero-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .hero-buttons .btn {
        text-align: center;
        padding: 0.8rem 0.7rem;
    }
    .hero-buttons .btn:last-child {
        grid-column: 1 / -1;
    }
}

/* ===== IDENTIDAD AGROINGENIO LAB ===== */
.nav-logo {
    gap: 0.65rem;
}

.nav-logo img.logo-icon {
    width: 38px;
    height: 38px;
    display: block;
    object-fit: contain;
    background: none !important;
    border-radius: 11px;
    flex-shrink: 0;
}

.nav-logo span {
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .nav-logo {
        gap: 0.55rem;
    }

    .nav-logo img.logo-icon {
        width: 36px;
        height: 36px;
    }

    .nav-logo span {
        font-size: 1.08rem;
    }
}

/* ===== ASISTENTE AGROINGENIO WIDGET ===== */
.agro-assistant-wrapper {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9999;
    font-family: inherit;
}

.agro-assistant-launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 999px;
    padding: 9px 14px 9px 9px;
    box-shadow: 0 14px 40px rgba(0,0,0,.28);
    cursor: pointer;
    font-weight: 700;
    transition: transform .2s ease, opacity .2s ease;
}

.agro-assistant-launcher:hover {
    transform: translateY(-2px);
}

.agro-assistant-launcher.hidden {
    opacity: 0;
    pointer-events: none;
}

.agro-assistant-launcher img {
    width: 38px;
    height: 38px;
    border-radius: 11px;
}

.agro-assistant-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(390px, calc(100vw - 28px));
    height: min(570px, calc(100vh - 90px));
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 22px 70px rgba(0,0,0,.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(18px) scale(.96);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.agro-assistant-panel.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.agro-assistant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.agro-assistant-brand {
    display: flex;
    gap: 10px;
    align-items: center;
}

.agro-assistant-brand img {
    width: 40px;
    height: 40px;
    border-radius: 11px;
}

.agro-assistant-brand strong,
.agro-assistant-brand small {
    display: block;
}

.agro-assistant-brand small {
    color: var(--text-muted);
    font-size: .72rem;
    margin-top: 2px;
}

.agro-assistant-actions {
    display: flex;
    gap: 6px;
}

.agro-assistant-actions button {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-main);
    font-size: 1.4rem;
    cursor: pointer;
}

.agro-assistant-actions button:hover {
    background: var(--bg-primary);
}

.agro-assistant-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.agro-assistant-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.agro-assistant-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 800;
    flex-shrink: 0;
}

.agro-assistant-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px 14px 14px 14px;
    padding: 12px 13px;
    line-height: 1.5;
}

.agro-assistant-bubble p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: .92rem;
}

.agro-assistant-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 18px;
}

.agro-assistant-chips button {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-main);
    border-radius: 12px;
    padding: 10px;
    text-align: left;
    cursor: pointer;
    font-size: .82rem;
}

.agro-assistant-chips button:hover {
    border-color: var(--accent-primary);
}

.agro-assistant-footer {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.agro-assistant-footer textarea {
    flex: 1;
    resize: none;
    min-height: 42px;
    max-height: 100px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-main);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
    font: inherit;
}

.agro-assistant-footer textarea:focus {
    border-color: var(--accent-primary);
}

.agro-assistant-footer button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--accent-primary);
    color: white;
    font-size: 1.15rem;
    cursor: pointer;
}

.agro-assistant-note {
    text-align: center;
    color: var(--text-muted);
    font-size: .69rem;
    padding: 0 10px 8px;
    background: var(--bg-secondary);
}

@media (max-width: 520px) {
    .agro-assistant-wrapper {
        right: 12px;
        bottom: 12px;
    }

    .agro-assistant-panel {
        width: calc(100vw - 24px);
        height: min(560px, calc(100vh - 80px));
    }

    .agro-assistant-launcher span {
        font-size: .88rem;
    }
}

/* ===== FIX PANEL ASISTENTE ===== */
.agro-assistant-panel {
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
}

/* ===== MENSAJES GEMINI AGROINGENIO ===== */
.agro-assistant-message {
    margin-bottom: 12px;
}

.agro-assistant-message.user {
    flex-direction: row-reverse;
}

.agro-assistant-message.user .agro-assistant-avatar {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
}

.agro-assistant-message.user .agro-assistant-bubble {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
    border-radius: 14px 4px 14px 14px;
}

.agro-assistant-message.user .agro-assistant-bubble p {
    color: #fff;
}

.agro-assistant-bubble p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.agro-assistant-footer button:disabled {
    opacity: .65;
    cursor: wait;
}

/* ===== FORMATO RESPUESTAS GEMINI ===== */
.agro-assistant-bubble p strong {
    font-weight: 750;
    color: inherit;
}

.agro-assistant-bubble p code {
    font-family: monospace;
    font-size: .88em;
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.agro-assistant-message.user .agro-assistant-bubble code {
    background: rgba(0,0,0,.14);
    border-color: rgba(255,255,255,.2);
}

/* ===== FORMATO RESPUESTAS GEMINI FINAL ===== */
.agro-assistant-bubble p strong {
    font-weight: 750;
    color: inherit;
}

.agro-assistant-bubble p code {
    font-family: monospace;
    font-size: .88em;
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

/* AGRO-GALLERY-CLEAN */
.gallery-item {
    cursor: default;
}

.gallery-item:hover .gallery-img {
    transform: none;
}
