:root {
  --primary: #4caf50;
  --secondary: #8bc34a;
  --dark: #388e3c;
  --light: #f1f8e9;
  --text: #333;
  --white: #fff;
  --error: #e74c3c;
}

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

body {
  font-family: "Open Sans", sans-serif;
  color: var(--text);
  background-color: #f9f9f9;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
}

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

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--dark);
  color: var(--white);
  padding: 20px 0;
  transition: all 0.3s;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header img {
  height: 40px;
}

.sidebar-header h3 {
  color: var(--white);
  font-size: 1.3rem;
}

.sidebar-menu {
  padding: 20px 0;
}

.sidebar-menu ul {
  list-style: none;
}

.sidebar-menu li {
  margin-bottom: 5px;
}

.sidebar-menu a {
  display: block;
  padding: 12px 20px;
  color: var(--white);
  text-decoration: none;
  transition: all 0.3s;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background-color: rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--secondary);
}

.sidebar-menu i {
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 20px 30px;
}
/* Add to the existing admin.css file */

/* Validation Styles */
.validation-error {
  display: none;
  padding: 8px 12px;
  margin-top: 5px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.validation-error.error {
  background-color: #ffebee;
  color: #c62828;
  border-left: 3px solid #c62828;
}

.validation-error.success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border-left: 3px solid #2e7d32;
}

.validation-error.warning {
  background-color: #fff3e0;
  color: #ef6c00;
  border-left: 3px solid #ef6c00;
}

.validation-error i {
  margin-right: 5px;
}

/* Form field styling for validation states */
.form-control.error {
  border-color: #c62828;
  box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.1);
}

.form-control.success {
  border-color: #2e7d32;
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.1);
}

.file-upload.error {
  border-color: #c62828;
  background-color: rgba(198, 40, 40, 0.05);
}

.file-upload.success {
  border-color: #2e7d32;
  background-color: rgba(46, 125, 50, 0.05);
}

/* Character counter for description */
.char-counter {
  text-align: right;
  font-size: 0.75rem;
  color: #666;
  margin-top: 5px;
}

.char-counter.warning {
  color: #ef6c00;
}

.char-counter.error {
  color: #c62828;
}

/* Required field indicators */
.form-group label::after {
  content: " *";
  color: #c62828;
}

.form-group label.optional::after {
  content: " (optional)";
  color: #666;
  font-weight: normal;
}
/* Header */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.admin-header h1 {
  color: var(--dark);
  font-size: 1.8rem;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 15px;
}

.admin-user img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.admin-user-info h4 {
  font-size: 0.95rem;
  margin-bottom: 3px;
}

.admin-user-info p {
  font-size: 0.8rem;
  color: #777;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

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

/* Dashboard Cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--white);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 15px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background-color: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.3rem;
}

.stat-info h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 5px;
}

.stat-info p {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
}

/* Product Management */
.product-management {
  background: var(--white);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
}

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

.section-header h2 {
  font-size: 1.4rem;
  color: var(--dark);
}

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

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--light);
}

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

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

/* Product Table */
.table-responsive {
  overflow-x: auto;
}

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

table th,
table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

table th {
  background-color: var(--light);
  font-weight: 600;
  color: var(--dark);
  text-transform: uppercase;
  font-size: 0.8rem;
}

table tr:hover {
  background-color: #f9f9f9;
}

.product-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.no-image {
  width: 60px;
  height: 60px;
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #777;
  font-size: 0.7rem;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.active {
  background-color: #e8f5e9;
  color: var(--dark);
}

.status-badge.inactive {
  background-color: #ffebee;
  color: var(--error);
}

.action-btns {
  display: flex;
  gap: 8px;
}

/* Add/Edit Product Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

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

.modal {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px);
  transition: all 0.3s;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.3rem;
  color: var(--dark);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #777;
}

.modal-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: border 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-row .form-group {
  flex: 1;
}

.file-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  border: 2px dashed #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  min-height: 150px;
  justify-content: center;
}

.file-upload:hover {
  border-color: var(--primary);
  background-color: rgba(76, 175, 80, 0.05);
}

.file-upload.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-upload.error {
  border-color: var(--error);
  background-color: rgba(231, 76, 60, 0.05);
}

.file-upload i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.file-upload p {
  font-size: 0.9rem;
  color: #777;
  text-align: center;
}

.preview-image {
  max-width: 100%;
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-top: 10px;
  display: none;
  border-radius: 4px;
  border: 1px solid #eee;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Loading Spinner */
.spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 992px) {
  .sidebar {
    width: 230px;
  }
}

@media (max-width: 768px) {
  .admin-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    padding: 10px 0;
  }

  .sidebar-menu ul {
    display: flex;
    overflow-x: auto;
    padding: 0 10px;
  }

  .sidebar-menu li {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .sidebar-menu a {
    padding: 10px 15px;
    border-left: none;
    border-bottom: 3px solid transparent;
  }

  .sidebar-menu a.active,
  .sidebar-menu a:hover {
    border-left: none;
    border-bottom: 3px solid var(--secondary);
  }

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

@media (max-width: 576px) {
  .main-content {
    padding: 15px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}
