/* === ESTILOS GLOBALES DESPENSAS SAN JOSÉ === */

/* === VARIABLES CSS === */
:root {
  --bg: #fff;
  --text: #212121;
  --muted: #6f6f6f;
  --border: #e6e6e6;
  --dark: #2a2a2a;
  --card: #fff;
  --pill: #f4f5f7;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --shadow-card: 0 2px 6px rgba(0,0,0,.06);
  --accent: #000;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
}

/* === RESET GENERAL === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background-color: #fbfbfb;
}

/* === LAYOUT PRINCIPAL === */
body {
  min-height: 100vh;
  position: relative;
}

/* === BADGE CLIENTE (todas las páginas) === */
.client-badge-global {
  position: fixed;
  top: 20px;
  right: 30px;
  z-index: 1000;
  background: #fff;
  border: 1px solid #d0e8f5;
  border-radius: 10px;
  padding: 10px 18px;
  box-shadow: 0 2px 8px rgba(0,100,200,0.15);
  font-family: "Open Sans", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #0066cc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === SIDEBAR MEJORADO === */
aside {
  background: #0a0a0a;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  width: 280px;
  border-right: 1px solid #1a1a1a;
  overflow-y: auto;
  z-index: 100;
}

aside .brand {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #1a1a1a;
}

aside .brand img {
  height: 120px;
  display: block;
  object-fit: contain;
  filter: brightness(1.2);
}

aside .brand strong {
  font-size: 16px;
  letter-spacing: 2px;
  color: #fff;
  text-align: center;
}

aside .brand strong::after {
  content: ' 2025';
  font-weight: 700;
}

/* === NAVEGACIÓN MEJORADA === */
aside nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  flex: 1;
}

aside nav a {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  color: #bbb;
  font-weight: 600;
  font-size: 15px;
  border-radius: 10px;
  transition: all 0.2s ease;
  position: relative;
}

aside nav a:hover {
  background: #1a1a1a;
  color: #fff;
  transform: translateX(4px);
}

aside nav a.active {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

aside nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: linear-gradient(180deg, #00d4ff 0%, #0099ff 100%);
  border-radius: 0 4px 4px 0;
}

/* Separador visual */
aside nav hr {
  border: none;
  border-top: 1px solid #1a1a1a;
  margin: 12px 0;
}

/* Footer del sidebar */
aside .sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid #1a1a1a;
  text-align: center;
}

aside .sidebar-footer a {
  color: #666;
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

aside .sidebar-footer a:hover {
  color: #fff;
}

/* === CONTENIDO PRINCIPAL === */
main {
  margin-left: 280px;
  padding: 32px 40px;
  background: #fbfbfb;
  min-height: 100vh;
}

main h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 24px;
  color: #0a0a0a;
}

main p {
  font-size: 1rem;
  color: #555;
}

/* === DASHBOARD === */
.pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.pill {
  background: var(--pill);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card header {
  background: var(--dark);
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
}

.card .body {
  padding: 16px;
}

.metrics {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
}

.metric {
  flex: 1 1 100px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.metric strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
}

.metric.muted strong {
  color: var(--muted);
  font-weight: 700;
}

.metric.emph strong {
  font-weight: 800;
}

.metric.stock strong {
  color: #ef4444 !important;
  font-weight: 800;
}

.metric.ent strong {
  color: #10b981 !important;
  font-weight: 800;
}

/* Badges de semáforo */
.badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,.25);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.baja {
  background: rgba(239,68,68,.18);
  color: #fff;
}

.badge.media {
  background: rgba(245,158,11,.22);
  color: #fff;
}

.badge.alta {
  background: rgba(16,185,129,.22);
  color: #fff;
}

/* Barra de progreso */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease, background 0.3s ease;
}

.progress-bar.baja {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.progress-bar.media {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.progress-bar.alta {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

.progress-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-percent {
  font-weight: 700;
  color: #fff;
}

/* === INVENTARIO & POS === */
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel > header {
  background: var(--dark);
  color: #fff;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 15px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
  flex-wrap: wrap;
}

.toolbar .badge {
  background: var(--pill);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}

.toolbar select,
.toolbar input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 160px;
  font: inherit;
}

.toolbar button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.toolbar button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.toolbar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: #fff !important;
  color: #111 !important;
  border: 1px solid var(--border) !important;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

/* === TABLAS === */
table {
  width: 100%;
  border-collapse: collapse;
}
/* === ACCIONES EN TABLA SOCIOS === */
.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.table-actions button {
  flex-shrink: 0;
}

thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 14px 16px;
  background: #fafafa;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

tbody tr:hover {
  background: #fcfcfc;
}

tbody td.meta-cell {
  background: #f4f5f7;
  color: #555;
  font-weight: 600;
}

.right {
  text-align: right;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.actions input {
  width: 90px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.actions button {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 13px;
}

.actions button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* === FORMULARIOS (POS) === */
.panel .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.field select,
.field input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
}

.panel .actions {
  padding: 0 20px 20px 20px;
  display: flex;
  justify-content: flex-end;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 15px;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* === LOGIN PAGE === */
body.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  grid-template-columns: 1fr;
}

.client-badge {
  position: fixed;
  top: 15px;
  right: 20px;
  z-index: 100;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 6px 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.client-badge img {
  height: 55px;
  display: block;
}

.logo-main {
  width: 180px;
  margin-bottom: 30px;
}

.login-box {
  border: 1px solid #ddd;
  padding: 40px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  width: 320px;
}

.login-box label {
  font-weight: 600;
  font-size: 15px;
  display: block;
  margin-bottom: 6px;
}

.login-box input[type="text"],
.login-box input[type="password"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #bbb;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 14px;
}

.remember {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  font-size: 14px;
}

.remember input {
  margin-right: 8px;
}

.login-box button {
  background-color: #000;
  color: #fff;
  border: none;
  padding: 10px 30px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 700;
  width: 100%;
  transition: opacity 0.2s;
}

.login-box button:hover {
  opacity: 0.85;
}

.login-box button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 14px;
  display: none;
}

.error.show {
  display: block;
}

.footer {
  margin-top: 30px;
  text-align: center;
}

.footer p {
  margin: 5px 0;
  font-style: italic;
  font-size: 15px;
}

.footer a {
  text-decoration: none;
  color: #000;
  font-weight: 700;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  aside {
    position: relative;
    height: auto;
    width: 100%;
  }
  
  main {
    margin-left: 0;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .client-badge-global {
    top: 10px;
    right: 10px;
  }
  
  .client-badge-global img {
    height: 35px;
  }
}

/* Para páginas que NO son login */
body:not(.login-page) {
  display: block;
}