:root {
  --admin-primary: #0f172a;
  --admin-accent: #0284c7;
  --admin-accent-hover: #0369a1;
  --admin-bg: #f8fafc;
  --admin-surface: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text: #0f172a;
  --admin-muted: #64748b;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: var(--admin-bg);
  color: var(--admin-text);
  min-height: 100vh;
}

/* Login Card */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  text-align: center;
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.login-card p {
  color: var(--admin-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* Admin Dashboard Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
}

.admin-sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-nav {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  transition: all 0.2s;
}

.nav-tab:hover, .nav-tab.active {
  background: #1e293b;
  color: #38bdf8;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid #1e293b;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.admin-topbar {
  background: white;
  border-bottom: 1px solid var(--admin-border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-content {
  padding: 2rem;
  max-width: 1300px;
  width: 100%;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.stat-card.clickable {
  cursor: pointer;
}

.stat-card.clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  border-color: #94a3b8;
}

.stat-card.clickable:active {
  transform: translateY(0);
}

.stat-card.active-card {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.35);
  background: #f0f9ff;
}

.stat-card.clickable::after {
  content: 'Filtrar ➔';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stat-card.clickable:hover::after {
  opacity: 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }

.stat-info span {
  font-size: 0.8rem;
  color: var(--admin-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-info h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
}

/* Table Card */
.table-card {
  background: white;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
  margin-bottom: 2rem;
}

.table-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.btn-primary {
  background: var(--admin-accent);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--admin-accent-hover);
}

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

.admin-table th {
  background: #f8fafc;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.admin-table tr:hover {
  background: #f8fafc;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-paid { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-shipped { background: #e0f2fe; color: #075985; }
.badge-delivered { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-outstock { background: #fee2e2; color: #991b1b; }

/* Filter Tabs Bar */
.filter-tabs-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--admin-border);
}

.filter-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-filter-tab {
  background: white;
  border: 1px solid var(--admin-border);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-filter-tab:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-filter-tab.active {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
}

.btn-filter-tab .tab-badge {
  background: rgba(0, 0, 0, 0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.75rem;
}

.btn-filter-tab.active .tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.search-input-wrap {
  position: relative;
  min-width: 250px;
}

.search-input-wrap input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 2rem;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
}

.search-input-wrap input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: #94a3b8;
  pointer-events: none;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  padding: 1.5rem;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-border);
}

@media (max-width: 900px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
  }
}

/* ==========================================
   MULTI-STORE STYLING (FORTE DENTAL VS BLOCKSTORE)
   ========================================== */

/* Forte Dental: Fondo celeste interno con acento azul */
.order-row-fd {
  background-color: #f0f9ff !important;
  border-left: 5px solid #0284c7 !important;
  transition: background-color 0.15s ease;
}
.order-row-fd td {
  background-color: #f0f9ff !important;
}
.order-row-fd:hover td {
  background-color: #e0f2fe !important;
}

/* BlockStore: Fondo gris claro interno con acento slate */
.order-row-bs {
  background-color: #f8fafc !important;
  border-left: 5px solid #64748b !important;
  transition: background-color 0.15s ease;
}
.order-row-bs td {
  background-color: #f8fafc !important;
}
.order-row-bs:hover td {
  background-color: #f1f5f9 !important;
}

/* Botones de Filtro por Tienda */
.btn-store-pill {
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--admin-border);
  background: white;
  color: #475569;
  transition: all 0.15s;
}
.btn-store-pill:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.btn-store-pill.active {
  background: #0f172a;
  color: white;
  border-color: #0f172a;
}
.btn-store-pill.active-fd {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
}
.btn-store-pill.active-bs {
  background: #475569;
  color: white;
  border-color: #475569;
}

/* Badges Identificadores de Tienda */
.badge-store-fd {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-store-bs {
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
