/* ============================================================
   FÉNIX BAR LOUNGE — App Web
   Estilos globales
   ============================================================ */

:root {
  --navy:    #1F3864;
  --blue:    #2E5D9E;
  --gold:    #C9A84C;
  --gold-lt: #F5E6C0;
  --dark:    #141F38;
  --gray-1:  #F2F4F8;
  --gray-2:  #E0E4EC;
  --gray-3:  #B0B8CC;
  --text:    #2C3345;
  --success: #28a745;
  --danger:  #dc3545;
  --warning: #ffc107;
  --info:    #0dcaf0;
  --sidebar-w: 260px;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--gray-1);
  color: var(--text);
  margin: 0; padding: 0;
  min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--navy);
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: transform .3s ease;
  overflow-y: auto;
}
#sidebar .sidebar-brand {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
#sidebar .sidebar-brand .brand-title {
  color: var(--gold);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.2;
}
#sidebar .sidebar-brand .brand-sub {
  color: rgba(255,255,255,.55);
  font-size: .72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}
#sidebar .sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 12px;
}
#sidebar .sidebar-user .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--navy); font-size: .9rem;
  flex-shrink: 0;
}
#sidebar .sidebar-user .user-info small { color: rgba(255,255,255,.45); font-size: .7rem; }
#sidebar .sidebar-user .user-info span { color: #fff; font-size: .85rem; font-weight: 600; }

#sidebar nav { flex: 1; padding: 12px 0; }
#sidebar .nav-section {
  padding: 8px 20px 4px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}
#sidebar .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: all .2s;
  text-decoration: none;
  position: relative;
}
#sidebar .nav-link i { width: 18px; text-align: center; font-size: .95rem; }
#sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
#sidebar .nav-link.active {
  color: var(--gold);
  background: rgba(201,168,76,.12);
  border-left-color: var(--gold);
  font-weight: 600;
}
#sidebar .nav-link .badge-pill {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 12px;
}
#sidebar .sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ── Main content ── */
#main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .3s ease;
}

/* ── Topbar ── */
#topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-2);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
#topbar .page-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin: 0; }
#topbar .topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-icon-btn {
  background: none; border: none; color: var(--gray-3);
  font-size: 1.1rem; position: relative; cursor: pointer;
  transition: color .2s;
}
.topbar-icon-btn:hover { color: var(--navy); }
.topbar-icon-btn .notif-dot {
  position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}

/* ── Content area ── */
.content-area { padding: 24px; flex: 1; }

/* ── KPI cards ── */
.kpi-card {
  background: #fff; border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid var(--gray-2);
  transition: box-shadow .2s, transform .2s;
  height: 100%;
}
.kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-2px); }
.kpi-card .kpi-label { font-size: .75rem; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--gray-3); }
.kpi-card .kpi-value { font-size: 1.8rem; font-weight: 700; color: var(--navy); line-height: 1.2; margin: 6px 0 4px; }
.kpi-card .kpi-change { font-size: .8rem; }
.kpi-card .kpi-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.kpi-navy  { background: rgba(31,56,100,.12); color: var(--navy); }
.kpi-gold  { background: rgba(201,168,76,.15); color: var(--gold); }
.kpi-green { background: rgba(40,167,69,.12);  color: var(--success); }
.kpi-red   { background: rgba(220,53,69,.12);  color: var(--danger); }
.kpi-blue  { background: rgba(46,93,158,.12);  color: var(--blue); }

/* ── Section card ── */
.section-card {
  background: #fff; border-radius: 12px;
  border: 1px solid var(--gray-2);
  margin-bottom: 24px;
  overflow: hidden;
}
.section-card .section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-2);
  display: flex; align-items: center; justify-content: space-between;
}
.section-card .section-header h6 {
  margin: 0; font-weight: 700; color: var(--navy); font-size: .95rem;
}
.section-card .section-body { padding: 20px; }

/* ── Tables ── */
.table-fenix thead th {
  background: var(--navy); color: #fff;
  font-size: .78rem; font-weight: 600;
  letter-spacing: .5px; border: none;
  padding: 10px 14px;
}
.table-fenix tbody tr { transition: background .15s; }
.table-fenix tbody tr:hover { background: var(--gray-1); }
.table-fenix tbody td { padding: 10px 14px; font-size: .875rem; vertical-align: middle; }

/* ── Badges ── */
.badge-status {
  padding: 4px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 600;
}
.badge-open    { background: rgba(40,167,69,.12);  color: #1a7a34; }
.badge-pending { background: rgba(255,193,7,.15);  color: #856404; }
.badge-closed  { background: rgba(220,53,69,.12);  color: #a71d2a; }
.badge-progress{ background: rgba(46,93,158,.12);  color: #1a3d7a; }
.badge-done    { background: rgba(40,167,69,.12);  color: #1a7a34; }
.badge-wait    { background: rgba(108,117,125,.12);color: #495057; }

/* ── Progress phase ── */
.phase-item {
  border: 1px solid var(--gray-2); border-radius: 10px;
  padding: 16px; margin-bottom: 12px; background: #fff;
  transition: box-shadow .2s;
}
.phase-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.phase-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.phase-num.done   { background: var(--success); }
.phase-num.active { background: var(--gold); color: var(--navy); }

/* ── Floor map (mesas) ── */
.floor-area {
  background: #f9fafb;
  border: 2px dashed var(--gray-2);
  border-radius: 12px;
  padding: 20px;
  min-height: 480px;
  position: relative;
}
.mesa-item {
  position: absolute;
  cursor: pointer;
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem;
  transition: transform .15s, box-shadow .15s;
  user-select: none;
  border: 2px solid transparent;
}
.mesa-item:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.mesa-libre    { background: #d4edda; border-color: #28a745; color: #155724; }
.mesa-ocupada  { background: #f8d7da; border-color: #dc3545; color: #721c24; }
.mesa-reservada{ background: #fff3cd; border-color: #ffc107; color: #856404; }
.mesa-vip      { background: rgba(201,168,76,.2); border-color: var(--gold); color: var(--navy); }
.mesa-barra    { background: rgba(31,56,100,.12); border-color: var(--navy); color: var(--navy); border-radius: 24px; }
.mesa-legend span { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

/* ── Comandas ── */
.comanda-card {
  border-radius: 10px; border: 1px solid var(--gray-2);
  overflow: hidden; background: #fff; height: 100%;
}
.comanda-card .comanda-header {
  padding: 10px 14px;
  font-weight: 700; font-size: .85rem;
  display: flex; justify-content: space-between; align-items: center;
}
.comanda-header.cocina { background: var(--navy); color: #fff; }
.comanda-header.bar    { background: var(--gold);  color: var(--navy); }
.comanda-header.lista  { background: var(--success); color: #fff; }
.comanda-item {
  padding: 8px 14px;
  border-bottom: 1px solid var(--gray-1);
  font-size: .83rem;
  display: flex; justify-content: space-between; align-items: center;
}
.comanda-item:last-child { border-bottom: none; }
.comanda-item .qty {
  background: var(--navy); color: #fff;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.comanda-timer { font-size: .72rem; color: var(--gray-3); }
.comanda-timer.urgent { color: var(--danger); font-weight: 700; }

/* ── Mensajería ── */
.chat-container { display: flex; height: 520px; border: 1px solid var(--gray-2); border-radius: 12px; overflow: hidden; background: #fff; }
.chat-sidebar { width: 260px; border-right: 1px solid var(--gray-2); display: flex; flex-direction: column; flex-shrink: 0; }
.chat-sidebar .chat-search { padding: 12px; border-bottom: 1px solid var(--gray-2); }
.chat-contacts { overflow-y: auto; flex: 1; }
.chat-contact-item {
  padding: 12px 16px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--gray-1);
  transition: background .15s;
}
.chat-contact-item:hover, .chat-contact-item.active { background: var(--gray-1); }
.chat-contact-item .contact-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff; flex-shrink: 0;
}
.chat-contact-item .unread {
  margin-left: auto; background: var(--danger);
  color: #fff; border-radius: 12px; font-size: .65rem;
  padding: 2px 7px; font-weight: 700;
}
.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-topbar { padding: 12px 16px; border-bottom: 1px solid var(--gray-2); display: flex; align-items: center; gap: 10px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg-bubble { max-width: 65%; padding: 10px 14px; border-radius: 16px; font-size: .875rem; line-height: 1.5; }
.msg-bubble.sent { background: var(--navy); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-bubble.recv { background: var(--gray-1); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-meta { font-size: .7rem; opacity: .6; margin-top: 4px; }
.chat-input-area { padding: 12px 16px; border-top: 1px solid var(--gray-2); display: flex; gap: 8px; }

/* ── Login page ── */
.login-page { min-height: 100vh; background: var(--navy); display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-text { font-size: 2rem; font-weight: 800; color: var(--navy); letter-spacing: 2px; }
.login-logo .logo-sub  { color: var(--gold); font-size: .85rem; letter-spacing: 3px; text-transform: uppercase; }

/* ── Alerts toast ── */
.toast-container-custom { position: fixed; top: 20px; right: 20px; z-index: 9999; }

/* ── Margin badge ── */
.margin-high   { color: #155724; background: rgba(21,87,36,.1); padding: 2px 8px; border-radius: 12px; font-weight: 600; }
.margin-mid    { color: #856404; background: rgba(133,100,4,.1); padding: 2px 8px; border-radius: 12px; font-weight: 600; }
.margin-low    { color: #721c24; background: rgba(114,28,36,.1); padding: 2px 8px; border-radius: 12px; font-weight: 600; }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--gray-2); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -28px; top: 4px;
  width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--navy);
  background: #fff; z-index: 1;
}
.timeline-dot.done   { background: var(--success); border-color: var(--success); }
.timeline-dot.active { background: var(--gold);    border-color: var(--gold); }

/* ── Responsive ── */
@media (max-width: 991px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .sidebar-overlay { display: block !important; }
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 999;
}
@media (max-width: 768px) {
  .content-area { padding: 16px; }
  .kpi-card .kpi-value { font-size: 1.4rem; }
  .chat-container { flex-direction: column; height: auto; }
  .chat-sidebar { width: 100%; height: 200px; border-right: none; border-bottom: 1px solid var(--gray-2); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-3); }

/* ── Misc utils ── */
.text-navy { color: var(--navy) !important; }
.text-gold  { color: var(--gold) !important; }
.bg-navy    { background: var(--navy) !important; }
.bg-gold    { background: var(--gold) !important; }
.divider-gold { border: none; border-top: 2px solid var(--gold); }
.btn-navy { background: var(--navy); color: #fff; border: none; }
.btn-navy:hover { background: var(--dark); color: #fff; }
.btn-gold { background: var(--gold); color: var(--navy); font-weight: 700; border: none; }
.btn-gold:hover { background: #b8953f; color: var(--navy); }
.cursor-pointer { cursor: pointer; }

/* ── Topbar: dropdown de usuario ── */
.topbar-user-wrap {
  position: relative;
}
.topbar-user-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1.5px solid var(--gray-2);
  border-radius: 24px; padding: 4px 12px 4px 4px;
  cursor: pointer; transition: .18s;
}
.topbar-user-btn:hover { border-color: var(--gold); background: rgba(201,168,76,.06); }
.topbar-user-btn .tu-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: var(--navy);
  font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-user-btn .tu-info { line-height: 1.2; text-align: left; }
.topbar-user-btn .tu-name { font-size: .78rem; font-weight: 700; color: var(--navy); white-space: nowrap; }
.topbar-user-btn .tu-role { font-size: .68rem; color: var(--gray-3); white-space: nowrap; }
.topbar-user-btn .tu-caret { color: var(--gray-3); font-size: .7rem; margin-left: 2px; }

/* Dropdown panel */
.topbar-user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 200px; background: #fff;
  border: 1px solid var(--gray-2); border-radius: 14px;
  box-shadow: 0 8px 32px rgba(31,56,100,.14);
  z-index: 9999; overflow: hidden;
  opacity: 0; pointer-events: none; transform: translateY(-8px);
  transition: opacity .18s, transform .18s;
}
.topbar-user-dropdown.open {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.tud-header {
  padding: 14px 16px 10px;
  background: linear-gradient(120deg, var(--navy) 0%, #2E5D9E 100%);
  color: #fff;
}
.tud-header .tud-name { font-size: .88rem; font-weight: 700; }
.tud-header .tud-cargo { font-size: .72rem; opacity: .8; margin-top: 2px; }
.tud-header .tud-email { font-size: .68rem; opacity: .6; margin-top: 1px; }
.tud-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: .82rem; color: #374151;
  cursor: pointer; text-decoration: none;
  transition: background .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.tud-item:hover { background: var(--gray-1); color: var(--navy); }
.tud-item i { width: 16px; text-align: center; color: var(--gray-3); }
.tud-item:hover i { color: var(--navy); }
.tud-item.tud-logout { color: #dc2626; }
.tud-item.tud-logout i { color: #dc2626; }
.tud-item.tud-logout:hover { background: #fee2e2; }
.tud-divider { height: 1px; background: var(--gray-2); margin: 4px 0; }
