/* Admin Dashboard Theme overrides and extensions */

.admin-body {
  background-color: #f1f5f9; /* Lighter background for admin dashboard */
}

.admin-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 30px;
  padding-top: 30px;
  padding-bottom: 60px;
  min-height: calc(100vh - 88px);
}

/* Sidebar Styles */
.admin-sidebar {
  background-color: var(--secondary-color);
  border-radius: var(--border-radius-md);
  padding: 24px 16px;
  height: fit-content;
  box-shadow: var(--shadow-md);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-btn {
  background: none;
  border: none;
  outline: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  color: #94a3b8;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-btn.active {
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.badge-count {
  position: absolute;
  right: 18px;
  background-color: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

/* Content Area Tabs */
.admin-tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

.admin-tab-content.active {
  display: block;
}

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

.tab-title {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  color: var(--secondary-color);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

.tab-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.tab-header-row .tab-title {
  margin-bottom: 0;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: white;
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.sales { background-color: rgba(16, 185, 129, 0.1); color: var(--accent-color); }
.stat-icon.orders { background-color: rgba(37, 99, 235, 0.1); color: var(--primary-color); }
.stat-icon.pending { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.customers { background-color: rgba(124, 58, 237, 0.1); color: #7c3aed; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-info h3 {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  color: var(--secondary-color);
  margin-top: 4px;
}

/* Dashboard Details Layout */
.dashboard-details-row {
  display: flex;
  gap: 30px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Admin Panel Cards */
.admin-card {
  background-color: white;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}

.card-header h4 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary-color);
}

.btn-text {
  background: none;
  border: none;
  outline: none;
  color: var(--primary-color);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-text:hover {
  text-decoration: underline;
}

/* Table Styling */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-main);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background-color: #f8fafc;
}

.table-img {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
  background-color: #f1f5f9;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.status-badge.Pending, .status-badge.Pendiente {
  background-color: #fef3c7;
  color: #d97706;
}

.status-badge.Processing, .status-badge.En_Proceso, .status-badge.En-Proceso, .status-badge.Preparando {
  background-color: #ede9fe;
  color: #7c3aed;
}

.status-badge.Listo {
  background-color: #e0f2fe;
  color: #0369a1;
}

.status-badge.Shipped, .status-badge.Enviado, .status-badge.En_Camino, .status-badge.En-Camino {
  background-color: #dbeafe;
  color: #2563eb;
}

.status-badge.Delivered, .status-badge.Entregado {
  background-color: #d1fae5;
  color: #059669;
}

.status-badge.Canceled, .status-badge.Cancelado {
  background-color: #fee2e2;
  color: #dc2626;
}

/* Inventory Layout & Sidebar CRUD */
.inventory-layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.form-card-sidebar {
  width: 320px;
  flex-shrink: 0;
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.close-form-btn {
  background: none;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.close-form-btn:hover {
  color: var(--secondary-color);
}

.flex-grow-list {
  flex-grow: 1;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-form .form-group input, 
.admin-form .form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  outline: none;
  font-family: var(--font-body);
  font-size: 13px;
  background-color: var(--bg-main);
  transition: var(--transition-fast);
}

.admin-form .form-group input:focus, 
.admin-form .form-group textarea:focus {
  border-color: var(--primary-color);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.form-actions .btn-secondary {
  flex: 1;
  padding: 12px;
  justify-content: center;
  border-radius: var(--border-radius-sm);
}

.form-actions .btn-primary {
  flex: 1.5;
  padding: 12px;
  justify-content: center;
  border-radius: var(--border-radius-sm);
}

/* CRUD Action Buttons */
.crud-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: none;
  outline: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition-fast);
}

.btn-icon.edit {
  color: var(--primary-color);
  background-color: rgba(37, 99, 235, 0.05);
}

.btn-icon.edit:hover {
  background-color: var(--primary-color);
  color: white;
}

.btn-icon.delete {
  color: var(--danger);
  background-color: rgba(239, 68, 68, 0.05);
}

.btn-icon.delete:hover {
  background-color: var(--danger);
  color: white;
}

.btn-primary-sm {
  background-color: var(--primary-color);
  color: white;
  border: none;
  outline: none;
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-primary-sm:hover {
  background-color: var(--primary-hover);
}

/* Category Sales List */
.category-sales-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cat-sale-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-sale-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.cat-sale-bar-bg {
  width: 100%;
  height: 8px;
  background-color: var(--bg-main);
  border-radius: 4px;
  overflow: hidden;
}

.cat-sale-bar-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 4px;
}

/* Modals */
.modal-confirm {
  max-width: 400px;
}

.header-danger {
  background-color: var(--danger) !important;
}

.btn-danger-action {
  background: var(--danger) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
}

.btn-danger-action:hover {
  background: #dc2626 !important;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3) !important;
}

/* Order items tiny list */
.order-items-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-items-list li {
  list-style: none;
  font-size: 12px;
  color: var(--text-muted);
}

/* Filter components */
.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control-sm {
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
  background-color: white;
}

.status-select {
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

/* Responsive Dashboard */
@media (max-width: 992px) {
  .admin-container {
    grid-template-columns: 1fr;
  }
  
  .admin-sidebar {
    height: auto;
  }
  
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  
  .nav-btn {
    white-space: nowrap;
    width: auto;
  }
  
  .badge-count {
    position: relative;
    right: 0;
    margin-left: 6px;
  }
  
  .dashboard-details-row {
    flex-direction: column;
  }
  
  .inventory-layout {
    flex-direction: column;
  }
  
  .form-card-sidebar {
    width: 100%;
    position: relative;
    top: 0;
  }
}

/* IOS Style Toggle Switch Slider */
.switch input:checked + .slider {
  background-color: var(--accent-color) !important;
}
.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
.switch input:checked + .slider::before {
  transform: translateX(24px);
}
