/* ============================================================
   TECNUKI · Sistema de Stock - CSS
   ============================================================ */

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

:root {
  --primary:    #0f6894;
  --primary-d:  #0b4a6b;
  --primary-l:  #14779f;
  --primary-xl: #ecf5f9;
  --success:    #16a34a;
  --success-l:  #dcfce7;
  --warning:    #d97706;
  --warning-l:  #fef3c7;
  --danger:     #dc2626;
  --danger-l:   #fee2e2;
  --gray-50:    #f9fafb;
  --gray-100:   #f3f4f6;
  --gray-200:   #e5e7eb;
  --gray-300:   #d1d5db;
  --gray-400:   #9ca3af;
  --gray-500:   #6b7280;
  --gray-600:   #4b5563;
  --gray-700:   #374151;
  --gray-800:   #1f2937;
  --gray-900:   #111827;
  --sidebar-w:  240px;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body { font-family: 'Onest', sans-serif; background: var(--gray-50); color: var(--gray-800); font-size: 14px; line-height: 1.5; }

/* ─── LAYOUT ─────────────────────────────────────────────── */
.app-wrapper { display: flex; height: 100vh; overflow: hidden; }

/* ─── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: transform .2s;
}
.sidebar-logo { padding: 20px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.1); }
.logo-text { font-size: 20px; font-weight: 700; color: #5fb3d6; }
.logo-sub  { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.sidebar-branch { margin: 10px 12px 0; background: #0b4a6b; border-radius: 8px; padding: 8px 12px; font-size: 11px; color: #9fd0e6; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--gray-400); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.nav-item.active { background: var(--primary); color: white; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px;
}
.user-info { flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-role { font-size: 11px; color: var(--gray-400); text-transform: capitalize; }
.logout-btn { color: var(--gray-400); text-decoration: none; font-size: 18px; }
.logout-btn:hover { color: #f87171; }

/* ─── MAIN ───────────────────────────────────────────────── */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  background: white; border-bottom: 1px solid var(--gray-200);
  padding: 12px 24px; display: flex; align-items: center; gap: 16px;
  flex-shrink: 0;
}
.topbar-date { font-size: 13px; color: var(--gray-500); flex: 1; text-transform: capitalize; }
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-600); }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ─── PAGE HEADER ────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--gray-200);
  padding: 20px;
}
.card-grid { display: grid; gap: 16px; }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── STAT CARDS ─────────────────────────────────────────── */
.stat-card { display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.blue   { background: #d6eaf3; }
.stat-icon.green  { background: #dcfce7; }
.stat-icon.red    { background: #fee2e2; }
.stat-icon.yellow { background: #fef3c7; }
.stat-icon.purple { background: #ede9fe; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  font-weight: 500; cursor: pointer; text-decoration: none;
  border: none; transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ─── FORMS ──────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300);
  border-radius: 8px; font-size: 13px; font-family: inherit;
  background: white; color: var(--gray-800);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--primary-l); box-shadow: 0 0 0 3px rgba(20,119,159,.15); }
.form-control.highlight { background: #ecf5f9; font-weight: 600; }
.form-row { display: grid; gap: 12px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.form-check input { width: 15px; height: 15px; cursor: pointer; }

/* ─── TABLES ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead tr { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); }
.tbl th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--gray-600); white-space: nowrap; }
.tbl th.right, .tbl td.right { text-align: right; }
.tbl th.center, .tbl td.center { text-align: center; }
.tbl tbody tr { border-bottom: 1px solid var(--gray-100); transition: background .1s; }
.tbl tbody tr:hover { background: var(--gray-50); }
.tbl td { padding: 10px 14px; color: var(--gray-700); vertical-align: middle; }
.tbl td .sub { font-size: 11px; color: var(--gray-400); }
.tbl-alerta { background: #fff7f7 !important; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green  { background: var(--success-l); color: var(--success); }
.badge-red    { background: var(--danger-l); color: var(--danger); }
.badge-yellow { background: var(--warning-l); color: var(--warning); }
.badge-blue   { background: #d6eaf3; color: var(--primary); }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }
.badge-purple { background: #ede9fe; color: #7c3aed; }

/* ─── ALERTS ─────────────────────────────────────────────── */
.alert { padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; }
.alert-success { background: var(--success-l); color: var(--success); }
.alert-danger  { background: var(--danger-l); color: var(--danger); }
.alert-warning { background: var(--warning-l); color: var(--warning); }
.alert-info    { background: #d6eaf3; color: var(--primary); }
.alert-block { display: block; margin-bottom: 16px; }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1000;
  align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 760px; margin: auto;
}
.modal-sm  { max-width: 480px; }
.modal-lg  { max-width: 960px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--gray-200); }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gray-400); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── SEARCH BAR ─────────────────────────────────────────── */
.search-bar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap .form-control { padding-left: 36px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 15px; pointer-events: none; }

/* ─── STOCK BADGES ───────────────────────────────────────── */
.stock-item { display: flex; flex-direction: column; gap: 2px; }
.stock-line { font-size: 11px; }
.stock-line .suc { color: var(--gray-500); }
.stock-line .qty { font-weight: 700; }
.stock-line .qty.zero { color: var(--danger); }
.stock-line .qty.low  { color: var(--warning); }

/* ─── FOTO PREVIEW ───────────────────────────────────────── */
.foto-preview { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--gray-200); }
.foto-placeholder { width: 80px; height: 80px; background: var(--gray-100); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--gray-400); font-size: 24px; border: 1px solid var(--gray-200); }

/* ─── PAGINATION ─────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; padding: 14px 0 0; }
.page-info { font-size: 13px; color: var(--gray-500); flex: 1; }

/* ─── LOGIN ──────────────────────────────────────────────── */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #0b4a6b 0%, #0f6894 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: white; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 400px; padding: 40px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .name { font-size: 28px; font-weight: 800; color: var(--primary); }
.login-logo .sub  { font-size: 13px; color: var(--gray-500); }

/* ─── DROPDOWN SEARCH ────────────────────────────────────── */
.dropdown-search { position: relative; }
.dropdown-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: white; border: 1px solid var(--gray-200); border-radius: 10px;
  box-shadow: var(--shadow-md); max-height: 260px; overflow-y: auto; margin-top: 4px;
}
.dropdown-results.open { display: block; }
.dropdown-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: center; }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--primary-xl); }
.dropdown-item .item-name { font-weight: 500; }
.dropdown-item .item-code { font-size: 11px; color: var(--gray-400); }
.dropdown-item .item-price { font-weight: 700; color: var(--primary); }

/* ─── TICKET VENTA ───────────────────────────────────────── */
.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th { background: var(--gray-50); padding: 8px 10px; text-align: left; font-weight: 600; border-bottom: 1px solid var(--gray-200); }
.items-table td { padding: 7px 10px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.items-table input[type=number] { width: 80px; padding: 5px 8px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 12px; text-align: center; }
.total-box { background: var(--gray-50); border-radius: 10px; padding: 16px; }
.total-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.total-final { font-size: 20px; font-weight: 800; color: var(--primary); border-top: 1px solid var(--gray-200); padding-top: 8px; margin-top: 6px; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -100%; top: 0; bottom: 0; z-index: 500; transition: left .25s; }
  .sidebar.open { left: 0; }
  .menu-toggle { display: block; }
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* ─── MARCA TECNUKI (30/11/2026): azul #0f6894, naranja #e96c2c ───────── */
:root { --marca: #0f6894; --marca-osc: #08344b; --naranja: #e96c2c; --naranja-osc: #c4531a; --gray-900: #0b2b3c; }
body { font-family: 'Onest', system-ui, sans-serif; }
.sidebar { background: var(--marca-osc); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; border-bottom: 3px solid var(--naranja); padding-bottom: 14px; }
.sidebar-logo img { width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; }
.logo-text { color: #fff; letter-spacing: .04em; }
.logo-sub { color: rgba(255,255,255,.7); }
.sidebar-branch { background: rgba(255,255,255,.1); color: #fff; }
.nav-item { color: rgba(255,255,255,.78); }
.nav-item.active { background: var(--naranja-osc); color: #fff; font-weight: 700; }
.user-role, .logout-btn { color: rgba(255,255,255,.7); }
.topbar { border-bottom: 2px solid #d6eaf3; }
.page-title { color: var(--marca-osc); }
a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--naranja); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
