/* ============================================================
   ROSTICERÍA — Estilos globales
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary:   #c0392b;
  --color-primary-d: #96281b;
  --color-accent:    #e67e22;
  --color-bg:        #f4f5f7;
  --color-surface:   #ffffff;
  --color-border:    #dde1e7;
  --color-text:      #1a1a2e;
  --color-muted:     #6b7280;
  --color-success:   #27ae60;
  --color-warning:   #f39c12;
  --color-danger:    #e74c3c;
  --color-info:      #2980b9;
  --nav-h:           58px;
  --radius:          8px;
  --shadow:          0 2px 8px rgba(0,0,0,.08);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
}

/* ---- NAVBAR ---- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center;
  padding: 0 1rem; gap: 1rem;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.nav-brand {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.1rem; font-weight: 700;
  white-space: nowrap;
}

.badge-suc {
  background: rgba(255,255,255,.2);
  border-radius: 4px; padding: 2px 6px; font-size: .75rem;
}

.nav-menu {
  list-style: none;
  display: flex; align-items: center; gap: .25rem;
  flex: 1;
}

.nav-menu > li > a {
  color: rgba(255,255,255,.9);
  text-decoration: none;
  padding: .45rem .7rem;
  border-radius: var(--radius);
  display: flex; align-items: center; gap: .4rem;
  font-size: .85rem;
  transition: background .15s;
}

.nav-menu > li > a:hover,
.nav-menu > li.active > a {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Dropdowns */
.dropdown { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute; top: 100%; left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 180px;
  list-style: none;
  z-index: 999;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu li a {
  display: block;
  padding: .55rem 1rem;
  color: var(--color-text);
  text-decoration: none;
  font-size: .875rem;
}
.dropdown-menu li a:hover { background: var(--color-bg); }

/* Nav user */
.nav-user {
  display: flex; align-items: center; gap: .5rem;
  font-size: .82rem; white-space: nowrap;
}

.badge-rol {
  background: var(--color-accent);
  border-radius: 12px; padding: 2px 8px; font-size: .72rem;
  text-transform: capitalize;
}

.btn-logout {
  color: #fff; font-size: 1rem;
  padding: .35rem .5rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.2); }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-top: var(--nav-h);
  padding: 1.5rem;
  min-height: calc(100vh - var(--nav-h) - 40px);
}

/* ---- FOOTER ---- */
.footer {
  text-align: center;
  padding: .6rem;
  font-size: .78rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-header h1 { font-size: 1.3rem; font-weight: 600; }

/* ---- CARDS ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-header {
  font-size: 1rem; font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--color-border);
}

/* ---- GRID ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }

@media (max-width: 900px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 600px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .navbar { flex-wrap: wrap; height: auto; padding: .5rem; }
  .nav-menu { flex-wrap: wrap; }
}

/* ---- KPI CARDS ---- */
.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: .25rem;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: .8rem; color: var(--color-muted); }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--color-primary); }
.kpi-sub   { font-size: .78rem; color: var(--color-muted); }

/* ---- TABLAS ---- */
.table-wrapper { overflow-x: auto; }

table.tbl {
  width: 100%; border-collapse: collapse;
  font-size: .875rem;
}
table.tbl th {
  background: var(--color-bg);
  padding: .6rem .75rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
table.tbl td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafafa; }

/* ---- BOTONES ---- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem 1rem;
  border: none; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--color-primary);   color: #fff; }
.btn-primary:hover { background: var(--color-primary-d); }
.btn-accent    { background: var(--color-accent);    color: #fff; }
.btn-success   { background: var(--color-success);   color: #fff; }
.btn-danger    { background: var(--color-danger);    color: #fff; }
.btn-outline   { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-icon { padding: .35rem .45rem; }

/* ---- FORMULARIOS ---- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .35rem; font-size: .875rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .875rem;
  font-family: inherit;
  transition: border-color .15s;
  background: var(--color-surface);
  color: var(--color-text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}

/* ---- BADGES / ESTADO ---- */
.badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 12px;
  font-size: .75rem; font-weight: 600;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-gray    { background: #e9ecef; color: #495057; }

/* ---- ALERTAS ---- */
.alert {
  padding: .8rem 1rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: .875rem;
  border-left: 4px solid;
}
.alert-success { background: #d4edda; border-color: var(--color-success); color: #155724; }
.alert-danger  { background: #f8d7da; border-color: var(--color-danger);  color: #721c24; }
.alert-warning { background: #fff3cd; border-color: var(--color-warning); color: #856404; }
.alert-info    { background: #d1ecf1; border-color: var(--color-info);    color: #0c5460; }

/* ---- LOGIN ---- */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--color-primary);
}
.login-box {
  background: var(--color-surface);
  border-radius: 12px; padding: 2.5rem;
  width: 100%; max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  text-align: center;
}
.login-box .logo-icon { font-size: 3rem; color: var(--color-primary); margin-bottom: .5rem; }
.login-box h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.login-box p  { color: var(--color-muted); font-size: .875rem; margin-bottom: 1.5rem; }

/* ---- POS ---- */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1rem;
  height: calc(100vh - var(--nav-h) - 2rem);
}
.pos-productos { overflow-y: auto; }
.pos-ticket    { display: flex; flex-direction: column; }

.producto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .75rem;
}

.producto-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem;
  cursor: pointer;
  text-align: center;
  transition: box-shadow .15s, transform .1s;
  user-select: none;
}
.producto-card:hover  { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-2px); }
.producto-card:active { transform: scale(.96); }
.producto-card .pc-nombre { font-weight: 600; font-size: .85rem; margin-bottom: .2rem; }
.producto-card .pc-precio { color: var(--color-primary); font-weight: 700; font-size: 1rem; }

/* Ticket lateral */
.ticket-items { flex: 1; overflow-y: auto; }
.ticket-item  { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--color-border); }
.ticket-item-nombre { flex: 1; font-size: .875rem; }
.ticket-item-cant   { width: 28px; text-align: center; font-weight: 700; }
.ticket-item-precio { width: 70px; text-align: right; font-size: .875rem; }

.ticket-total {
  font-size: 1.4rem; font-weight: 700;
  color: var(--color-primary);
  text-align: right; padding: .75rem 0;
  border-top: 2px solid var(--color-border);
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.modal {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h3 { font-size: 1.1rem; }

/* ---- UTILIDADES ---- */
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.text-right { text-align: right; }
.text-muted { color: var(--color-muted); }
.text-sm { font-size: .8rem; }
.w-full { width: 100%; }
.hidden { display: none !important; }
