/* =============================================
   GASTROFLOW v0.2.0 — Extensions CSS
   Login · Roles · Equipo · Mi Cuenta · Mi Negocio
   Drag&Drop · Images · Mobile App Nav
   ============================================= */

/* ── MOBILE OVERLAY ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
  z-index: 150;
}
.sidebar-overlay.open { display: block; }

/* ── BOTTOM NAV (mobile app feel) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (max-width: 768px) {
  .bottom-nav { display: flex; }
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--tx-4);
  cursor: pointer;
  transition: color var(--t-fast);
  font-size: 10px;
  font-weight: 600;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item.active { color: var(--brand); }
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  background: var(--brand);
  border-radius: 0 0 2px 2px;
}
.bottom-nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--s-cuenta);
  color: white;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-0);
}

/* ── LOGIN SCREEN ── */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--r-2xl);
  padding: 36px;
  box-shadow: var(--sh-lg);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.login-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--brand), #EF4444);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--brand-glow);
}
.login-logo svg { width: 32px; height: 32px; color: white; }
.login-title { font-size: 24px; font-weight: 800; color: var(--tx-1); letter-spacing: -0.5px; }
.login-subtitle { font-size: 13px; color: var(--tx-4); }
.login-negocio { font-size: 16px; font-weight: 700; color: var(--brand); }

.login-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-4);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}
.login-users { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.login-user-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: left;
  width: 100%;
}
.login-user-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--brand); }
.login-user-btn.selected { background: var(--brand-dim); border-color: var(--brand); }
.login-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
}
.login-user-info { flex: 1; min-width: 0; }
.login-user-name { font-size: 14px; font-weight: 600; color: var(--tx-1); }
.login-user-role { font-size: 11px; color: var(--tx-4); margin-top: 1px; }
.login-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ── EQUIPO ── */
.equipo-layout { display: flex; flex-direction: column; gap: 16px; }
.equipo-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.equipo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.usuario-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xl);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.usuario-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.usuario-card.inactivo { opacity: 0.5; }
.usuario-card-top { display: flex; align-items: center; gap: 12px; }
.usuario-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: white;
}
.usuario-info { flex: 1; min-width: 0; }
.usuario-nombre { font-size: 15px; font-weight: 700; color: var(--tx-1); }
.usuario-email { font-size: 11px; color: var(--tx-4); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.usuario-turno {
  font-size: 11px;
  color: var(--tx-3);
  background: rgba(255,255,255,0.05);
  padding: 3px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.usuario-actions { display: flex; gap: 6px; margin-top: auto; }

/* ── ROLE BADGES ── */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.role-dueno    { background: rgba(249,115,22,0.15); color: #F97316; }
.role-admin    { background: rgba(59,130,246,0.15);  color: #3B82F6; }
.role-encargado{ background: rgba(236,72,153,0.15); color: #EC4899; }
.role-cajero   { background: rgba(34,197,94,0.15);  color: #22C55E; }
.role-mozo     { background: rgba(168,85,247,0.15); color: #A855F7; }
.role-cocinero { background: rgba(234,179,8,0.15);  color: #EAB308; }

/* ── MI CUENTA ── */
.micuenta-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
@media (max-width: 900px) { .micuenta-layout { grid-template-columns: 1fr; } }

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-2xl);
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.profile-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: white;
  border: 3px solid var(--border-light);
  position: relative;
  cursor: pointer;
}
.profile-avatar-lg .avatar-edit {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  background: var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-0);
}
.profile-avatar-lg .avatar-edit svg { width: 10px; height: 10px; color: white; }
.profile-name { font-size: 18px; font-weight: 800; color: var(--tx-1); }
.profile-email { font-size: 13px; color: var(--tx-4); }
.profile-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.profile-stat {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-md);
  padding: 12px;
  text-align: center;
}
.profile-stat-val { font-size: 18px; font-weight: 800; color: var(--brand); }
.profile-stat-label { font-size: 10px; color: var(--tx-4); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }

.profile-form { display: flex; flex-direction: column; gap: 16px; }
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx-1);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title svg { width: 16px; height: 16px; color: var(--brand); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ── MI NEGOCIO ── */
.minegocio-layout { display: flex; flex-direction: column; gap: 16px; }
.negocio-header-card {
  background: linear-gradient(135deg, rgba(249,115,22,0.15), rgba(239,68,68,0.1));
  border: 1px solid rgba(249,115,22,0.2);
  border-radius: var(--r-2xl);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.negocio-logo-box {
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--brand), #EF4444);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  position: relative;
  box-shadow: var(--brand-glow);
}
.negocio-logo-box .edit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.negocio-logo-box:hover .edit-overlay { opacity: 1; }
.edit-overlay svg { width: 20px; height: 20px; color: white; }
.negocio-info h2 { font-size: 22px; font-weight: 800; color: var(--tx-1); }
.negocio-info p { font-size: 13px; color: var(--tx-3); margin-top: 4px; }
.negocio-config-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 768px) { .negocio-config-grid { grid-template-columns: 1fr; } }
.config-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xl);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.config-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--tx-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.config-card-title svg { width: 16px; height: 16px; color: var(--brand); }

/* ── DRAG & DROP EDIT MODE ── */
.edit-mode-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(234,179,8,0.1);
  border: 1px dashed rgba(234,179,8,0.4);
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 600;
  color: var(--s-cocina);
  margin-bottom: 8px;
}
.edit-mode-bar svg { width: 16px; height: 16px; }

.floor-canvas.edit-mode { cursor: default; }
.floor-canvas.edit-mode .mesa-item {
  cursor: grab;
  outline: 1px dashed rgba(234,179,8,0.3);
  border-radius: var(--r-md);
}
.floor-canvas.edit-mode .mesa-item:active { cursor: grabbing; }
.floor-canvas.edit-mode .mesa-item:hover { outline-color: var(--s-cocina); }

/* ── PRODUCT IMAGES ── */
.producto-card-img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--bg-3);
}
.producto-card-img-placeholder {
  width: 100%;
  height: 80px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: rgba(255,255,255,0.2);
  flex-shrink: 0;
}
.img-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.img-upload-area:hover { border-color: var(--brand); }
.img-upload-area svg { width: 28px; height: 28px; color: var(--tx-4); }
.img-upload-area p { font-size: 12px; color: var(--tx-4); }

/* ── COLOR PICKER ── */
.color-picker-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--t-fast);
}
.color-option.selected { border-color: white; transform: scale(1.2); }
.color-option:hover { transform: scale(1.1); }

/* ── TURNO SELECT ── */
.turno-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.turno-pill {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-glass);
  background: rgba(255,255,255,0.04);
  color: var(--tx-3);
  transition: all var(--t-fast);
}
.turno-pill.selected {
  background: var(--brand-dim);
  border-color: var(--brand);
  color: var(--brand);
}

/* ── PERMISOS GRID ── */
.permisos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.permiso-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tx-3);
}
.permiso-check {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.permiso-check.on { background: var(--s-libre); }
.permiso-check.on svg { width: 10px; height: 10px; color: #052e16; }
.permiso-check.off { background: rgba(255,255,255,0.06); border: 1px solid var(--border); }

/* ── MOBILE IMPROVEMENTS ── */
@media (max-width: 768px) {
  .equipo-grid { grid-template-columns: 1fr; }
  .negocio-config-grid { grid-template-columns: 1fr; }
  .micuenta-layout { grid-template-columns: 1fr; }
  .negocio-header-card { flex-direction: column; text-align: center; }
  .reportes-grid { grid-template-columns: 1fr; }

  /* Topbar mobile: show only icon + title */
  .time-display { display: none; }
  .top-btn-brand span { display: none; }
  .top-btn-brand { min-width: 40px; padding: 8px; }

  /* Pedidos mobile: tabs scroll + order below */
  .pedidos-layout { display: flex; flex-direction: column; gap: 14px; }
  .productos-panel { min-height: 300px; }

  /* Caja mobile: stack */
  .caja-layout { display: flex; flex-direction: column; }

  /* Dashboard grid: 2 cols on mobile */
  .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-value { font-size: 22px; }

  /* Floor canvas: smaller padding */
  .floor-canvas { padding: 20px; min-height: 420px; }

  /* Menu table: hide some columns */
  .menu-table-header > *:nth-child(4),
  .menu-table-row > *:nth-child(4) { display: none; }

  /* Sector tabs: compact */
  .sector-tabs { width: 100%; overflow-x: auto; }
  .sector-tab { padding: 7px 12px; font-size: 12px; }
}

/* ── SAFE AREA (notch/home indicator) ── */
.bottom-nav {
  padding-bottom: max(env(safe-area-inset-bottom), 8px);
}
.gf-content {
  padding-bottom: calc(var(--bottom-nav-h, 0px) + env(safe-area-inset-bottom, 0px) + 24px);
}

/* ── SECTION NAV GROUP ── */
.nav-group-divider {
  height: 1px;
  background: var(--border-glass);
  margin: 8px 0;
}

/* ── INPUT TEXTAREA ── */
textarea.input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ── STATUS DOT INLINE ── */
.status-dot-inline {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}
