@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0a0f24;
  --bg-panel: #121a3a;
  --bg-panel-2: #17204a;
  --border: #253166;
  --text: #e7ebff;
  --text-muted: #8b98c4;
  --cyan: #22d3ee;
  --cyan-hover: #0bb8d6;
  --orange: #fb923c;
  --orange-hover: #f97316;
  --accent: var(--cyan);
  --accent-hover: var(--cyan-hover);
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  background: radial-gradient(circle at 15% 0%, #16204f 0%, #0a0f24 45%, #070b1b 100%) fixed;
  color: var(--text);
  font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .stat-value, .pos-total, .btn { font-family: 'Montserrat', sans-serif; font-weight: 600; }

/* Fix global de <select> en tema oscuro - no ir agregando por elemento */
select option {
  background: #0a0f24;
  color: #fff;
}

a { color: var(--cyan); text-decoration: none; }

/* ---------- LAYOUT ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #121a3a 0%, #0d1330 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left .2s ease;
}
.sidebar-brand {
  padding: 20px 18px;
  font-weight: 700;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .badge-multi {
  background: var(--orange);
  color: #1a0f00;
  font-weight: 700;
  font-size: .65rem;
  padding: 2px 8px;
  border-radius: 20px;
}
.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar-nav .nav-section {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--orange);
  padding: 14px 10px 6px;
  opacity: .85;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .92rem;
  font-weight: 500;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: var(--bg-panel-2); color: var(--text); }
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(34,211,238,.18), rgba(34,211,238,.04));
  color: var(--cyan);
  border-left: 3px solid var(--cyan);
  font-weight: 600;
}
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--text-muted);
}
.sidebar-footer a { color: var(--cyan); }

.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(18,26,58,.7);
  backdrop-filter: blur(6px);
}
.topbar .btn-toggle { display: none; }
.topbar h5 { font-weight: 700; letter-spacing: .01em; }
.topbar-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.topbar-clock {
  font-size: .78rem;
  font-weight: 600;
  color: var(--cyan);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  opacity: .85;
}

.page-body { padding: 22px; flex: 1; }

/* ---------- CARDS / TABLES ---------- */
.card-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: 3px solid var(--cyan);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-card:nth-child(even) { border-top-color: var(--orange); }
.stat-card .stat-label { color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; margin-top: 4px; }

table.table-app {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}
table.table-app th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--orange);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.table-app td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
  vertical-align: middle;
}
table.table-app tr:hover td { background: var(--bg-panel-2); }

.form-control, .form-select {
  background: var(--bg-panel-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.form-control:focus, .form-select:focus {
  background: var(--bg-panel-2) !important;
  border-color: var(--cyan) !important;
  box-shadow: 0 0 0 .2rem rgba(34,211,238,.22) !important;
  color: var(--text) !important;
}
.form-control::placeholder { color: var(--text-muted); }
label.form-label { font-size: .85rem; color: var(--text-muted); font-weight: 500; }

.btn { font-weight: 600; }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: #04222b; }
.btn-primary:hover { background: var(--cyan-hover); border-color: var(--cyan-hover); color: #04222b; }
.btn-outline-light { border-color: var(--border); color: var(--text); }
.btn-outline-light:hover { background: var(--bg-panel-2); border-color: var(--cyan); color: var(--cyan); }
.btn-danger { background: var(--red); border-color: var(--red); }

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
}
.modal-header, .modal-footer { border-color: var(--border); }
.btn-close { filter: invert(1); }

.badge-stock-bajo { background: var(--red); }
.badge-stock-ok { background: var(--green); }
.badge-venc { background: var(--amber); color: #1a1200; }

.alert-success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.35); color: #86efac; }
.alert-info { background: rgba(34,211,238,.1); border-color: rgba(34,211,238,.3); color: #a5f3fc; }
.alert-warning { background: rgba(251,146,60,.12); border-color: rgba(251,146,60,.35); color: #fed7aa; }
.alert-danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); color: #fca5a5; }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 10%, #1a2560 0%, #0a0f24 55%, #070b1b 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(18,26,58,.92);
  border: 1px solid var(--border);
  border-top: 3px solid var(--cyan);
  border-radius: var(--radius);
  padding: 34px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-card h1 { font-size: 1.3rem; margin-bottom: 4px; font-weight: 700; }
.login-card .sub { color: var(--text-muted); font-size: .85rem; margin-bottom: 22px; }

/* ---------- POS ---------- */
.pos-grid { display: flex; gap: 18px; height: calc(100vh - 60px - 44px); }
.pos-search { flex: 1.4; display: flex; flex-direction: column; min-width: 0; }
.pos-cart { flex: 1; display: flex; flex-direction: column; min-width: 320px; }
.pos-results { overflow-y: auto; flex: 1; margin-top: 12px; }
.pos-product-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.pos-product-item:hover { background: var(--bg-panel-2); }
.pos-cart-items { flex: 1; overflow-y: auto; }
.pos-cart-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.pos-total { font-size: 1.6rem; font-weight: 700; color: var(--cyan); }

/* ---------- KANBAN (tablero de categorías) ---------- */
.tablero-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.kanban-col {
  flex: 1 1 240px;
  min-width: 240px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
}
.kanban-drop {
  min-height: 60px;
  max-height: 420px;
  overflow-y: auto;
  border-radius: 8px;
  transition: background .15s ease;
  padding-right: 4px;
}
.kanban-drop.drag-over { background: var(--bg-panel-2); outline: 2px dashed var(--cyan); }
.kanban-card {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-panel-2); border: 1px solid var(--border); border-left: 3px solid var(--orange); border-radius: 8px;
  padding: 8px; margin-bottom: 8px; cursor: grab; font-size: .85rem;
}
.kanban-card.dragging { opacity: .4; }
.kanban-card img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.kanban-card-nombre { font-weight: 600; }

@media (max-width: 700px) {
  .kanban-col { flex: 1 1 100%; max-width: 100%; }
}

/* ---------- SCROLLBARS ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--cyan) var(--bg-panel-2);
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: var(--bg-panel-2); border-radius: 8px; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cyan), var(--orange));
  border-radius: 8px;
  border: 2px solid var(--bg-panel-2);
}
*::-webkit-scrollbar-thumb:hover { background: var(--cyan-hover); }

/* ---------- RELOJ / CLIMA (dashboard) ---------- */
.clock-card {
  text-align: center;
  padding: 22px;
  background: linear-gradient(135deg, rgba(34,211,238,.08), rgba(251,146,60,.05));
}
.clock-date {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: .02em;
}
.clock-time {
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--cyan);
  letter-spacing: .02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.weather-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.weather-day {
  flex: 1;
  min-width: 110px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
}
.weather-day-label { font-size: .78rem; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: .04em; }
.weather-icon { font-size: 2rem; margin: 6px 0 2px; }
.weather-desc { font-size: .72rem; color: var(--text-muted); min-height: 28px; }
.weather-temps { font-size: .9rem; font-weight: 700; margin-top: 4px; }
.weather-max { color: var(--text); }
.weather-min { color: var(--text-muted); font-weight: 500; }

@media (max-width: 700px) {
  .clock-time { font-size: 2.2rem; }
  .weather-day { min-width: 88px; }
}

@media (max-width: 480px) {
  .topbar-clock { display: none; }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; height: 100vh; margin-left: -250px; }
  .sidebar.open { margin-left: 0; }
  .topbar .btn-toggle { display: inline-flex; }
  .pos-grid { flex-direction: column; height: auto; }
}
