/* ==========================================================
   TEMA PREXATORGA — UI STOCK DISTRIBUIDO
   Versión 2025 — Lorenzo Teppa
========================================================== */

:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --text: #1b1f24;
  --text-muted: #6b7280;

  --primary: #0c274b;
  --primary-light: #174076;
  --accent: #00d4c2;

  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;

  --radius: 14px;
  --shadow: 0 8px 28px rgba(16, 24, 40, .1);
}

/* ================================
   RESET + BASE
================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Para que el footer quede siempre abajo */
html, body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

body {
  background: var(--bg);
  font-family: "Segoe UI", sans-serif;
  color: var(--text);
  /* Dejar el scroll solo dentro de main */
  overflow: hidden;
}

/* ================================
   NAVBAR
================================ */
.navbar {
  width: 100%;
  height: 90px;
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-content {
  width: 100%;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand img {
  height: 48px;
}

.nav-options {
  display: flex;
  gap: 34px;
  list-style: none;
}

.nav-options a {
  color: #e7ecf4;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
}

.nav-options a:hover,
.nav-options a.active {
  color: var(--accent);
  border-bottom: 3px solid var(--accent);
  padding-bottom: 4px;
}

.user {
  background: rgba(255,255,255,.1);
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  color: #fff;
}

.logout {
  margin-left: 10px;
  color: var(--accent);
  text-decoration: none;
}
.user-badge {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border-radius: 40px;
  padding: 8px 18px;
  gap: 14px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #ffffff;
}

.user-icon {
  font-size: 1.1rem;
}

.logout-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  margin-left: 6px;
  transition: background .25s ease, transform .25s ease;
  color: var(--accent);
}

.logout-btn:hover {
  background: rgba(255,255,255,0.24);
  color: #fff;
  transform: scale(1.1);
}

.logout-btn svg {
  pointer-events: none;
}
/* USER DROPDOWN */
.user-dropdown {
  position: relative;
}
.user-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 40px;
  padding: 8px 22px;
  font-size: .95rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background .25s, box-shadow .25s, border-color .25s;
}

.user-toggle:hover {
  background: rgba(255,255,255,.18);
  box-shadow: 0 0 8px rgba(38,188,184,0.4);
  border-color: rgba(38,188,184,.5);
}

.icon-user {
  width: 22px;
  height: 22px;
  color: #9AD0FF;
}

.chevron {
  width: 14px;
  height: 14px;
  transition: transform .25s ease;
  opacity: .7;
}

.user-toggle.open .chevron {
  transform: rotate(180deg);
}

.user-name {
  white-space: nowrap;
}


/* Dropdown */
.dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 54px;
  right: 0;
  background: #112743;
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 10px 0;
  z-index: 200;
}

.dropdown-item {
  padding: 12px 18px;
  color: #dfe7f2;
  text-decoration: none;
  font-size: .95rem;
  transition: background .2s;
}

.dropdown-item:hover {
  background: rgba(255,255,255,.10);
}

.dropdown-item.logout {
  color: var(--danger);
  font-weight: 600;
}

/* ================================
   CONTENIDO PRINCIPAL
================================ */
main {
  flex: 0 0 auto;
  width: 100%;
  padding: 40px 60px;
  height: calc(100vh - 90px - 70px); /* altura viewport menos navbar (90) y footer (70) */
  overflow-y: auto;
  display: block;
}


/* ================================
   HEAD: título + acciones
================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 14px;
}

.btn {
  padding: 12px 22px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-light);
}

.btn-outline {
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--surface-2);
}

/* ================================
   BUSCADOR
================================ */
.search-box {
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid #cfd5df;
  font-size: 1rem;
}

/* ================================
   TABLA DE PRODUCTOS
================================ */
.table-container {
  background: var(--surface);
  width: 100%;
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px;
  color: var(--text-muted);
  font-size: .9rem;
  border-bottom: 1px solid #e1e5ec;
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid #f0f2f7;
}

tr:hover {
  background: var(--surface-2);
}

/* Estados */
.tag {
  padding: 6px 12px;
  border-radius: 14px;
  color: white;
  font-size: .85rem;
  font-weight: 700;
}

.tag-normal { background: var(--success); }
.tag-bajo   { background: var(--warning); }
.tag-critico{ background: var(--danger); }

/* Acciones */
.product-actions a {
  margin-right: 12px;
  color: var(--primary);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
}
.product-actions a:hover {
  text-decoration: underline;
}

/* ================================
   FOOTER
================================ */
footer {
  width: 100%;
  height: 70px;
  background: var(--primary);
  color: #e7ecf4;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 -6px 22px rgba(0, 0, 0, .20);
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 120;
}

/* ================================
   DASHBOARD ENHANCEMENTS
================================ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
  gap: 16px;
  margin-bottom: 30px;
}
.card-kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label { font-size:.75rem; font-weight:700; color:var(--text-muted); letter-spacing:.5px; }
.kpi-value { font-size:1.8rem; font-weight:700; color:var(--primary); }
.kpi-value.warning { color:var(--warning); }
.kpi-value.danger { color:var(--danger); }
.kpi-value.primary { color:var(--primary-light); }
.kpi-value.accent { color:var(--accent); }

.dash-flex { display:grid; gap:24px; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); }
.dash-panel { background:var(--surface); padding:18px 20px; border-radius:var(--radius); box-shadow:var(--shadow); }
.dash-panel h2 { margin-bottom:10px; font-size:1.05rem; font-weight:700; color:var(--primary); }
.mini-table { width:100%; border-collapse:collapse; }
.mini-table th { text-align:left; padding:8px 6px; font-size:.7rem; letter-spacing:.5px; color:var(--text-muted); border-bottom:1px solid #e2e6ec; }
.mini-table td { padding:8px 6px; font-size:.75rem; border-bottom:1px solid #f0f2f7; }
.mini-table tr:hover { background:var(--surface-2); }

/* ================================
   MODAL
================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  max-width: 520px;
  width: 100%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body p {
  margin-bottom: 6px;
  font-size: .95rem;
}
.modal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.modal-table th,
.modal-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  text-align: left;
}

.modal-table th {
  font-size: .85rem;
  color: var(--text-muted);
}

.modal-table td {
  font-size: .95rem;
}

/* LOGIN PAGE */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 160px);
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  padding: 32px 38px;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  text-align: center;
}

.login-sub {
  color: var(--text-muted);
  margin-bottom: 18px;
  font-size: .95rem;
}

.login-form .form-group {
  margin-bottom: 14px;
  text-align: left;
}

.login-form input {
  width: 100%;
  padding: 12px;
  border: 1px solid #d3d6e0;
  border-radius: var(--radius);
}

.error {
  margin-top: 10px;
  color: var(--danger);
  font-size: .9rem;
  font-weight: 700;
}
/* Botón Login */
.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  border: none;
  border-radius: 12px;
  margin-top: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease-in-out, transform .12s ease-in-out;
}

.btn-login:hover {
  background: var(--primary-light);
}

.btn-login:active {
  transform: scale(0.98);
}

.product-actions a {
  margin-left: 8px;
  color: var(--primary);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
}

.product-actions a:hover {
  text-decoration: underline;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  font-weight: 700;
  line-height: 1;
}
.btn-icon:hover {
  background: var(--primary);
  color: #fff;
}
