/* ============================================================
   BarberOS — Estilos (tema barbería: negro / carbón / dorado)
   ============================================================ */

:root {
  --bg: #0f1113;
  --bg-panel: #17191c;
  --bg-panel-2: #1e2124;
  --bg-hover: #24272b;
  --border: #2b2e33;
  --gold: #d8a13b;
  --gold-soft: #e8c07a;
  --text: #eceae6;
  --text-dim: #a5a9ad;
  --text-faint: #6f7378;
  --green: #4caf7d;
  --red: #e0645a;
  --blue: #5b9bd5;
  --purple: #9b7fd4;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}

#app { display: flex; height: 100vh; width: 100vw; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Sidebar ---------- */
#sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.brand .logo { font-size: 22px; }
.brand .name { font-weight: 700; font-size: 16px; letter-spacing: 0.3px; }
.brand .name span { color: var(--gold); }

.nav-group-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  padding: 14px 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-dim);
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 13.5px;
  transition: background .12s, color .12s;
}
.nav-item .ic { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-hover); color: var(--gold-soft); border-left-color: var(--gold); font-weight: 600; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px 0;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
}

/* ---------- Main ---------- */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#topbar {
  height: 60px;
  min-height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: var(--bg-panel);
  gap: 16px;
}
#topbar .view-title { font-size: 17px; font-weight: 700; }
#topbar .view-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.topbar-controls { display: flex; align-items: center; gap: 10px; }

select, input, textarea {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--gold); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px 5px 6px;
}
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold); color: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.user-chip .u-name { font-size: 12.5px; font-weight: 600; }
.user-chip .u-role { font-size: 10.5px; color: var(--text-faint); text-transform: capitalize; }

#content { flex: 1; overflow-y: auto; padding: 22px; }

/* ---------- Buttons ---------- */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: filter .12s, transform .05s;
}
button:active { transform: scale(0.98); }
.btn-primary { background: var(--gold); color: #1a1408; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: rgba(224,100,90,0.15); color: var(--red); border: 1px solid rgba(224,100,90,0.35); }
.btn-danger:hover { background: rgba(224,100,90,0.25); }
.btn-ghost { background: transparent; color: var(--text-dim); padding: 6px 8px; }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Cards / Grid ---------- */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }

.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .kpi-label { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.kpi .kpi-value { font-size: 24px; font-weight: 700; }
.kpi .kpi-sub { font-size: 11.5px; color: var(--text-faint); }
.kpi .kpi-value.gold { color: var(--gold-soft); }
.kpi .kpi-value.green { color: var(--green); }
.kpi .kpi-value.red { color: var(--red); }

.section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; display:flex; align-items:center; justify-content:space-between; }
.section-title .hint { font-size: 11.5px; color: var(--text-faint); font-weight: 400; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable:hover { background: var(--bg-hover); cursor: pointer; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: rgba(76,175,125,0.15); color: var(--green); }
.badge-gold { background: rgba(216,161,59,0.18); color: var(--gold-soft); }
.badge-red { background: rgba(224,100,90,0.15); color: var(--red); }
.badge-blue { background: rgba(91,155,213,0.15); color: var(--blue); }
.badge-purple { background: rgba(155,127,212,0.15); color: var(--purple); }
.badge-gray { background: rgba(255,255,255,0.06); color: var(--text-dim); }

/* ---------- Calendar ---------- */
.cal-wrap { overflow-x: auto; }
.cal-grid { display: grid; min-width: 700px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-head { background: var(--bg-panel-2); padding: 10px 8px; text-align: center; font-size: 12.5px; font-weight: 700; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); position: sticky; top: 0; }
.cal-head:last-child { border-right: none; }
.cal-timecol { background: var(--bg-panel-2); font-size: 11px; color: var(--text-faint); padding: 4px 8px; text-align: right; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 46px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); position: relative; padding: 2px; }
.cal-cell:hover { background: rgba(216,161,59,0.06); cursor: pointer; }
.cal-cell.blocked { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.02), rgba(255,255,255,0.02) 6px, rgba(255,255,255,0.05) 6px, rgba(255,255,255,0.05) 12px); cursor: not-allowed; }
.appt-block { background: var(--gold); color: #1a1408; border-radius: 6px; padding: 4px 6px; font-size: 11px; font-weight: 600; line-height: 1.25; cursor: pointer; overflow: hidden; }
.appt-block.completada { background: var(--green); color: #08150e; }
.appt-block.pendiente { background: var(--blue); color: #0a1826; }
.appt-block.cancelada { background: var(--red); color: #250a08; text-decoration: line-through; opacity: 0.75; }
.appt-block .a-cli { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-block .a-srv { display: block; font-weight: 400; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px;
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal.modal-lg { max-width: 780px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 15.5px; }
.modal-body { padding: 18px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* ---------- Misc ---------- */
.muted { color: var(--text-faint); }
.dim { color: var(--text-dim); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 9px 14px; font-size: 13px; color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold-soft); border-bottom-color: var(--gold); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-faint); }
.empty-state .ic { font-size: 32px; margin-bottom: 10px; }

.stock-bar { height: 6px; background: var(--bg-panel-2); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.stock-bar-fill { height: 100%; border-radius: 4px; }

.list-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }

.avatar-lg { width: 46px; height: 46px; border-radius: 50%; background: var(--bg-panel-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 22px; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--bg-panel-2); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: 8px; padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow); min-width: 240px; animation: slidein .15s ease-out; }
.toast.error { border-left-color: var(--red); }
@keyframes slidein { from { opacity:0; transform: translateY(8px);} to {opacity:1; transform:translateY(0);} }

.locked-banner { background: rgba(216,161,59,0.08); border: 1px solid rgba(216,161,59,0.3); color: var(--gold-soft); border-radius: 8px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 16px; }

.rating-stars { color: var(--gold); letter-spacing: 1px; }

.pos-cart-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button { padding: 2px 8px; }

.chart-wrap { position: relative; height: 260px; }
.chart-wrap.small { height: 200px; }

.progress-track { width: 100%; height: 8px; background: var(--bg-panel-2); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 4px; }

a { color: var(--gold-soft); }
