/* src/css/pages/admin.css */

.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: #f9fafb !important;
  color: #111827 !important;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background-color: #ffffff !important;
  border-right: 1px solid #e5e7eb !important;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03) !important;
  display: flex;
  flex-direction: column;
  padding: 2rem 1rem;
  flex-shrink: 0;
}

.admin-logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: #E4002B !important;
  font-weight: bold;
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed #e5e7eb !important;
}

#adminUserInfo,
.admin-user-info {
  font-size: 0.85rem;
  color: #4b5563 !important;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px dashed #e5e7eb !important;
  margin-bottom: 1.5rem;
  padding: 0 0.5rem 1rem;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  list-style: none;
}

.sidebar-item-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent !important;
  color: #4b5563 !important;
  padding: 0.85rem 1.2rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  outline: none !important;
  outline: 0 !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.sidebar-item-btn:focus,
.sidebar-item-btn:active,
.sidebar-item-btn:focus-visible {
  outline: none !important;
  outline: 0 !important;
  box-shadow: none !important;
  border-color: transparent !important;
}

.sidebar-item-btn:hover {
  background: #f3f4f6 !important;
  color: #111827 !important;
}

.sidebar-item-btn.active {
  background: #FEE2E2 !important; /* Soft red tint */
  border: 1px solid #E4002B !important;
  color: #E4002B !important;
}

.sidebar-item-btn.active:focus,
.sidebar-item-btn.active:active,
.sidebar-item-btn.active:focus-visible {
  border-color: #E4002B !important;
  outline: none !important;
  box-shadow: none !important;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px dashed #e5e7eb !important;
}

.sidebar-footer .btn-secondary {
  background: #f3f4f6 !important;
  color: #374151 !important;
  border: 1px solid #e5e7eb !important;
}

.sidebar-footer .btn-secondary:hover {
  background: #e5e7eb !important;
  color: #111827 !important;
}

/* Main Content area */
.admin-main {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
  height: 100vh;
  background-color: #f9fafb !important;
  color: #111827 !important;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
}

/* Section titles, card titles, text */
h1, h2, h3, h4, h5, h6,
.section-title,
.card-title,
.table-title,
.admin-title-box h1 {
  color: #111827 !important;
}

.admin-title-box h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin-bottom: 0.3rem;
}

.admin-title-box p {
  color: #4b5563 !important;
  font-size: 0.95rem;
}

/* Pestañas de Contenido (Tabs) */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 2rem;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Controles superiores (Buscador, Filtros, Selects) */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  padding: 1rem 1.5rem;
  border-radius: 16px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
  flex: 2;
  min-width: 250px;
}

/* Filter inputs, search inputs, tabs */
.admin-main input.form-control,
.admin-main select.form-control,
.admin-main textarea.form-control,
.table-controls input,
.table-controls select,
.search-input-wrapper input,
.admin-turnos-controls input,
.admin-turnos-controls select,
.input-buscar-turno,
.select-filtro-turno,
.select-role-control,
.admin-option-input-styled,
.admin-modal-card input,
.admin-modal-card select,
.admin-modal-card textarea {
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  color: #111827 !important;
  border-radius: 8px;
}

.admin-main input.form-control:focus,
.admin-main select.form-control:focus,
.table-controls input:focus,
.table-controls select:focus,
.admin-modal-card input:focus,
.admin-modal-card select:focus {
  border-color: #E4002B !important;
  box-shadow: 0 0 0 2px rgba(228, 0, 43, 0.1) !important;
}

.admin-main input.form-control::placeholder,
.table-controls input::placeholder,
.search-input-wrapper input::placeholder,
.admin-modal-card input::placeholder,
.admin-modal-card textarea::placeholder {
  color: #9ca3af !important;
}

/* Tablas Admin */
.table-responsive {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
  overflow: hidden;
}

.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;
  background: #ffffff !important;
}

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

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

.admin-table th.sortable {
  cursor: pointer;
  user-select: none;
}

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

/* Celdas especiales */
.product-cell {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.product-img-mini {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.role-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
}

.role-badge.admin { background: #FEE2E2; color: #E4002B; border: 1px solid #fca5a5; }
.role-badge.cajero { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }
.role-badge.mesero { background: #dbeafe; color: #2563eb; border: 1px solid #93c5fd; }
.role-badge.cocinero { background: #f3e8ff; color: #9333ea; border: 1px solid #d8b4fe; }
.role-badge.cliente { background: #f3f4f6; color: #4b5563; border: 1px solid #d1d5db; }

/* Switches de disponibilidad (toggles) */
.switch-container {
  display: inline-flex;
  align-items: center;
}

.switch-input {
  display: none;
}

.switch-label {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  background-color: #d1d5db;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.switch-label::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch-input:checked + .switch-label {
  background-color: #16a34a;
}

.switch-input:checked + .switch-label::after {
  transform: translateX(22px);
}

/* Botones de acción en tablas */
.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-action {
  background: #f3f4f6 !important;
  border: 1px solid #e5e7eb !important;
  color: #4b5563 !important;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action:hover {
  background: #e5e7eb !important;
  border-color: #d1d5db !important;
  color: #111827 !important;
  transform: scale(1.05);
}

.btn-action.edit:hover {
  color: #2563eb !important;
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}

.btn-action.delete:hover {
  color: #dc2626 !important;
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
}

/* Modales in admin */
.admin-modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.admin-modal-card {
  max-width: 550px;
  width: 95%;
  background: #ffffff !important;
  color: #111827 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 20px;
  padding: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e7eb !important;
  padding-bottom: 1rem;
}

.modal-header-actions h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: #E4002B !important;
}

.btn-cerrar {
  background: #f3f4f6 !important;
  border: 1px solid #e5e7eb !important;
  color: #4b5563 !important;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cerrar:hover {
  background: #e5e7eb !important;
  color: #111827 !important;
}

/* Image preview box in Form */
.image-upload-preview-container {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  background: #f9fafb !important;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid #e5e7eb !important;
}

.image-preview-large {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb !important;
  flex-shrink: 0;
}

.image-upload-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Responsive adjustment */
@media (max-width: 900px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb !important;
    padding: 1.5rem 1rem;
    background-color: #ffffff !important;
  }
  .admin-logo {
    margin-bottom: 1rem;
    border-bottom: none !important;
    padding-bottom: 0;
  }
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .sidebar-item-btn {
    white-space: nowrap;
  }
  .admin-main {
    padding: 1.5rem;
    height: auto;
    overflow-y: visible;
  }
  .table-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrapper {
    max-width: 100%;
  }
}

/* Badge Styles for Orders History */
.order-type-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
}

.type-mesa {
  background: #fee2e2;
  color: #E4002B;
  border: 1px solid #fca5a5;
}

.type-domicilio {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #7dd3fc;
}

.type-llevar {
  background: #f3e8ff;
  color: #9333ea;
  border: 1px solid #d8b4fe;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
}

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

.status-cocina {
  background: #dbeafe;
  color: #2563eb;
  border: 1px solid #93c5fd;
}

.status-preparando {
  background: #f3e8ff;
  color: #9333ea;
  border: 1px solid #d8b4fe;
}

.status-listo {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
}

.status-entregado {
  background: #ccfbf1;
  color: #0d9488;
  border: 1px solid #5eead4;
}

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

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

/* Metric Cards Dashboard Styles */
.card,
.metric-card {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  color: #111827 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
  border-radius: 14px;
}

.metric-card {
  animation: cardFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.metric-card-title {
  color: #4b5563 !important;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(15px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Controles de Paginación */
.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  background: #ffffff !important;
  border-radius: 12px;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

#txtAdminPedidosPage {
  font-size: 0.9rem;
  font-weight: 500;
  color: #4b5563 !important;
}

.btn-logout {
  width: 100%;
  background: #ef4444 !important;
  color: #ffffff !important;
}

.th-width-id {
  width: 320px;
}

.flex-control-wrapper {
  flex: 1;
  min-width: 150px;
}

.admin-modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.textarea-no-resize {
  resize: none;
  font-family: inherit;
}

.grid-two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.flex-between-center {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.label-bold-nomargin {
  margin-bottom: 0;
  font-weight: bold;
  color: #374151 !important;
}

.btn-add-option-admin {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  width: auto;
  border: 1px solid #d1d5db !important;
  background: #f3f4f6 !important;
  color: #374151 !important;
  border-radius: 6px;
  cursor: pointer;
}

.btn-add-option-admin:hover {
  background: #e5e7eb !important;
  color: #111827 !important;
}

.admin-options-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 150px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid #e5e7eb !important;
  border-radius: 6px;
  background: #f9fafb !important;
}

.flex-align-center-between {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
  justify-content: space-between;
}

.label-clickable {
  margin-bottom: 0;
  cursor: pointer;
  color: #374151 !important;
}

.label-accent-bold {
  color: #E4002B !important;
  font-weight: bold;
  font-size: 0.85rem;
}

.file-input-padding {
  padding: 0.4rem;
}

.flex-gap-margin {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.flex-1 {
  flex: 1;
}

.text-center-muted {
  text-align: center;
  color: #6b7280 !important;
}

.display-block {
  display: block;
}

.text-small-muted {
  color: #6b7280 !important;
  font-size: 0.8rem;
}

.category-pill {
  background: #f3f4f6 !important;
  border: 1px solid #e5e7eb !important;
  color: #374151 !important;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.admin-option-input-styled {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

.btn-action-delete-styled {
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #fca5a5 !important;
  background: #ef4444;
  color: white;
  cursor: pointer;
}

.td-monospace-muted {
  font-family: monospace;
  font-size: 0.85rem;
  color: #6b7280 !important;
}

.badge-mesa {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: bold;
}
.badge-mesa.libre {
  color: #16a34a;
  background: #dcfce7;
  border: 1px solid #86efac;
}
.badge-mesa.ocupada {
  color: #E4002B;
  background: #FEE2E2;
  border: 1px solid #fca5a5;
}

.flex-gap-center {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.select-role-control {
  max-width: 150px;
  font-size: 0.85rem;
  padding: 0.4rem;
}

.text-accent-bold {
  font-weight: bold;
  color: #E4002B !important;
}

.order-detail-note {
  font-size: 0.8rem;
  color: #6b7280 !important;
  margin-top: 0.2rem;
}

.text-bold {
  font-weight: bold;
}

.cust-modal-card-detail {
  max-width: 550px !important;
  width: 90% !important;
}

.modal-body-scrollable {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 80vh;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.order-detail-info-box {
  font-size: 0.9rem;
  border: 1px solid #e5e7eb !important;
  padding: 0.8rem;
  border-radius: 8px;
  background: #f9fafb !important;
  color: #111827 !important;
  line-height: 1.5;
}

.order-detail-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.order-detail-total-row {
  border-top: 1px dashed #e5e7eb !important;
  padding-top: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #111827 !important;
}

.order-detail-total-val {
  font-size: 1.3rem;
  color: #E4002B !important;
  font-weight: bold;
}

.link-accent-underline {
  color: #E4002B !important;
  text-decoration: underline;
}

.padding-1rem {
  padding: 1rem;
}

.order-item-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6 !important;
  color: #111827 !important;
}

.text-center-danger {
  text-align: center;
  color: #dc2626 !important;
}

.admin-option-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.hidden-initially {
  display: none !important;
}

/* Estilos para Pestaña y Modal de Turnos (Admin) */
.admin-turnos-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.input-buscar-turno {
  flex: 2;
  min-width: 200px;
}

.select-filtro-turno {
  flex: 1;
  min-width: 150px;
}

.admin-turno-card {
  max-width: 600px;
  width: 95%;
}

.admin-turno-detail-content {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  font-size: 0.9rem;
  color: #111827 !important;
}

.margin-top-1-5 {
  margin-top: 1.5rem;
}

/* Botón de ver comanda / detalle turno tipo icono */
.btn-ver-comanda-icon {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  text-decoration: none;
  border: 1px solid #bfdbfe !important;
  padding: 0;
  background: #eff6ff !important;
  color: #2563eb !important;
}

.btn-ver-comanda-icon:hover {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
  transform: scale(1.05);
}

@media (max-width: 900px) {
  .sidebar-footer {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px dashed #e5e7eb !important;
    margin-top: 0.5rem;
    width: 100%;
  }

  .sidebar-footer a,
  .sidebar-footer button {
    flex: 1;
    margin-bottom: 0 !important;
    padding: 0.6rem 0.5rem !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
    text-align: center;
  }
}

/* Desglose Arqueo y Auditoría de Turno en Admin */
.caja-desglose-box {
  background: #f9fafb !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #111827 !important;
}

.caja-desglose-row {
  display: flex;
  justify-content: space-between;
  color: #374151 !important;
}

.val-white { color: #111827 !important; }
.val-green { color: #16a34a !important; }
.val-blue { color: #2563eb !important; }
.val-red { color: #dc2626 !important; }
.val-purple { color: #9333ea !important; }
.val-amber { color: #d97706 !important; }
.val-muted { color: #6b7280 !important; }

.caja-desglose-total {
  display: flex;
  justify-content: space-between;
  border-top: 1px dashed #e5e7eb !important;
  padding-top: 0.4rem;
  margin-top: 0.2rem;
  font-size: 1.1rem;
  font-weight: bold;
  color: #E4002B !important;
}

.caja-desglose-hr {
  border: 0;
  border-top: 1px solid #e5e7eb !important;
  margin: 0.5rem 0;
}
