/* =============================================
   css/styles.css — Estilos globales del cliente web
   ============================================= */

/* ── Reset y variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #3B82F6;
  --primary-dark:  #2563EB;
  --secondary:     #1E293B;
  --success:       #22C55E;
  --danger:        #EF4444;
  --warning:       #F59E0B;
  --bg:            #F0F4F8;
  --card:          #FFFFFF;
  --text:          #1E293B;
  --text-light:    #64748B;
  --border:        #E2E8F0;
  --radius:        0.5rem;
  --shadow:        0 2px 8px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.12);
  --transition:    0.2s ease;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Navbar ── */
.navbar {
  background: var(--secondary);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-brand {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand:hover { text-decoration: none; color: #fff; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}
.nav-links a {
  color: #CBD5E1;
  font-size: 0.95rem;
  transition: color var(--transition);
}
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-links a.active { color: #fff; font-weight: 600; }

.cart-badge {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.75rem;
  margin-left: 4px;
}

/* ── Contenedor principal ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition);
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.92); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary   { background: var(--primary);   color: #fff; }
.btn-success   { background: var(--success);   color: #fff; }
.btn-danger    { background: var(--danger);    color: #fff; }
.btn-warning   { background: var(--warning);   color: #fff; }
.btn-outline   { background: transparent; color: var(--primary);
                 border: 2px solid var(--primary); }
.btn-ghost     { background: transparent; color: var(--text-light); }
.btn-sm        { padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.btn-lg        { padding: 0.8rem 2rem; font-size: 1.05rem; }
.btn-block     { width: 100%; justify-content: center; }

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body     { padding: 1.25rem; }
.card-header   { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.card-footer   { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }

/* ── Tarjetas de producto ── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.5rem;
}
.product-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.product-card .product-img-placeholder {
  width: 100%;
  height: 180px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.product-card .product-info   { padding: 1rem; }
.product-card .product-name   { font-weight: 600; margin-bottom: 4px; }
.product-card .product-cat    { font-size: 0.8rem; color: var(--text-light); margin-bottom: 8px; }
.product-card .product-price  { font-size: 1.2rem; font-weight: 700;
                                  color: var(--primary); }
.product-card .product-stock  { font-size: 0.8rem; color: var(--text-light); }

/* ── Formularios ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; margin-bottom: 4px; font-weight: 500;
              font-size: 0.9rem; }
.form-control {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  transition: border-color var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-control.error { border-color: var(--danger); }
.form-hint  { font-size: 0.8rem; color: var(--text-light); margin-top: 3px; }
.form-error { font-size: 0.82rem; color: var(--danger); margin-top: 4px; }

/* ── Alertas ── */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.93rem;
}
.alert-success { background: #F0FFF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-danger  { background: #FFF1F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── Tabla ── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
thead th {
  background: var(--bg);
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
tbody tr:hover { background: #F8FAFC; }

/* ── Badge de estado ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-success  { background: #DCFCE7; color: #166534; }
.badge-danger   { background: #FEE2E2; color: #991B1B; }
.badge-warning  { background: #FEF3C7; color: #92400E; }
.badge-info     { background: #DBEAFE; color: #1E40AF; }
.badge-secondary{ background: #F1F5F9; color: #475569; }

/* ── Carrito lateral ── */
.cart-side {
  position: fixed;
  top: 64px;
  right: 0;
  width: 360px;
  height: calc(100vh - 64px);
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,.12);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.cart-side.open { transform: translateX(0); }
.cart-side-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.05rem;
}
.cart-side-body { flex: 1; overflow-y: auto; padding: 1rem; }
.cart-side-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
}
.cart-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg);
  flex-shrink: 0;
}
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; font-size: 0.9rem; }
.cart-item-price { color: var(--primary); font-weight: 700; }
.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.qty-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  border-radius: 4px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover { background: var(--primary); color: #fff; }

/* ── Overlay ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 150;
  display: none;
}
.overlay.show { display: block; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body   { padding: 1.4rem; }
.modal-footer { padding: 1rem 1.4rem; border-top: 1px solid var(--border);
                display: flex; gap: 8px; justify-content: flex-end; }
.modal-close { cursor: pointer; background: none; border: none;
               font-size: 1.3rem; color: var(--text-light); }

/* ── Spinner ── */
.spinner {
  width: 36px; height: 36px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth Card ── */
.auth-wrapper {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.auth-subtitle { color: var(--text-light); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--secondary) 0%, #334155 100%);
  color: #fff;
  padding: 4rem 2rem;
  text-align: center;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero p  { font-size: 1.1rem; color: #CBD5E1; max-width: 560px; margin: 0 auto 1.5rem; }

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  background: #fff;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-bar input,
.filter-bar select { flex: 1; min-width: 160px; }

/* ── Paginación ── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 1.5rem; }
.page-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #fff; cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: #fff; border-color: var(--primary);
}

/* ── Toast ── */
.toast-container {
  position: fixed; top: 80px; right: 20px;
  z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--secondary);
  color: #fff;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
  min-width: 220px;
  max-width: 340px;
}
.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--text); }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; }
                      to   { transform: translateX(0);    opacity: 1; } }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { margin-bottom: 0.5rem; color: var(--text); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .nav-links { gap: 1rem; }
  .hero h1 { font-size: 1.8rem; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .cart-side { width: 100%; }
}
@media (max-width: 480px) {
  .nav-links .hide-mobile { display: none; }
}
