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

/* src/css/global.css */
:root {
  --background: #f8f9fa; /* Clean light canvas */
  --foreground: #111827; /* Dark charcoal/black high-contrast text */
  --primary: #E4002B;    /* Official KFC Red */
  --primary-hover: #C40024;
  --accent: #E4002B;
  --accent-rgb: 228, 0, 43;
  --font-serif: 'Playfair Display', Georgia, serif;
  --secondary: #ffffff;
  --border: #e5e7eb;
  --card-bg: #ffffff;
  --text-muted: #4b5563; /* Readable slate gray */
  --text: #111827;
  --warning: #d97706;
  --success: #059669;
  --danger: #dc2626;
  --glow-color: rgba(228, 0, 43, 0.08);
  --card-radius: 1.25rem;

  /* Colores RGB para controles de opacidad sutiles */
  --rgb-total: 228, 0, 43;
  --rgb-neto: 5, 150, 105;
  --rgb-domi: 37, 99, 235;
  --rgb-propina: 124, 58, 237;
  --rgb-pending: 217, 119, 6;

  /* Opacidades configurables para el tema claro */
  --glass-glow-opacity: 0.07;
  --glass-border-opacity: 0.2;
  --glass-hover-border-opacity: 0.25;
  --glass-hover-shadow-opacity: 0.12;
}

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

/* Reset de contornos de enfoque y sombras en botones y enlaces */
button:focus,
button:active,
button:focus-visible,
a:focus,
a:active,
a:focus-visible {
  outline: none !important;
  outline: 0 !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  color: var(--foreground);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--background);
  overflow-x: hidden;
}

/* Scrollbars personalizadas estilo limpio */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 9999px;
  border: 2px solid #f1f1f1;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ========================================================
   FONDO EN LLAMAS Y RESPLANDOR DESACTIVADOS
   ======================================================== */
.fire-bg-container, .pointer-glow, .embers-container, .fire-flame, .ember {
  display: none !important;
}

/* Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.text-center { text-align: center; }
.hidden { display: none !important; }

/* Botones */
.btn-primary {
  background: #E4002B !important;
  color: #ffffff !important;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(228, 0, 43, 0.3) !important;
}

.btn-primary:hover {
  background: #C40024 !important;
  box-shadow: 0 6px 18px rgba(228, 0, 43, 0.45) !important;
  transform: translateY(-2px);
}

.btn-secondary {
  background: #ffffff !important;
  color: #111827 !important;
  border: 1px solid #d1d5db !important;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.btn-secondary:hover {
  background: #f3f4f6 !important;
  color: #111827 !important;
  border-color: #d1d5db;
  transform: translateY(-2px);
}

.btn-danger {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
  background: #b91c1c !important;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.45);
  transform: translateY(-2px);
}

/* Botones Desactivados */
button:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
  opacity: 0.35;
  cursor: not-allowed !important;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* Ocultar botones de paginación deshabilitados */
.pagination-controls button:disabled {
  visibility: hidden;
}

/* Tarjetas */
.card {
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: var(--card-radius);
  padding: 1.25rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
  color: #111827;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 600px) {
  .card {
    padding: 1.75rem;
  }
}

.card:hover {
  border-color: rgba(228, 0, 43, 0.35) !important;
  box-shadow: 0 8px 25px rgba(228, 0, 43, 0.12) !important;
  transform: translateY(-3px);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.5rem;
  border-bottom: 3px solid #E4002B !important;
  background-color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
  color: #111827;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@media (max-width: 600px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .btn-primary, .btn-secondary {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* Drawer Overlay (Checkout) */
.drawer-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.drawer {
    position: fixed;
    top: 0; right: -450px;
    width: 100%; max-width: 420px;
    height: 100vh;
    height: 100dvh;
    background: #ffffff !important;
    color: #111827 !important;
    border-left: 1px solid #e5e7eb !important;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12) !important;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer-overlay.open .drawer {
    right: 0;
}
.drawer-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #e5e7eb !important;
    color: #111827;
    display: flex; justify-content: space-between; align-items: center;
}
.btn-cerrar {
    background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer;
}
.drawer-content {
    padding: 1.2rem 1.5rem;
    flex: 1;
    overflow-y: auto;
    color: #111827;
}
.cart-item-checkout {
    display: flex; justify-content: space-between; padding-bottom: 0.8rem; border-bottom: 1px dashed #e5e7eb !important;
    color: #111827;
}

/* Formularios Style */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: #374151 !important;
    font-weight: 600;
}
.form-control {
    width: 100%;
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    padding: 0.75rem 1.1rem;
    border-radius: 9999px;
    color: #111827 !important;
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    outline: none;
    transition: all 0.3s ease;
}
.form-control:focus {
    border-color: #E4002B !important;
    box-shadow: 0 0 0 3px rgba(228, 0, 43, 0.15) !important;
}

/* Corrección para desplegables de select nativos en navegadores */
select option {
    background-color: #ffffff !important;
    color: #111827 !important;
}

/* Image Preview Modal (comprobante) */
.modal-image-preview {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75) !important;
  z-index: 1300 !important;
}

/* Common Helper Layout Classes */
.table-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.modal-body-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem 0;
}

.modal-image-preview.open {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

.image-preview-wrapper {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.btn-cerrar-preview {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 2.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
}

.image-preview-content {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.btn-full-size {
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.9rem;
}

.comprobante-link {
  color: var(--accent);
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
  background: transparent;
  border: none;
  font-size: 0.9rem;
  padding: 0;
  display: inline-block;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
}

.status-pendiente {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-cocina {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.status-preparando {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.status-listo {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-entregado {
  background: #ccfbf1;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

.status-despachado {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

.status-cancelado {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Tablas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04) !important;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid #e5e7eb !important;
  background: #f9fafb !important;
  font-weight: 600;
  color: #4b5563 !important;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.admin-table td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid #f3f4f6 !important;
  color: #111827 !important;
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr {
  transition: all 0.2s ease;
}

.admin-table tbody tr:hover td {
  background-color: #f9fafb !important;
}

/* Encabezados Ordenables */
.admin-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.admin-table th.sortable:hover {
  background-color: #f3f4f6 !important;
  color: #111827 !important;
}

/* Sección Recogida y Comprobantes (Transferencia) */
.pickup-details-box {
    background: rgba(var(--accent-rgb), 0.05);
    border: 1px dashed var(--accent);
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: #111827;
}

.comprobante-qr-box {
    background: #fff;
    padding: 0.8rem;
    border-radius: 8px;
    width: 250px;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.5rem auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.comprobante-qr-box img {
    max-width: 100%;
    max-height: 100%;
}

/* Logo de la empresa */
.brand-logo-img {
  height: 40px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
  vertical-align: middle;
}

.brand-logo-sidebar {
  height: 70px;
  width: auto;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  object-fit: contain;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Contenedor del logo y título de marca en cabeceras */
.header-brand-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Botón de retroceso global en cabeceras */
.btn-back-global {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  color: #111827 !important;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-back-global:hover {
  background: #fef2f2 !important;
  border-color: #e5e7eb;
  color: #E4002B !important;
  transform: scale(1.05);
}

.btn-back-global:active {
  transform: scale(0.95);
}

.btn-back-global svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back-global:hover svg {
  transform: scale(1.05);
}

/* Botón de retroceso global para barras laterales (sidebar) */
.btn-sidebar-back {
  width: 100%;
  text-align: center;
  margin-bottom: 0.8rem;
  display: block;
}

/* Contenedor de acciones en la cabecera (botones, usuario, etc.) */
.header-actions-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Nombre de usuario mostrado en la cabecera */
.user-name-header {
  font-weight: bold;
  color: var(--primary);
  font-size: 0.9rem;
}

/* Nombre de usuario pequeño */
.user-name-small {
  color: var(--primary);
  font-weight: bold;
  font-size: 0.8rem;
}

/* ==========================================
   UNIFIED METRICS DASHBOARD (CLEAN LIGHT THEME)
   ========================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.8rem;
  width: 100%;
}

.metric-card {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px !important;
  padding: 1.25rem !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  align-items: center;
  justify-content: center;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(228, 0, 43, 0.3) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08) !important;
}

/* Modifiers for Accent Glows and Left Indicators in Light Theme */
.metric-card.total {
  border-left: 4px solid rgba(var(--rgb-total), 0.9) !important;
}
.metric-card.total:hover {
  border-color: rgba(var(--rgb-total), 0.5) !important;
  box-shadow: 0 6px 20px rgba(var(--rgb-total), 0.12) !important;
}

.metric-card.neto,
.metric-card.completed,
.metric-card.success {
  border-left: 4px solid rgba(var(--rgb-neto), 0.9) !important;
}
.metric-card.neto:hover,
.metric-card.completed:hover,
.metric-card.success:hover {
  border-color: rgba(var(--rgb-neto), 0.5) !important;
  box-shadow: 0 6px 20px rgba(var(--rgb-neto), 0.12) !important;
}

.metric-card.domi,
.metric-card.info {
  border-left: 4px solid rgba(var(--rgb-domi), 0.9) !important;
}
.metric-card.domi:hover,
.metric-card.info:hover {
  border-color: rgba(var(--rgb-domi), 0.5) !important;
  box-shadow: 0 6px 20px rgba(var(--rgb-domi), 0.12) !important;
}

.metric-card.propina,
.metric-card.mesa,
.metric-card.purple {
  border-left: 4px solid rgba(var(--rgb-propina), 0.9) !important;
}
.metric-card.propina:hover,
.metric-card.mesa:hover,
.metric-card.purple:hover {
  border-color: rgba(var(--rgb-propina), 0.5) !important;
  box-shadow: 0 6px 20px rgba(var(--rgb-propina), 0.12) !important;
}

.metric-card.pending,
.metric-card.warning {
  border-left: 4px solid rgba(var(--rgb-pending), 0.9) !important;
}
.metric-card.pending:hover,
.metric-card.warning:hover {
  border-color: rgba(var(--rgb-pending), 0.5) !important;
  box-shadow: 0 6px 20px rgba(var(--rgb-pending), 0.12) !important;
}

.metric-card-title {
  font-size: 0.72rem;
  color: #6b7280 !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.metric-card-value {
  font-size: 1.7rem;
  font-weight: 800;
  margin-top: 0.2rem;
  line-height: 1.1;
  color: #111827 !important;
  text-shadow: none !important;
  transition: color 0.3s ease;
}
