* {
    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;
}

/* FONDO GENERAL EN DEGRADADO VERDE A BLANCO */
body, html {
    width: 100%;
    min-height: 100%;
    background: linear-gradient(180deg, #052e16 0%, #15803d 30%, #f0fdf4 70%, #ffffff 100%);
    background-attachment: fixed;
    color: #1e293b;
    overflow-x: hidden;
}

/* TOAST NOTIFICACIONES */
#toast-banner {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    min-width: 280px;
    max-width: 90%;
    padding: 14px 20px;
    border-radius: 14px;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
#toast-banner.show { top: 20px; }
#toast-banner.success { background: linear-gradient(135deg, #10b981, #059669); }
#toast-banner.error { background: linear-gradient(135deg, #ef4444, #dc2626); }
#toast-banner.info { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }

/* VISTA AUTENTICACIÓN */
#auth-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
.bg-blurred {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url('login.jpg') no-repeat center center/cover;
    background-color: #052e16;
    filter: blur(8px);
    transform: scale(1.05);
    z-index: 1;
}
.auth-card {
    position: relative;
    z-index: 2;
    background: #ffffff;
    width: calc(100% - 24px);
    max-width: 400px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    margin: auto 12px;
    touch-action: pan-y;
    user-select: none;
}
.card-icon-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 20px;
    background: #f8fafc;
}
.card-icon { width: 65px; height: 65px; object-fit: contain; border-radius: 50%; box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.tabs { display: flex; border-bottom: 2px solid #f0f0f0; background: #f8fafc; }
.tab-btn {
    flex: 1; padding: 14px 10px; border: none; background: none;
    font-size: 15px; font-weight: 700; color: #64748b; cursor: pointer;
    transition: all 0.2s ease;
}
.tab-btn.active { color: #16a34a; border-bottom: 3px solid #16a34a; background: #fff; }
.form-container { padding: 20px; }
.form-section { display: none; flex-direction: column; gap: 12px; }
.form-section.active { display: flex; }
.input-group { display: flex; flex-direction: column; gap: 4px; }
.input-group label { font-size: 12px; font-weight: 700; color: #475569; }
.input-group input, .input-group select, .input-group textarea {
    width: 100%; padding: 11px; border: 1px solid #cbd5e1; border-radius: 10px;
    font-size: 14px; outline: none; background: #fff;
}
.input-group input:focus, .input-group select:focus { border-color: #16a34a; }
.password-wrapper { position: relative; display: flex; align-items: center; }
.password-wrapper input { padding-right: 40px; }
.toggle-password { position: absolute; right: 12px; cursor: pointer; opacity: 0.7; }
.captcha-box { display: flex; align-items: center; gap: 10px; }
canvas#captchaCanvas { background-color: #e2e8f0; border-radius: 8px; cursor: pointer; }
.btn-submit {
    background: linear-gradient(135deg, #16a34a, #15803d); color: white; padding: 13px; border: none;
    border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 8px;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn-submit:active { transform: translateY(1px); }
.btn-submit:disabled { opacity: 0.7; cursor: not-allowed; }

.register-info-box {
    background-color: #f0fdf4;
    border-left: 4px solid #16a34a;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #14532d;
    line-height: 1.4;
}

#loading-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 46, 22, 0.92); z-index: 3000;
    flex-direction: column; justify-content: center; align-items: center; color: white;
}
.spinner {
    width: 50px; height: 50px; border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid #4ade80; border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* BANNER INFORMATIVO INICIAL */
#welcome-banner {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 30px);
    max-width: 450px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    z-index: 4500;
    padding: 20px;
    text-align: center;
    border: 2px solid #16a34a;
    animation: popIn 0.3s ease;
}
#welcome-banner .banner-close-x {
    position: absolute;
    top: 10px;
    right: 12px;
    background: #e2e8f0;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
}
#welcome-banner img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin: 10px 0;
}

/* VISTA PRINCIPAL CON DEGRADADO */
#main-view {
    display: none; min-height: 100vh;
    background: linear-gradient(180deg, #052e16 0%, #15803d 25%, #f0fdf4 65%, #ffffff 100%);
    background-attachment: fixed;
    flex-direction: column; justify-content: space-between;
}
.header-cover { width: 100%; height: 180px; object-fit: cover; display: block; }

/* NAVEGACIÓN HORIZONTAL MODERNIZADA */
.nav-horizontal {
    display: flex; justify-content: space-around;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    padding: 8px 5px; border-bottom: 2px solid #cbd5e1;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 6px 15px rgba(0,0,0,0.12);
}
.nav-item {
    display: flex; flex-direction: column; align-items: center;
    background: none; border: none; font-size: 11px; font-weight: 700;
    color: #475569; cursor: pointer; gap: 4px; flex: 1;
    transition: all 0.2s ease;
}
.nav-item svg {
    width: 22px;
    height: 22px;
    fill: #475569;
    transition: transform 0.2s ease, fill 0.2s ease;
}
.nav-item:active svg, .nav-item.active svg {
    transform: scale(1.15);
    fill: #16a34a;
}
.nav-item.active { color: #16a34a; }

.main-container { width: 100%; max-width: 600px; margin: 0 auto; padding: 15px 10px; flex-grow: 1; }

/* CARRUSEL 3D CON TOUCH/SWIPE */
.carousel-3d-wrapper {
    display: flex; align-items: center; justify-content: center;
    position: relative; height: 380px; overflow: hidden; margin: 10px 0;
    touch-action: pan-y; user-select: none;
}
.carousel-card {
    position: absolute; width: 70%; height: 360px; background: #fff;
    border-radius: 18px; box-shadow: 0 12px 28px rgba(0,0,0,0.25);
    transition: transform 0.4s ease, opacity 0.4s ease, filter 0.4s ease; display: flex; flex-direction: column;
    overflow: hidden; cursor: pointer; border: 1px solid rgba(255,255,255,0.6);
}
.carousel-card.center { transform: translateX(0) scale(1); z-index: 3; opacity: 1; filter: blur(0); }
.carousel-card.left { transform: translateX(-65%) scale(0.82); z-index: 2; opacity: 0.7; filter: blur(2px); }
.carousel-card.right { transform: translateX(65%) scale(0.82); z-index: 2; opacity: 0.7; filter: blur(2px); }
.carousel-card.hidden { opacity: 0; transform: scale(0.5); z-index: 1; }

.card-img { width: 100%; height: 210px; object-fit: cover; }
.card-body { padding: 12px; display: flex; flex-direction: column; justify-content: space-between; flex-grow: 1; }
.card-title { font-size: 15px; font-weight: 700; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-price { font-size: 17px; font-weight: 800; color: #16a34a; margin: 4px 0; }
.btn-ver-mas {
    background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; border: none; padding: 9px;
    border-radius: 8px; font-weight: 700; font-size: 13px; text-align: center;
    box-shadow: 0 3px 8px rgba(22,163,74,0.3);
}

.content-panel { display: none; background: rgba(255, 255, 255, 0.95); border-radius: 16px; padding: 15px; box-shadow: 0 8px 20px rgba(0,0,0,0.12); backdrop-filter: blur(5px); }
.content-panel.active { display: block; }

/* CUADRÍCULA PRODUCTOS EN 2 FILAS DE HASTA 6 */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(130px, auto);
    gap: 10px;
    margin-top: 10px;
}
.grid-card {
    background: #fff; border: 1px solid #cbd5e1; border-radius: 12px;
    overflow: hidden; padding: 8px; cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); transition: transform 0.2s ease;
}
.grid-card:active { transform: scale(0.98); }
.grid-card img { width: 100%; height: 85px; object-fit: cover; border-radius: 8px; }

.list-group { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.list-item {
    display: flex; justify-content: space-between; align-items: center; padding: 12px;
    background: #f8fafc; border-radius: 10px; border: 1px solid #cbd5e1; cursor: pointer; font-size: 14px;
}
.badge-count {
    background: #16a34a; color: white; font-size: 12px; font-weight: 800;
    padding: 3px 9px; border-radius: 12px; box-shadow: 0 2px 5px rgba(22,163,74,0.3);
}

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; }
.btn-page {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1); border: none; padding: 8px 14px;
    border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn-page:disabled { opacity: 0.5; cursor: not-allowed; }

/* MENÚ LATERAL MODERNIZADO */
.side-menu-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000; backdrop-filter: blur(2px);
}
.side-menu {
    position: fixed; top: 0; right: -280px; width: 270px; height: 100%;
    background: linear-gradient(180deg, #052e16 0%, #14532d 100%); color: #4ade80; z-index: 1001; transition: right 0.3s ease;
    display: flex; flex-direction: column; padding: 20px 15px; box-shadow: -8px 0 25px rgba(0,0,0,0.4);
}
.side-menu.open { right: 0; }
.menu-title { font-size: 18px; font-weight: 800; border-bottom: 1px solid rgba(74,222,128,0.3); padding-bottom: 12px; margin-bottom: 15px; text-shadow: 0 2px 4px rgba(0,0,0,0.4); }
.menu-item {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    color: #4ade80; background: rgba(255,255,255,0.03); border: 1px solid rgba(74,222,128,0.1);
    font-size: 15px; font-weight: 700; text-align: left; cursor: pointer; border-radius: 10px; margin-bottom: 8px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2); transition: all 0.2s ease;
}
.menu-item svg {
    width: 20px;
    height: 20px;
    fill: #4ade80;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}
.menu-item:hover, .menu-item:active { background: rgba(74,222,128,0.15); transform: translateX(-3px); }

/* MODALES Y DETALLE PRODUCTO */
.modal-3d-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 46, 22, 0.7); backdrop-filter: blur(4px); z-index: 1100;
    justify-content: center; align-items: center; padding: 15px;
}
.modal-3d {
    background: #ffffff; width: 100%; max-width: 480px; max-height: 90vh;
    border-radius: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    overflow-y: auto; padding: 20px; position: relative; animation: popIn 0.3s ease;
}
@keyframes popIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close-x {
    position: absolute; top: 12px; right: 15px; background: #e2e8f0;
    border: none; width: 32px; height: 32px; border-radius: 50%; font-weight: bold; cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 10;
}

/* DETALLE DE PRODUCTO Y ESTILO COLLAGE DE 3 IMÁGENES */
.collage-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
    height: 210px;
    margin-bottom: 15px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.collage-container img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.collage-container img.main-img { grid-row: span 2; }

#fullscreen-viewer {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 4000; justify-content: center; align-items: center;
}
#fullscreen-viewer img { max-width: 100%; max-height: 90vh; object-fit: contain; }

.rating-box { display: flex; gap: 8px; margin: 10px 0; }
.btn-rate { flex: 1; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 11px; font-weight: 700; cursor: pointer; background: #fff; }
.btn-rate.selected { background: #16a34a; color: white; border-color: #16a34a; }

.recommended-section { margin-top: 20px; border-top: 1px solid #e2e8f0; padding-top: 15px; }
.recommended-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rec-card { background: #fff; border-radius: 8px; overflow: hidden; border: 1px solid #e2e8f0; padding: 5px; cursor: pointer; }
.rec-card img { width: 100%; height: 65px; object-fit: cover; border-radius: 6px; }
.rec-card p { font-size: 11px; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }

.ad-banner-box {
    width: 100%;
    max-width: 400px;
    height: 250px;
    margin: 20px auto 10px auto;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid #cbd5e1;
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ad-banner-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.5s ease;
}

footer {
    position: relative; z-index: 2; width: 100%; background: rgba(255, 255, 255, 0.95);
    padding: 12px 0; text-align: center; display: flex; justify-content: center;
    align-items: center; gap: 8px; font-size: 13px; color: #334155;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08); margin-top: auto;
}
.flag-ar { width: 22px; height: 15px; object-fit: cover; border-radius: 2px; }
