/* ============================================================
   amibCode — style.css  |  v1.0
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:       #3b5bdb;
  --primary-dark:  #2f4ac7;
  --primary-soft:  #e8edff;
  --success:       #2f9e44;
  --success-soft:  #ebfbee;
  --warning:       #e67700;
  --warning-soft:  #fff4e6;
  --danger:        #c92a2a;
  --danger-soft:   #fff5f5;
  --purple:        #6741d9;
  --purple-soft:   #f3f0ff;

  --sidebar-w:     260px;
  --topbar-h:      64px;

  --bg:            #f1f3f8;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --text:          #1e293b;
  --text-muted:    #64748b;

  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 2px 12px rgba(0,0,0,.07);
  --shadow-md:     0 4px 24px rgba(0,0,0,.10);
  --transition:    .2s ease;
}

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: .9375rem;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #1e2030;
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: transform var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .5px;
}

.sidebar-logo i { font-size: 1.3rem; color: var(--primary); }

.sidebar-brand { color: #fff; }

.sidebar-toggle { color: rgba(255,255,255,.6); border: none; background: none; }

/* nav */
.sidebar-nav {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item { margin: 2px 12px; }

.sidebar-link {
  display: flex;
  align-items: center;
  padding: .65rem 1rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.sidebar-link i { font-size: 1.05rem; }

.sidebar-link:hover,
.sidebar-item.active .sidebar-link {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.sidebar-item.active .sidebar-link {
  background: var(--primary);
  color: #fff;
}

/* Rotación de flecha en submenús */
.sidebar-link .bi-chevron-down {
  transition: transform var(--transition);
}
.sidebar-link:not(.collapsed) .bi-chevron-down {
  transform: rotate(180deg);
}

/* Soporte para submenús manuales */
.sidebar-submenu-container.collapse { display: none; }
.sidebar-submenu-container.show { display: block; }

/* footer del sidebar */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.sidebar-user { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }

.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .875rem;
  flex-shrink: 0;
}

.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { color: #fff; font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,.4); font-size: .72rem; }

.sidebar-logout {
  color: rgba(255,255,255,.4);
  border: none;
  background: none;
  padding: .4rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.sidebar-logout:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ── OVERLAY mobile ───────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1040;
}

/* ── MAIN WRAPPER ─────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--transition);
}

/* ── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow);
}

.topbar-toggle {
  border: none;
  background: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  padding: .2rem .4rem;
  display: none;      /* visible solo en mobile */
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.bg-primary-soft { background: var(--primary-soft) !important; }

/* ── CONTENT AREA ─────────────────────────────────────────── */
.content-area { padding: 1.75rem; flex: 1; }

/* ── STAT CARDS ───────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-body { display: flex; flex-direction: column; }
.stat-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }

.stat-blue  .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat-blue  .stat-value { color: var(--primary); }
.stat-green .stat-icon { background: var(--success-soft); color: var(--success); }
.stat-green .stat-value { color: var(--success); }
.stat-orange .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat-orange .stat-value { color: var(--warning); }
.stat-purple .stat-value { color: var(--purple); }
.stat-red .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat-red .stat-value { color: var(--danger); }

/* ── CARD PANEL ───────────────────────────────────────────── */
.card-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

/* ── ERP/PRO PANELS ────────────────────────────────────────── */
.panel-pro {
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.panel-pro-header {
  background: #3182ce; /* Azul profesional */
  color: #fff;
  padding: .6rem 1rem;
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-pro-body {
  padding: 1.25rem;
}

.label-pro {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #4a5568;
  margin-bottom: .35rem;
  display: block;
}

.form-control-pro {
  background: #edf2f7;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: .85rem;
  padding: .4rem .6rem;
}

.form-control-pro:focus {
  background: #fff;
}

.table-pro thead th {
  background: #f7fafc;
  color: #4a5568;
  font-size: .7rem;
  padding: .5rem;
  border-bottom: 2px solid #e2e8f0;
}

.table-pro tbody td {
  padding: .4rem .5rem;
  font-size: .85rem;
}

.bg-pro-header { background: #3182ce !important; }
.bg-pro-light  { background: #f7fafc !important; }

/* ── TABLE ────────────────────────────────────────────────── */
.table { margin-bottom: 0; }
.table thead th {
  background: #f8fafc;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding: .85rem 1rem;
}
.table tbody td { padding: .85rem 1rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge { font-size: .73rem; font-weight: 600; padding: .32em .65em; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: .875rem; }
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  padding: .5rem .85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,91,219,.15);
}

/* Chrome, Safari, Edge, Opera - Quitar flechas de inputs numéricos */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button,
.form-control::-webkit-inner-spin-button,
.form-control::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
}

/* Firefox - Quitar flechas de inputs numéricos */
input[type=number] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

.input-group-text {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn { border-radius: var(--radius-sm); font-weight: 500; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; display: block; margin-bottom: 1rem; opacity: .4; }
.empty-state p { margin-bottom: 1rem; }

/* ── LOGIN PAGE ───────────────────────────────────────────── */
body.login-page {
  background: linear-gradient(135deg, #1e2030 0%, #2d3561 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }

.login-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-md);
}

.login-logo { text-align: center; margin-bottom: 2rem; }
.login-icon {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: #fff;
  margin-bottom: 1rem;
  box-shadow: 0 8px 20px rgba(59,91,219,.35);
}
.login-title  { font-size: 1.5rem; font-weight: 700; margin: 0;   }
.login-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }
.login-btn { padding: .65rem; font-size: .95rem; }
.login-version { color: var(--text-muted); font-size: .78rem; }
.btn-toggle-pw { cursor: pointer; }

/* fw-500 utility */
.fw-500 { font-weight: 500 !important; }

/* ── CONTACT TABS ─────────────────────────────────────────── */
.contacto-tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.contacto-tab {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.contacto-tab:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.contacto-tab .tab-count {
  font-size: .72rem;
  padding: .2em .55em;
  opacity: .7;
}

.contacto-tab.tab-primary  { border-color: var(--primary); color: var(--primary); }
.contacto-tab.tab-success  { border-color: var(--success); color: var(--success); }
.contacto-tab.tab-info     { border-color: #1c7ed6; color: #1c7ed6; }
.contacto-tab.tab-warning  { border-color: var(--warning); color: var(--warning); }
.contacto-tab.tab-dark     { border-color: #343a40 !important; color: #343a40 !important; }

.contacto-tab.active {
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.contacto-tab.active .tab-count {
  background: rgba(255,255,255,.25) !important;
  color: #fff;
  opacity: 1;
}

.contacto-tab.tab-primary.active  { background: var(--primary); }
.contacto-tab.tab-success.active  { background: var(--success); }
.contacto-tab.tab-info.active     { background: #1c7ed6; }
.contacto-tab.tab-warning.active  { background: var(--warning); }
.contacto-tab.tab-dark.active     { background: #343a40 !important; border-color: #343a40 !important; color: #fff !important; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .topbar-toggle { display: inline-flex; }
}

@media (max-width: 575.98px) {
  .content-area { padding: 1rem; }
  .panel-header { flex-direction: column; gap: .75rem; align-items: flex-start; }
}

/* ── POS MODE / RESTAURANTE ───────────────────────────────── */
body.pos-mode .sidebar {
  transform: translateX(-100%);
}
body.pos-mode .sidebar.open {
  transform: translateX(0);
}
body.pos-mode .main-wrapper {
  margin-left: 0;
}
body.pos-mode .topbar-toggle {
  display: inline-flex;
}
body.pos-mode .sidebar-toggle {
  display: block !important;
}
