/* Admin Dashboard Styles */
:root {
  --primary-color: #4a90e2;
  --primary-light: #6366F1;
  --primary-dark: #4338CA;
  --secondary-color: #6c757d;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --success-color: #28a745;
  --text-dark: #1F2937;
  --text-medium: #4B5563;
  --text-light: #9CA3AF;
  --background-light: #F9FAFB;
  --background-white: #FFFFFF;
  --border-color: #dee2e6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --transition-speed: 0.3s;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 70px;
  --header-height: 60px;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --text-color: #212529;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
  background-color: #f5f5f5;
  line-height: 1.6;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

a:hover {
  color: var(--primary-dark);
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* Admin Layout */
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  background-color: var(--dark-color);
  color: white;
  padding: 1rem;
  position: fixed;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
  font-size: 1.5rem;
  margin: 0;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-medium);
  margin-left: auto;
  font-size: 1.25rem;
}

.sidebar-nav ul {
  list-style: none;
  padding: 1rem 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-nav i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
}

/* Main Content */
.admin-main {
  margin-left: var(--sidebar-width);
  padding: 1rem;
}

/* Header */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.header-search {
  position: relative;
  width: 300px;
}

.header-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
}

.header-search i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary-color);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-menu {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 0;
}

.user-menu img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.5rem;
}

/* Content */
.admin-content {
  padding: 1.5rem;
}

.content-section {
  display: none;
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-section.active {
  display: block;
}

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

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.section-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

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

.stat-card {
  background-color: var(--background-white);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
}

.stat-icon {
  width: 48px;
  height: 48px;
  background-color: rgba(79, 70, 229, 0.1);
  color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-right: 1rem;
}

.stat-details h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-medium);
  margin-bottom: 0.25rem;
}

.stat-details p {
  font-size: 1.5rem;
  font-weight: 600;
}

/* Tables */
.table-container {
  background-color: var(--background-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background-color: var(--background-light);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 500;
  color: var(--text-medium);
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

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

tbody tr:hover {
  background-color: rgba(243, 244, 246, 0.5);
}

.loading-cell {
  text-align: center;
  padding: 2rem !important;
  color: var(--text-light);
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

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

.btn-primary:hover {
  background-color: #357abd;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

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

.btn-danger:hover {
  background-color: #DC2626;
}

.btn-warning {
  background-color: var(--warning-color);
  color: white;
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-primary {
  background-color: rgba(79, 70, 229, 0.1);
  color: var(--primary-color);
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

/* Filters */
.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: var(--light-color);
  border-radius: 8px;
}

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

.filter-group label {
  font-weight: 500;
  color: var(--dark-color);
}

.filter-group input,
.filter-group select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.pagination button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background-color: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination button:hover,
.pagination button.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background-color: var(--background-white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  display: none;
}

.modal.active {
  display: block;
}

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

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-medium);
  cursor: pointer;
}

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-speed) ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-light);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Notification */
.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: none;
}

.notification.active {
  display: block;
}

#notification-content {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background-color: var(--background-white);
  box-shadow: var(--shadow-md);
  margin-bottom: 0.5rem;
  min-width: 250px;
  max-width: 350px;
}

.notification-success {
  border-left: 4px solid var(--success-color);
}

.notification-error {
  border-left: 4px solid var(--danger-color);
}

.notification-warning {
  border-left: 4px solid var(--warning-color);
}

.notification-info {
  border-left: 4px solid var(--primary-color);
}

/* Responsive Styles */
@media (max-width: 991.98px) {
  .sidebar-toggle {
    display: block;
  }

  .admin-sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .admin-sidebar.expanded {
    width: var(--sidebar-width);
  }

  .admin-main {
    margin-left: var(--sidebar-collapsed-width);
  }

  .admin-main.expanded {
    margin-left: var(--sidebar-width);
  }

  .sidebar-nav span {
    display: none;
  }

  .admin-sidebar.expanded .sidebar-nav span {
    display: inline;
  }

  .sidebar-header h1 {
    display: none;
  }

  .admin-sidebar.expanded .sidebar-header h1 {
    display: block;
  }
}

@media (max-width: 767.98px) {
  .admin-sidebar {
    position: fixed;
    left: -100%;
    width: var(--sidebar-width);
    box-shadow: var(--shadow-lg);
  }

  .admin-sidebar.mobile-visible {
    left: 0;
  }

  .admin-main {
    margin-left: 0;
  }

  .sidebar-nav span {
    display: inline;
  }

  .sidebar-header h1 {
    display: block;
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .header-search {
    display: none;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-group input,
  .filter-group select {
    width: 100%;
  }
}

/* Utils */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--secondary-color);
}

.view-all {
  font-size: 0.875rem;
  font-weight: 500;
}

/* Order Status Colors */
.status-pending {
  color: var(--warning-color);
}

.status-processing {
  color: var(--primary-color);
}

.status-shipped {
  color: var(--secondary-color);
}

.status-delivered {
  color: var(--success-color);
}

.status-cancelled {
  color: var(--danger-color);
}

/* Action buttons in tables */
.action-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Product image in table */
.product-image-cell {
  width: 60px;
}

.product-image-cell img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* Order Details */
.order-details {
  margin-bottom: 1.5rem;
}

.order-info {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.order-info-item h4 {
  font-size: 0.875rem;
  color: var(--text-medium);
  margin-bottom: 0.25rem;
}

.order-items {
  margin-bottom: 1.5rem;
}

.order-summary {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.order-summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.order-total {
  font-weight: 600;
  font-size: 1.125rem;
}

.order-status-update {
  margin-top: 1.5rem;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.product-item {
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.product-item:hover {
  transform: translateY(-4px);
}

.product-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-details {
  padding: 1rem;
}

.product-details h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.product-details p {
  margin: 0;
  color: var(--secondary-color);
}

.product-details .price {
  font-weight: bold;
  color: var(--primary-color);
  font-size: 1.2rem;
  margin: 0.5rem 0;
}

.product-actions {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
}

.toast {
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.3s ease;
}

.toast.success {
  background-color: var(--success-color);
  color: white;
}

.toast.error {
  background-color: var(--danger-color);
  color: white;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
