/* Variables */
:root{
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --bg: #0d0d0f;
  --fg: #efefef;
  --muted: #1a1a1d;
  --card: #141417;
  --primary: #ffffff;
  --accent: #e50914; /* rojo racing */
  --border: rgba(255,255,255,0.08);
  --radius: 10px;
  --shadow: 0 6px 22px rgba(0,0,0,0.5);
  --input-bg: #1a1a1d;
}

/* Light Mode */
.light{
  --bg: #f8f8f8;
  --fg: #111;
  --muted: #e5e5e5;
  --card: #ffffff;
  --primary: #0b0b0b;
  --accent: #e50914;
  --border: rgba(0,0,0,0.1);
  --shadow: 0 6px 18px rgba(0,0,0,0.15);
  --input-bg: #f3f3f5;
}

/* Base */
*{box-sizing:border-box; margin:0; padding:0;}
body{
  font-family:var(--font-sans);
  background:var(--bg);
  color:var(--fg);
  line-height:1.45;
}
a{text-decoration:none; color:inherit}

/* Container */
.container{
 width: 100%;
 margin:auto;
 max-width: 1400px; 
}

/* Header */
.site-header{
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
  position:sticky;
  top:0;
  z-index:1000;
  padding:0.8rem 0;
}

/* Contenedor flex */
.site-header .container {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
}

/* Marca */
.brand{
  display:flex;
  align-items:center;
  gap:.6rem;
  font-family:'Poppins', sans-serif;
  font-weight:700;
  font-size:1.6rem;
  color:var(--accent);
  letter-spacing:1px;
  transition:0.2s;
}
.brand:hover{ color:#fff; }

.brand-logo{
  width:40px; height:40px;
  object-fit:contain;
  background:var(--accent);
 border-radius:50%;
 padding:4px;
}

/* Navegación */
.main-nav{
  display:flex;
  align-items:center;
  gap:.6rem;
}
.main-nav .nav-link{
  color:var(--fg);
  font-weight:500;
  padding:6px 12px;
  border-radius:var(--radius);
  transition:.2s;
}
.main-nav .nav-link:hover{
  background:var(--muted);
  color:#fff;
}

/* Usuario */
.nav-user{
  font-weight:600;
  padding:5px 12px;
  border-radius:20px;
  background:rgba(229,9,20,0.15);
  color:var(--primary);
  opacity:.9;
}
.nav-user:hover{
  background:rgba(229,9,20,0.25);
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  padding:.55rem 1rem;
  border-radius:8px;
  cursor:pointer;
  border:1px solid transparent;
  transition:.2s;
}
.btn-primary{
  background:var(--accent); 
  color:#fff; 
  box-shadow:var(--shadow);
}
.btn-primary:hover{ filter:brightness(.92); }
.btn-outline{
  border-color:var(--border);
  background:transparent;
  color:var(--fg);
}
.btn-outline:hover{
  border-color:var(--accent);
  color:var(--accent);
}

.layout {
    max-width: 1200px; /* Asegura que el layout no exceda el ancho del .container */
    margin: 1.5rem auto 0; /* Centrar el layout */
}

@media(max-width:1000px){
    .layout{
        flex-direction: column;
        gap: 0;
        margin-top: 1.5rem;
    }
    .sidebar{
        width: 100%;
        position: static; /* Quitar sticky en móviles */
        height: auto;
        overflow: visible;
        margin-bottom: 1.5rem;
    }
}
.sidebar h3{
  margin-bottom:1rem;
  font-size:1.05rem;
  font-weight:700;
  opacity:.9;
}
.sidebar a{
  display:block;
  padding:.55rem .75rem;
  border-radius:8px;
  margin-bottom:.4rem;
  transition:.2s;
  color:var(--fg);
}
.sidebar a:hover{ background:var(--muted); }
.sidebar a.active{
  background:var(--accent);
  color:#fff;
}

/* Main */
.main{ flex:1; }
.page-title{
  font-size:1.8rem;
  margin-bottom:1rem;
  font-weight:700;
}

.banner-principal {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-bottom: 50px;
}

.banner-principal img{
  width: 100vw;
  height: auto;
  display: block;
}

/* Cards */
.card{
  background:var(--card);
  box-shadow:var(--shadow);
  margin-bottom:1rem;
}

/* Product Grid */
.product-grid{
 width:100%; /* Cambiado de 80% para que ocupe el ancho del contenedor centrado */
 min-width:unset; /* Quitar min-width */
 margin:auto; /* Mantener centrado */
 display:grid;
 justify-content:center;
 grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
 gap:1.2rem;
}
.product-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:1rem;
  box-shadow:var(--shadow);
  transition:.2s;
  color: #ffffff !important;
}
.product-card a.btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    color: var(--accent) !important;
    font-weight: 700;
}

/* Hover también en rojo */
.product-card a.btn:hover {
    color: #ff4c4c !important; /* rojo más claro */
    background: none !important;
}
.product-card:hover{
  transform:translateY(-4px);
  box-shadow:0 8px 26px rgba(0,0,0,0.55);
}
.product-card img{
  width:100%;
  height:220px;
  object-fit:cover;
  border-radius:8px;
  margin-bottom:.75rem;
}
.product-card h4{
  font-size:1.1rem;
  margin-bottom:.3rem;
  font-weight:600;
}
.product-card .price{
  color:var(--accent);
  font-weight:700;
  font-size:1.1rem;
}
.product-card {
    display: flex;
    flex-direction: column;
}

.product-card p:last-of-type {
    flex-grow: 1; /* La DESCRIPCIÓN se expande y empuja hacia abajo */
}

.product-card > div:last-child {
    margin-top: auto !important; /* Botones al fondo */
}
/* Ajuste del input cantidad */
.product-page input[type="number"] {
  background: var(--input-bg) !important;
  color: var(--fg) !important;
  border: 1px solid rgba(255,255,255,0.15);
  font-weight: 600;
  padding: .6rem;
  border-radius: 8px;
  margin-bottom: .6rem;
  text-align: center;
  font-size: 1.05rem;
}

.product-page input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(229,9,20,0.25);
}

/* Layout */
.product-page {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
}

/* Imagen */
.product-page img {
  width: 320px;
  height: 320px;
  object-fit: cover;
  border-radius: 6px;
}

/* Título */
.product-page h2 {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: .6rem;
  letter-spacing: .5px;
}

/* Precio */
.product-page .price {
  font-size: 2rem !important;
  font-weight: 900;
  margin-bottom: .4rem;
  background: linear-gradient(90deg, var(--accent), #ff4c4c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: .5px;
}

/* Stock badge */
.badge-out {
  display: inline-block;
  background: rgba(229, 9, 20, 0.18);
  color: var(--accent);
  padding: .4rem .7rem;
  border-radius: 8px;
  font-weight: 700;
  border: 1px solid rgba(229,9,20,0.4);
  margin-bottom: .8rem;
}

.product-page p {
  margin-bottom: .75rem;
  color: white !important;
}

.product-page label {
    color: white !important;
}

/* Descripción */
.product-page .description {
  line-height: 1.65;
  opacity: .92;
  font-size: 1.03rem;
  background: rgba(255,255,255,0.03);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: .8rem;
  color: #ffffff !important;

}

/* Botón añadir al carrito */
.product-page button.btn {
  background: linear-gradient(90deg, var(--accent), #b6060f);
  color: #fff;
  font-weight: 700;
  padding: .75rem 1.2rem;
  border-radius: 10px;
  width: 100%;
  box-shadow: 0 6px 16px rgba(229,9,20,0.3);
}

.product-page button.btn:hover {
  filter: brightness(.95);
}

/* --- ESTILOS MEJORADOS PARA EL BUSCADOR --- */
.search-form {
  display: flex;
  width: 100%; 
  gap: 0.5rem;
  margin-bottom: 2rem;
  align-items: center;
  flex-direction: row;
}

/* Estilo para el campo de texto (input) */
.search-form .form-control {
    flex: 1; /* Permite que el input ocupe el espacio restante */
    background: var(--input-bg); /* Fondo oscuro del input */
    border: 1px solid var(--border);
    color: var(--fg); /* Color de texto claro */
    padding: 16px;
    border-radius: var(--radius);
    transition: all .2s;
    font-size: 1rem;
    margin: 0 0 16px;
}

/* Estilo para el placeholder */
.search-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
    opacity: 1; /* Necesario para algunos navegadores */
}

/* Estilo cuando el input está enfocado */
.search-form .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.2);
    outline: none;
}

/* Estilo para el botón de Buscar */
.search-form .btn-primary {
    /* Mantiene los estilos existentes de .btn-primary pero asegura padding */
    padding: 16px;
    font-weight: 600;
}

/* Estilo para el botón de Reset/Secondary */
.search-form .btn-secondary {
    background: var(--muted);
    color: var(--fg);
    border: 1px solid var(--border);
    padding: .6rem 1rem;
    font-weight: 600;
}

.search-form .btn-secondary:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Contenedor principal del carrito */
.cart-wrapper {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-top: 1rem;
}

h1.card {
    color: white !important;
}

/* Sección de la lista de productos */
.cart-grid {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Estilo para cada producto en el carrito (más compacto) */
.cart-item {
    display: flex;
    gap: 1.2rem;
    padding: 1rem;
    align-items: center;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.cart-item:hover {
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.15);
}

.cart-item img {
  width: 80px; /* Reducción de tamaño */
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-item-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-block,
.right-block {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.remove-btn {
    background: rgba(229,9,20,0.12);
    border: 1px solid rgba(229,9,20,0.4);
    padding: .55rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: rgba(229,9,20,0.3);
    border-color: var(--accent);
}

/* Icono */
.remove-btn i {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

/* --- NUEVOS ESTILOS PARA EL CARRITO (Modelo: IMG | Descrip. | Cantidad | Subtotal | BORRAR) --- */

.cart-item-new {
    display: grid;
    /* Define las columnas: Imagen, Detalles, Cantidad, Subtotal, Eliminar */
    grid-template-columns: 80px 3fr 1fr 1.5fr auto; 
    gap: 1.5rem;
    align-items: center; /* Centra verticalmente todos los elementos de la fila */
    padding: 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.cart-item-new img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

/* Estilos para la descripción del producto */
.cart-product-details {
    color: #ffffff !important;
}

.cart-product-details .product-description {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}

.cart-product-details .product-price {
    font-weight: 500;
    opacity: 0.8;
}

/* Estilos para el bloque de Cantidad */
.cart-quantity-block {
    text-align: center;
}

.cart-quantity-block input[type="number"] {
    width: 70px;
    padding: 8px 10px;
    text-align: center;
    border-radius: 6px;
}

/* Estilos para el bloque de Subtotal */
.cart-subtotal-block {
    text-align: center;
    color: #ffffff !important;
}

.cart-subtotal-block .subtotal-label {
    opacity: 0.7;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.cart-subtotal-block .subtotal-value {
    font-weight: 800;
    color: var(--accent);
    font-size: 1.15rem;
}

/* Estilos para el botón BORRAR */
.cart-delete-block {
    text-align: right;
}

.remove-btn-new {
    background: rgba(229,9,20,0.12);
    border: 1px solid rgba(229,9,20,0.4);
    color: var(--accent);
    padding: .5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.remove-btn-new:hover {
    background: var(--accent);
    color: #fff;
}

/* Ocultar el label de Cantidad en la vista de escritorio */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


/* 📱 Responsivo para el nuevo diseño del Carrito */
@media(max-width: 768px) {
    .cart-item-new {
        /* Volver a una columna para móvil */
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    
    .cart-item-new img {
        margin: 0 auto; /* Centrar la imagen */
    }

    .cart-subtotal-block .subtotal-label {
        display: none; /* Ocultar el label "Subtotal" en móvil */
    }
    
    /* Mostrar Cantidad y Subtotal en la misma fila y centrados */
    .cart-product-details,
    .cart-quantity-block,
    .cart-subtotal-block,
    .cart-delete-block {
        text-align: center;
    }
    
    .cart-quantity-block input[type="number"] {
        margin: 0.5rem auto; /* Centrar input de cantidad */
    }

    .remove-btn-new {
        width: 100%; /* Botón de borrar ancho completo en móvil */
    }
    
    .sr-only {
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: normal;
    }
}
.cart-item-info h3 {
  font-size: 1.1rem; /* Reducción de fuente */
  font-weight: 700;
  margin-bottom: 0.2rem;
}

/* Precio unitario */
.cart-item-info .price {
  font-weight: 600;
  color: var(--fg);
  opacity: 0.8;
  font-size: 0.95rem;
}

/* Control de Cantidad */
.cart-quantity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0; /* Más compacto */
}

.cart-quantity label {
  font-weight: 500;
  opacity: 0.9;
}

.cart-quantity input[type="number"] {
  width: 70px;
  padding: 6px 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 6px;
  text-align: center;
}

/* Subtotal por artículo */
.cart-item-info .subtotal {
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem; /* Reducción de fuente */
}

/* Contenedor del Resumen/Total */
.cart-summary {
  flex: 1;
  max-width: 300px;
  padding: 1.5rem;
  position: sticky;
  top: 90px;
  border: 1px solid var(--accent);
}

.cart-summary p {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.cart-summary strong {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
}

.cart-summary .btn-primary {
  width: 100%;
  padding: 0.8rem;
  font-size: 1.1rem;
  background: linear-gradient(90deg, var(--accent), #b6060f);
}

/* Estilo para carrito vacío */
.cart-empty {
  text-align: center;
  padding: 3rem 1rem;
  opacity: 0.8;
  margin-top: 1rem;
}

/* 📱 Responsivo para el Carrito */
@media(max-width: 768px) {
    /* Mantenemos el apilamiento vertical y los tamaños reducidos en móvil */
  .cart-wrapper {
    flex-direction: column; 
  }
  .cart-grid {
    flex: auto;
  }
  .cart-summary {
    max-width: 100%; 
    position: static;
  }
  .cart-item {
    flex-direction: column; 
    text-align: center;
  }
    /* Ajustamos las imágenes en móvil para que no sean tan pequeñas */
  .cart-item img {
    width: 120px; 
    height: 120px;
    max-width: unset;
  }
  .cart-item-info {
    align-items: center;
  }
}

/* Contenedor principal para centrar el formulario */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 100px); /* Ocupa casi todo el alto de la vista */
  padding: 2rem 1rem;
}

/* Tarjeta del formulario (similar a .card pero con ancho fijo) */
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px; /* Ancho máximo estándar para formularios de auth */
}

/* Título */
.login-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Estilos de errores */
.login-error {
  background: rgba(229, 9, 20, 0.15);
  color: var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  border: 1px solid rgba(229, 9, 20, 0.4);
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 600;
}

/* Estilos genéricos para filas de formulario */
.form-row {
  margin-bottom: 1.2rem;
}

.form-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  opacity: 0.9;
  font-size: 0.95rem;
}

/* Estilos para todos los campos de texto/password/email */
.login-card input[type="email"],
.login-card input[type="password"],
.login-card input[type="text"] {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.7rem 1rem;
  border-radius: 6px;
  transition: all .2s;
  font-size: 1rem;
}

.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.2);
  outline: none;
}

/* Botón de Submit */
.login-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  font-weight: 700;
  margin-top: 1rem;
  /* Usar el gradiente fuerte de accent */
  background: linear-gradient(90deg, var(--accent), #b6060f);
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}

/* Enlace a la otra página (login/registro) */
.login-card p.switch-auth {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.95rem;
  opacity: 0.8;
}

.login-card p.switch-auth a {
  color: var(--accent);
  font-weight: 600;
  transition: color 0.2s;
}

.login-card p.switch-auth a:hover {
  color: var(--primary);
}

/* Responsivo */
@media(max-width:780px){
  .product-page{
    flex-direction:column;
    align-items:center;
    text-align:center;
  }
  .product-page img{
    width:100%;
    max-width:340px;
    height:auto;
  }
  .product-page button{
    width:100%;
    margin-top:.5rem;
  }
}

@media(max-width:500px){
  .product-page h2{ font-size:1.4rem; }
  .product-page .price{ font-size:1.6rem !important; }
}
