/* ==========================================================================
   AGROCONEXIÓN - CSS PRINCIPAL (ESCRITORIO)
   Archivo: index.css (CORREGIDO)
   ========================================================================== */ 

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

/* Usamos la clase específica .grid_container para asegurar que el Grid funcione */
body.grid_container {
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    color: #333;
    background: #f5f6fa;
    min-height: 100vh;
    
    /* DEFINICIÓN ROBUSTA DEL GRID */
    display: grid;
    grid-template-areas:
        "aside_left header header"
        "aside_left navbar navbar"
        "aside_left main aside_right"
        "aside_left footer footer";
    
    /* Columna 1: Menú lateral (240px)
       Columna 2: Contenido principal (flexible)
       Columna 3: Panel derecho (280px)
    */
    grid-template-columns: 240px 1fr 280px;
    
    /* Fila 1: Header (auto ajustado a imagen)
       Fila 2: Navbar (auto)
       Fila 3: Contenido principal (1fr - ocupa el resto del espacio)
       Fila 4: Footer (auto)
    */
    grid-template-rows: auto auto 1fr auto;
    
    transition: all 0.3s ease;
}

/* Aseguramos que el botón toggle no interfiera en el grid de escritorio */
.toggle-button {
    display: none;
}

/* --- 2. ASIDE LEFT (Menú Lateral) --- */
.aside_left {
    grid-area: aside_left;
    background: linear-gradient(180deg, #3a8901, #2e6b01);
    display: flex;
    flex-direction: column;
    padding-top: 10px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.15);
    z-index: 100;
}

.aside_left .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 1px;
}

.aside_left .logo img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid #fff;
}

.aside_left ul {
    list-style: none;
    margin-top: 20px;
}

.aside_left li {
    position: relative;
}

/* Estilos de enlaces unificados (Antes estaban duplicados) */
.aside_left a {
    position: relative; /* Mantiene elementos dentro del flujo */
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    transition: background 0.3s, padding-left 0.3s;
    font-weight: 500;
}

.aside_left a:hover {
    background: rgba(255, 255, 255, 0.15);
    padding-left: 25px;
}

.nav-item {
    margin-left: 10px;
}

/* Submenú */
.submenu {
    background: #265200;
    display: none;
    margin-left: 10px;
    border-left: 3px solid #5cb85c;
}

.submenu a {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.has-submenu.open .submenu {
    display: block;
}

/* --- 3. HEADER --- */
.header {
    grid-area: header;
    width: 100%;
    height: auto;
}

.header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- 4. NAVBAR --- */
.navbar {
    grid-area: navbar;
    background: #fff;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 500;
}

.navbar .navbar-search,
.navbar .navbar-actions {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-container {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 40px;
    gap: 10px;
}

.search-container input[type="search"] {
    flex-grow: 1;
    border-radius: 25px;
    border: 1px solid #ccc;
    padding: 8px 15px;
    outline: none;
    transition: border 0.3s;
    background: #f9f9f9;
    width: 100%;
}

.search-container input[type="search"]:focus {
    border-color: #3a8901;
    background: #fff;
}

.search-container button {
    border-radius: 25px;
    border: none;
    padding: 8px 20px;
    background: #3a8901;
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.search-container button:hover {
    background: #2e6b01;
}

.upload-link {
    display: flex;
    align-items: center;
    background-color: #3a8901;
    color: white !important;
    padding: 6px 15px;
    border-radius: 20px;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}

.upload-link:hover {
    background-color: #3a8901;
    transform: translateY(-2px);
}

.upload-link .material-icons {
    margin-right: 8px;
    font-size: 20px;
}

/* --- 5. ASIDE RIGHT (Panel Derecho) --- */
.aside_right {
    grid-area: aside_right;
    background: #f8fff5;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-left: 1px solid #e0e0e0;
}

/* Estilos unificados para tarjetas (Dolar y Denuncia) */
.dolar, .denuncia {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
    border: 1px solid #eee;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dolar:hover, .denuncia:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}

.dolar h3, .denuncia h3 {
    color: #3a8901;
    font-size: 1rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 1px dashed #e0e0e0;
    padding-bottom: 8px;
}

.dolar .price {
    font-size: 1.6rem;
    font-weight: 800;
    color: #2e6b01;
    margin-top: 5px;
}

.dolar .date {
    color: #888;
    font-size: 0.8rem;
    margin-top: 5px;
}

.denuncia img {
    width: 90%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    margin: auto;
}

.denuncia a {
    display: block;
    text-decoration: none;
}

/* --- 6. MAIN CONTENT --- */
.main {
    grid-area: main;
    padding: 25px;
    background: #fff;
    margin: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.03);
}

.main h2 {
    color: #3a8901;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8f5e9;
    font-size: 1.5rem;
}

/* --- 7. GRID DE PRODUCTOS --- */
.product-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    border: 2px solid #2e6b01;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #3a8901;
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.product-image-container {
    position: relative;
    overflow: hidden;
    background-color: #f4f4f4;
}

.product-image-container img {
    width: 100%;
    height: 220px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* --- 8. BADGES Y ETIQUETAS (Consolidados) --- */

/* Badge: NUEVO (Azul) */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #2196F3;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Badge: TIPO (SE VENDE / SE COMPRA) - Versión Final */
.product-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem; 
    font-weight: 900;   
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    z-index: 10;
}

.badge-venta {
    background-color: #2e7d32; /* Verde */
    color: #ffffff;
    border: 1px solid #1b5e20;
}

.badge-compra {
    background-color: #ff6d00; /* Naranja */
    color: #ffffff;
    border: 1px solid #e65100;
}

/* Overlay Hover */
.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.quick-view-btn {
    background: #fff;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 0.85rem;
    color: #3a8901;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-weight: bold;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.product-card:hover .quick-view-btn {
    transform: translateY(0);
}

/* Información del producto */
.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.05rem;
    line-height: 1.4;
    height: 44px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Precios */
.price-multi-currency {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    background: #f9f9f9;
    padding: 8px;
    border-radius: 6px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.currency-label {
    color: #666;
    font-weight: 500;
}

.currency-value {
    font-weight: bold;
}

.price-bs { color: #3a8901; }
.price-usd { color: #1565c0; }
.price-yuan { color: #c62828; }

.product-meta {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: #777;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.product-location, .product-date {
    display: flex;
    align-items: center;
}

.product-location i, .product-date i {
    font-size: 14px;
    margin-right: 5px;
    color: #999;
}

/* --- 9. FOOTER Y MISCELÁNEOS --- */
.footer {
    grid-area: footer;
    background: #2e6b01;
    text-align: center;
    color: white;
    padding: 20px 0;
    font-size: 0.9rem;
}

.toggle-button {
    display: none; /* Solo visible en móvil */
}

/* Badge del carrito en Sidebar */
.carrito-badge {
    position: absolute;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    background-color: #ff3d00;
    color: white;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    padding: 0 4px;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

/* =========================================
   10. MODAL DE DONACIÓN (CORRECCIÓN IMPORTANTE)
   ========================================= */

/* Fondo oscuro que cubre toda la pantalla */
.modal-overlay {
    display: none; /* Oculto por defecto */
    position: fixed; /* Fijo respecto a la ventana */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 3000; /* Z-index alto para tapar menú móvil (que es 2000) */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px); /* Efecto borroso opcional */
}

/* Clase que agrega JS para mostrarlo */
.modal-overlay.active {
    display: flex !important;
}

/* Caja blanca del contenido */
.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

/* Botón cerrar (X) */
.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #f00;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@media screen and (min-width: 1023px) {
    .search-container {
        min-width: 600px;
    }