/* css/style.css - TiendaTech Theme */
:root {
    --primary: #10b981;      /* Verde Esmeralda (Compra) */
    --primary-dark: #059669;
    --dark: #0f172a;         /* Azul Noche */
    --darker: #020617;
    --light: #f8fafc;
    --white: #ffffff;
    --red: #ef4444;
    --gray: #64748b;
    --sidebar-width: 260px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: var(--light); color: #334155; display: flex; min-height: 100vh; }

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width); background: var(--darker); color: #e2e8f0;
    display: flex; flex-direction: column; position: fixed; height: 100vh; left: 0; top: 0; z-index: 1000;
    overflow-y: auto; border-right: 1px solid #1e293b;
}
.brand { padding: 20px; font-size: 1.3rem; font-weight: 800; border-bottom: 1px solid #1e293b; color: white; display:flex; align-items:center; gap:10px; }
.brand span { background: var(--primary); color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; }

.nav-menu { list-style: none; padding: 20px 0; flex-grow: 1; }
.nav-item a { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: #94a3b8; text-decoration: none; transition: 0.2s; border-left: 4px solid transparent; }
.nav-item a:hover, .nav-item a.active { background: #1e293b; color: var(--primary); border-left-color: var(--primary); }

/* Widget del Carrito en Sidebar */
.cart-widget { background: #1e293b; margin: 20px; padding: 15px; border-radius: 8px; text-align: center; }
.cart-count { font-size: 2rem; font-weight: 800; color: white; display: block; }
.cart-label { font-size: 0.8rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; }

/* --- MAIN CONTENT --- */
.main-content { margin-left: var(--sidebar-width); flex-grow: 1; width: calc(100% - var(--sidebar-width)); }

.dashboard-hero {
    height: 220px;
    background-image: linear-gradient(to right, rgba(15,23,42,0.9), rgba(15,23,42,0.6)), url('../../img/hero-tienda.jpg');
    background-size: cover; background-position: center;
    color: white; padding: 40px; display: flex; flex-direction: column; justify-content: center;
}
.dashboard-hero h2 { font-size: 2.5rem; margin-bottom: 5px; color: var(--primary); text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.dashboard-hero p { font-size: 1.1rem; opacity: 0.9; max-width: 600px; }

.container { max-width: 1200px; margin: -40px auto 40px auto; padding: 0 20px; position: relative; z-index: 10; }

/* --- TARJETAS DE PRODUCTO --- */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }

.product-card {
    background: white; border-radius: 12px; overflow: hidden;
    box-shadow: var(--shadow); transition: all 0.3s ease;
    display: flex; flex-direction: column; border: 1px solid #e2e8f0;
}
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border-color: var(--primary); }

.product-img { height: 200px; width: 100%; object-fit: cover; background: white; border-bottom: 1px solid #f1f5f9; }
.product-body { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.product-title { font-size: 1.1rem; font-weight: 700; color: var(--dark); margin-bottom: 5px; }
.product-desc { font-size: 0.9rem; color: #64748b; margin-bottom: 15px; flex-grow: 1; }

.product-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 15px; border-top: 1px solid #f1f5f9; }
.product-price { font-size: 1.4rem; font-weight: 800; color: var(--dark); }
.product-stock { font-size: 0.8rem; color: var(--green); font-weight: 600; display: block; margin-bottom: 5px; }
.product-stock.low { color: var(--red); }

/* Botones */
.btn { padding: 10px 20px; border-radius: 8px; text-decoration: none; font-weight: 700; border: none; cursor: pointer; color: white; display: inline-flex; align-items: center; gap: 8px; transition: 0.2s; font-size: 0.9rem; }
.btn-add { background: var(--primary); width: 100%; justify-content: center; }
.btn-add:hover { background: var(--primary-dark); }
.btn-disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-search { background: var(--dark); }
.btn-cart { background: var(--white); color: var(--dark); border: 1px solid #e2e8f0; }

/* Buscador */
.search-bar-container { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px; }
.search-form { display: flex; gap: 10px; flex-grow: 1; max-width: 500px; }
.search-input { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; outline: none; }
.search-input:focus { border-color: var(--primary); }

/* =========================================
   ESTILOS DEL MODAL (Pop-up Centrado)
   ========================================= */

.modal-overlay {
    position: fixed;        /* Fijo en la pantalla */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Fondo oscuro semitransparente */
    backdrop-filter: blur(3px);     /* Efecto borroso */
    z-index: 3000;          /* Por encima del Sidebar (que tiene 1000) */
    
    /* Centrado perfecto del contenido */
    display: flex;
    justify-content: center;
    align-items: center;

    /* ESTADO INICIAL: OCULTO */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* ESTADO ACTIVO: VISIBLE */
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* La tarjeta blanca del modal */
.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px; /* Un poco más ancho para ver la factura */
    max-height: 90vh; /* Si es muy largo, que no se salga de la pantalla */
    overflow-y: auto; /* Scroll interno si la factura es larga */
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    position: relative;
}

/* Animación de entrada */
.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* Mobile */
.menu-toggle { display: none; position: fixed; top: 15px; right: 15px; z-index: 2000; background: var(--primary); border:none; color:white; padding:10px; border-radius:5px; }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    .menu-toggle { display: block; }
}