/* Admin Portal Styles */
:root {
  --admin-primary: #2c3e50;
  --admin-secondary: #34495e;
  --admin-accent: #3498db;
  --admin-success: #27ae60;
  --admin-warning: #f39c12;
  --admin-danger: #e74c3c;
  --admin-light: #ecf0f1;
  --admin-dark: #2c3e50;
  --admin-border: #bdc3c7;
  --admin-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Admin Container */
.admin-container {
  display: grid;
  grid-template-areas: 
    "header header"
    "nav main";
  grid-template-columns: 250px 1fr;
  grid-template-rows: 70px 1fr;
  min-height: 100vh;
  background: #f8f9fa;
}

/* Admin Header */
.admin-header {
  grid-area: header;
  background: var(--admin-primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  box-shadow: var(--admin-shadow);
  z-index: 1000;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-logo {
  width: 40px;
  height: 40px;
  border-radius: 6px;
}

.admin-brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logout-btn {
  background: var(--admin-danger);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s ease;
}

.logout-btn:hover {
  background: #c0392b;
}

/* Admin Navigation */
.admin-nav {
  grid-area: nav;
  background: white;
  border-right: 1px solid var(--admin-border);
  padding: 1rem 0;
  box-shadow: var(--admin-shadow);
}

.admin-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-nav li {
  margin: 0;
}

.admin-nav .nav-link {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--admin-dark);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.admin-nav .nav-link:hover {
  background: var(--admin-light);
  border-left-color: var(--admin-accent);
}

.admin-nav .nav-link.active {
  background: var(--admin-light);
  border-left-color: var(--admin-accent);
  color: var(--admin-accent);
  font-weight: 600;
}

/* Admin Main Content */
.admin-main {
  grid-area: main;
  padding: 2rem;
  overflow-y: auto;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.admin-section h2 {
  color: var(--admin-dark);
  margin-bottom: 2rem;
  font-size: 2rem;
  border-bottom: 2px solid var(--admin-accent);
  padding-bottom: 0.5rem;
}

/* Dashboard Styles */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--admin-shadow);
  text-align: center;
  border-left: 4px solid var(--admin-accent);
}

.stat-card h3 {
  margin: 0 0 1rem 0;
  color: var(--admin-secondary);
  font-size: 1rem;
  font-weight: 500;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--admin-accent);
}

.dashboard-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: var(--admin-accent);
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--admin-secondary);
  color: white;
}

.btn-secondary:hover {
  background: #2c3e50;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--admin-success);
  color: white;
}

.btn-success:hover {
  background: #229954;
}

.btn-warning {
  background: var(--admin-warning);
  color: white;
}

.btn-warning:hover {
  background: #e67e22;
}

.btn-danger {
  background: var(--admin-danger);
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

/* Form Styles */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--admin-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--admin-border);
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-checkboxes {
  display: flex;
  gap: 2rem;
  margin: 1rem 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

/* Table Styles */
.inventory-table-container,
.pricing-table-container {
  background: white;
  border-radius: 8px;
  box-shadow: var(--admin-shadow);
  overflow: hidden;
  margin-top: 1rem;
}

.inventory-table,
.pricing-table {
  width: 100%;
  border-collapse: collapse;
}

.inventory-table th,
.pricing-table th {
  background: var(--admin-light);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--admin-dark);
  border-bottom: 1px solid var(--admin-border);
}

.inventory-table td,
.pricing-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.inventory-table tr:hover,
.pricing-table tr:hover {
  background: #f8f9fa;
}

.table-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-active {
  background: #d4edda;
  color: #155724;
}

.status-inactive {
  background: #f8d7da;
  color: #721c24;
}

.status-featured {
  background: #fff3cd;
  color: #856404;
}

/* Upload Styles */
.upload-container {
  background: white;
  border-radius: 8px;
  box-shadow: var(--admin-shadow);
  padding: 2rem;
}

.upload-area {
  border: 2px dashed var(--admin-border);
  border-radius: 8px;
  padding: 3rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--admin-accent);
  background: rgba(52, 152, 219, 0.05);
}

.upload-content {
  pointer-events: none;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.upload-preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--admin-shadow);
}

.upload-preview-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.upload-preview-item .remove-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--admin-danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1.2rem;
}

.upload-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Filters */
.inventory-filters,
.pricing-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.inventory-filters select,
.inventory-filters input,
.pricing-filters select {
  padding: 0.5rem;
  border: 1px solid var(--admin-border);
  border-radius: 4px;
  min-width: 150px;
}

/* Controls */
.inventory-controls,
.pricing-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

/* Settings */
.settings-container {
  background: white;
  border-radius: 8px;
  box-shadow: var(--admin-shadow);
  padding: 2rem;
}

.settings-group {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--admin-border);
}

.settings-group:last-child {
  border-bottom: none;
}

.settings-group h3 {
  color: var(--admin-dark);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.settings-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  color: var(--admin-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--admin-secondary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Responsive Design */
@media (max-width: 768px) {
  .admin-container {
    grid-template-areas: 
      "header"
      "main";
    grid-template-columns: 1fr;
    grid-template-rows: 70px 1fr;
  }
  
  .admin-nav {
    display: none;
  }
  
  .admin-main {
    padding: 1rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
  
  .inventory-filters,
  .pricing-filters {
    flex-direction: column;
  }
  
  .inventory-controls,
  .pricing-controls {
    flex-direction: column;
  }
  
  .form-checkboxes {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--admin-border);
  border-radius: 50%;
  border-top-color: var(--admin-accent);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Success/Error Messages */
.message {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.message-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.message-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.hidden { display: none; }
.visible { display: block; }
.hidden-file-input { display: none; }

/* Image Upload Container */
.image-upload-container {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.image-upload-container input[type="text"] {
  flex: 1;
  background: #f8f9fa;
  cursor: not-allowed;
}

.image-preview {
  margin-top: 1rem;
  max-width: 200px;
}

.image-preview img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: var(--admin-shadow);
}

/* Upload naming section */
.upload-naming-section {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.upload-naming-section h3 {
  margin: 0 0 15px 0;
  color: #495057;
  font-size: 1.1em;
}

.upload-naming-section .form-group {
  margin-bottom: 15px;
}

.upload-naming-section label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: #495057;
}

.upload-naming-section input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
}

.upload-naming-section small {
  display: block;
  color: #6c757d;
  font-size: 0.85em;
  margin-top: 5px;
}
