/* Admin Panel Styles */
:root {
  --primary-color: #1a237e;
  --secondary-color: #ffffff;
  --accent-color: #ffd700;
  --text-color: #333333;
  --light-gray: #f5f5f5;
  --medium-gray: #e0e0e0;
  --dark-gray: #757575;
  --success-color: #4caf50;
  --danger-color: #f44336;
  --warning-color: #ff9800;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f0f2f5;
  color: var(--text-color);
  line-height: 1.6;
}

.admin-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-header {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.admin-header h1 span {
  font-weight: 400;
  opacity: 0.8;
}

#logoutBtn {
  background-color: var(--accent-color);
  color: var(--primary-color);
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

#logoutBtn:hover {
  background-color: #ffc400;
}

.admin-main {
  display: flex;
  flex: 1;
}

.admin-sidebar {
  width: 250px;
  background-color: var(--secondary-color);
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  padding: 20px 0;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 5;
}

.admin-sidebar nav ul {
  list-style: none;
  padding: 0;
}

.admin-sidebar nav li a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--text-color);
  transition: background-color 0.3s ease;
}

.admin-sidebar nav li a i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

.admin-sidebar nav li a:hover {
  background-color: var(--light-gray);
  color: var(--primary-color);
}

.admin-sidebar nav li.active a {
  background-color: rgba(26, 35, 126, 0.1);
  color: var(--primary-color);
  border-left: 3px solid var(--primary-color);
}

.admin-content {
  flex: 1;
  padding: 30px;
  background-color: var(--light-gray);
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

/* Header Styles */
.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.menu-toggle {
  display: none; /* Hidden by default on larger screens */
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  justify-content: space-between;
  width: 44px;
  height: 44px;
  position: relative;
  z-index: 9999;
  margin-right: 10px;
  align-items: center;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--secondary-color);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

/* Show menu toggle on small screens */
@media (max-width: 992px) {
  .menu-toggle {
    display: flex;
    position: relative;
    top: auto;
    left: auto;
    z-index: 10000;
    background: transparent;
    border-radius: 4px;
    padding: 10px;
  }

  .menu-toggle span {
    background-color: white;
  }

  /* Add padding to header to prevent content from being hidden behind fixed menu */
  .admin-header {
    padding-left: 64px;
  }

  /* Ensure content doesn't go under the fixed menu */
  .admin-main {
    padding-top: 70px;
  }
}

/* Animation for menu icon when active */
.menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Responsive Styles */
@media (max-width: 992px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 10;
    width: 280px; /* Slightly wider for better touch targets */
  }

  .admin-sidebar.active {
    transform: translateX(0);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
  }

  .menu-toggle {
    display: flex;
  }

  .admin-content {
    margin-left: 0;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
  }

  .admin-header {
    padding: 10px 15px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9;
  }

  .stats-container {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .admin-main {
    padding-top: 60px;
    min-height: 100vh;
    box-sizing: border-box;
  }

  /* Ensure tables are responsive */
  .recent-activity {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Make form elements stack properly */
  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .form-group {
    width: 100%;
    margin-bottom: 10px;
  }
}

@media (max-width: 576px) {
  .admin-header h1 {
    font-size: 1.1rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .section-header .btn-primary {
    width: 100%;
    text-align: center;
    margin-left: 0;
  }

  /* Adjust popup styles for small screens */
  .popup {
    width: 95%;
    max-width: 95%;
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Make buttons more touch-friendly */
  .btn, button, input[type="submit"], input[type="button"] {
    padding: 10px 15px;
    min-height: 40px;
  }

  /* Ensure inputs are properly sized */
  input, select, textarea {
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 768px) {
  .admin-header h1 {
    display: none;
  }

  .admin-header {
    justify-content: flex-end;
    padding: 15px 20px;
  }

  .menu-toggle {
    margin-right: auto;
  }
}

/* Prevent horizontal scrolling */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Overlay for sidebar menu */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.overlay.active {
  display: block;
  opacity: 1;
}

/* Ensure sidebar is above overlay */
.admin-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: -280px;
  width: 280px;
  z-index: 10;
  transition: transform 0.3s ease;
}

.admin-sidebar.active {
  transform: translateX(280px);
}

/* Adjust content when sidebar is open */
.admin-content {
  transition: margin-left 0.3s ease;
  margin-left: 0;
}

@media (min-width: 993px) {
  .admin-sidebar {
    position: relative;
    left: 0;
    transform: none;
  }
  
  .admin-sidebar.active {
    transform: none;
  }
  
  .admin-content {
    margin-left: 0px;
  }
}

/* Dashboard Styles */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: var(--secondary-color);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.stat-card h3 {
  font-size: 1.1rem;
  color: var(--dark-gray);
  margin-bottom: 10px;
}

.stat-card p {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.recent-activity {
  background-color: var(--secondary-color);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.recent-activity h3 {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--medium-gray);
}

#activityList li {
  padding: 10px 0;
  border-bottom: 1px solid var(--medium-gray);
  display: flex;
  align-items: center;
}

#activityList li:last-child {
  border-bottom: none;
}

#activityList li i {
  margin-right: 10px;
  color: var(--primary-color);
}

/* Product Management Styles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  margin: 0;
}

.section-header .btn-primary {
  margin-left: 10px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.btn-primary:hover {
  background-color: #0d1552;
}

.product-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.product-filters select,
.product-filters input {
  padding: 8px 12px;
  border: 1px solid var(--medium-gray);
  border-radius: 4px;
  min-width: 200px;
}

.table-container {
  overflow-x: auto;
  background-color: var(--secondary-color);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--medium-gray);
}

th {
  background-color: var(--light-gray);
  font-weight: 600;
  color: var(--primary-color);
}

tr:hover {
  background-color: rgba(26, 35, 126, 0.05);
}

.product-image-cell img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 4px;
}

.status-active {
  color: var(--success-color);
  font-weight: 500;
}

.status-inactive {
  color: var(--danger-color);
  font-weight: 500;
}

.action-buttons {
  display: flex;
  gap: 5px;
}

.btn-edit,
.btn-delete {
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-edit {
  background-color: var(--warning-color);
  color: var(--secondary-color);
}

.btn-delete {
  background-color: var(--danger-color);
  color: var(--secondary-color);
}

.btn-edit:hover {
  background-color: #e68a00;
}

.btn-delete:hover {
  background-color: #d32f2f;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 15px;
  background-color: var(--secondary-color);
  border: 1px solid var(--medium-gray);
  border-radius: 4px;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Import/Export Buttons Styles */
.import-export-btns {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.import-export-btns button {
  padding: 8px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.import-btn {
  background-color: #6c757d;
  color: white;
}

.import-btn:hover {
  background-color: #5a6268;
}

.export-btn {
  background-color: #6c757d;
  color: white;
}

.export-btn:hover {
  background-color: #5a6268;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.modal.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid #eaeaea;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
}

.close-btn {
  font-size: 1.8rem;
  cursor: pointer;
  color: #777;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #333;
}

.modal-body {
  padding: 25px;
}

/* Form Styles */
.popup-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.popup-form .form-group {
  margin-bottom: 0;
  width: 100%;
}

.popup-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #ffffff; /* White color for labels */
  font-size: 0.9375rem;
}

.popup-form .required {
  color: #ef4444;
  margin-left: 2px;
}

.popup-form input[type="text"],
.popup-form input[type="number"],
.popup-form input[type="url"],
.popup-form select,
.popup-form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: #374151;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.popup-form input[type="text"]:focus,
.popup-form input[type="number"]:focus,
.popup-form input[type="url"]:focus,
.popup-form select:focus,
.popup-form textarea:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.popup-form textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
  font-family: inherit;
}

.popup-form .form-row {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.popup-form .form-row .form-group {
  flex: 1;
  min-width: 0; /* Prevents flex items from overflowing */
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.toggle-switch input[type="checkbox"] {
  height: 0;
  width: 0;
  visibility: hidden;
  position: absolute;
  opacity: 0;
}

.toggle-switch label {
  cursor: pointer;
  width: 50px;
  height: 24px;
  background: #ccc;
  display: block;
  border-radius: 50px;
  position: relative;
  transition: background-color 0.3s;
}

.toggle-switch label:after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + label {
  background: #4CAF50;
}

.toggle-switch input:checked + label:after {
  left: calc(100% - 2px);
  transform: translateX(-100%);
}

.toggle-switch input:disabled + label {
  opacity: 0.5;
  cursor: not-allowed;
}

#statusText {
  font-size: 0.9em;
  font-weight: 500;
  color: #555;
  transition: color 0.3s;
}

.toggle-switch input:checked ~ #statusText {
  color: #4CAF50;
  font-weight: 600;
}

.image-preview {
  margin-top: 10px;
  text-align: center;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  background-color: #f9f9f9;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.image-input-container {
  margin-bottom: 8px;
}

.helper-text {
  display: block;
  margin-top: 4px;
  font-size: 0.8em;
  color: #666;
}

.error-message {
  color: #d32f2f;
  font-size: 0.85em;
  margin-top: 5px;
  display: none;
}

.error-message.show {
  display: block;
}

.form-group {
  margin-bottom: 1.5rem;
}

/* Make the image input full width */
#productImage {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Status badge styling */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge.active {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.status-badge.inactive {
  background-color: #ffebee;
  color: #c62828;
}

/* Login Form Styles */
.login-form {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  background-image: url('../images/baground3.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.login-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.login-form .form {
  position: relative;
  z-index: 2;
  background: rgba(0, 0, 0, 0.5);
  padding: 2.5rem;
  border-radius: 10px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  margin: 20px;
  box-sizing: border-box;
}

.login-form h2 {
  color: #ffffff;
  text-align: center;
  margin-bottom: 2rem;
}

.login-form .input-span {
  display: block;
  width: 100%;
  margin-bottom: 1.5rem;
}

.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.login-form .form-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  width: 100%;
}

.login-form .submit,
.back-home-btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  box-sizing: border-box;
}

.login-form .submit {
  background-color: #1a237e;
  color: white;
  border: none;
}

.login-form .submit:hover {
  background-color: #0d1552;
}

.back-home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--accent-color);
  color: var(--text-color);
  border: 1px solid var(--accent-color);
  text-decoration: none;
}

.back-home-btn:hover {
  background-color: #e6c200; /* Slightly darker shade of the accent color */
  border-color: #e6c200;
}

.back-home-btn i {
  font-size: 12px;
}

#errorMsg {
  margin-top: 1rem;
  text-align: center;
  color: #f44336;
  font-weight: 500;
}

.error-message {
  color: #f44336;
  font-size: 0.875rem;
  margin: 0.5rem 0 1rem 0;
  min-height: 1.25rem;
  text-align: left;
}

.error-message:empty {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .login-form {
    padding: 20px 10px;
    align-items: center;
    display: flex;
    min-height: 100vh;
  }
  
  .login-form .form {
    width: 100%;
    max-width: 400px;
    margin: 40px 0;
    padding: 2rem 1.5rem;
    border-radius: 10px;
    min-height: auto;
    display: block;
  }
  
  .login-form h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
  }
}

/* Center the form on large screens */
@media (min-width: 769px) {
  .login-form .form {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
  }
}

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5); /* Dark overlay */
  z-index: 1000; /* Ensures it appears above other content */
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 300ms ease-in-out;
}

/* Modal Window */
.modal {
  background-color: #ffffff;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 100%;
  z-index: 1001;
  transform: translateY(-50px);
  opacity: 0;
  transition: transform 300ms ease-in-out, opacity 300ms ease-in-out;
}

.modal h2 {
  text-align: center;
  color: var(--clr);
}

.modal .input-span {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.modal input,
.modal textarea {
  width: 100%;
  padding: 1rem 0.75rem;
  border: 1px solid var(--bg-dark);
  border-radius: 6px;
  font-size: 1rem;
}

.modal .submit {
  width: 48%;
  background-color: var(--deep-blue);
  color: var(--bg-light);
  border: none;
  padding: 1rem 0.75rem;
  border-radius: 3rem;
  cursor: pointer;
  transition: background-color 300ms;
}

.modal .submit:hover {
  background-color: #0d1552;
}

.modal .cancel-btn {
  width: 48%;
  background-color: #f44336;
  color: #fff;
  border: none;
  padding: 1rem 0.75rem;
  border-radius: 3rem;
  cursor: pointer;
  transition: background-color 300ms;
}

.modal .cancel-btn:hover {
  background-color: #d32f2f;
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
}

.modal textarea {
  resize: vertical;
}

/* Show Modal */
.modal-overlay.show {
  display: flex;
  opacity: 1;
}

.modal.show {
  transform: translateY(0);
  opacity: 1;
}

/* Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.popup-overlay.active .popup {
    transform: translateY(0);
}

.popup-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.close-popup {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0 8px;
    line-height: 1;
}

.popup-body {
    padding: 20px;
}

.popup-form .form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.popup-form .form-group {
    flex: 1;
    margin-bottom: 15px;
}

.popup-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    color: #555;
}

.popup-form input[type="text"],
.popup-form input[type="number"],
.popup-form input[type="url"],
.popup-form select,
.popup-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.popup-form input:focus,
.popup-form select:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-switch label {
    display: inline-block;
    width: 40px;
    height: 20px;
    background: #ddd;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.toggle-switch label:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + label {
    background: #4a90e2;
}

.toggle-switch input:checked + label:after {
    transform: translateX(20px);
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin: 0 10px;
    vertical-align: middle;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:focus + .slider {
    box-shadow: 0 0 1px #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.status-text {
    display: inline-block;
    vertical-align: middle;
    color: #555;
    font-weight: 500;
}

/* Product Table Styles */
.products-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    table-layout: fixed;
}

.products-table thead {
    position: relative;
    background-color: #f8f9fa;
}

.products-table th,
.products-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    word-wrap: break-word;
}

.products-table th {
    position: relative;
    z-index: 1; /* Ensure text is above the background */
    background-color: #f8f9fa; /* Match the background color */
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #333; /* Ensure text color is visible */
}

.products-table th:first-child {
    border-top-left-radius: 8px;
}

.products-table th:last-child {
    border-top-right-radius: 8px;
}

/* Set specific column widths */
.products-table th:nth-child(1),
.products-table td:nth-child(1) {
    width: 60px; /* Index column */
    text-align: center;
}

.products-table th:nth-child(2),
.products-table td:nth-child(2) {
    width: 200px; /* Product name column */
}

.products-table th:nth-child(3),
.products-table td:nth-child(3) {
    width: 120px; /* Category column */
}

.products-table th:nth-child(4),
.products-table td:nth-child(4) {
    width: 100px; /* Price column */
    text-align: right;
}

.products-table th:nth-child(5),
.products-table td:nth-child(5) {
    width: 100px; /* Quantity column */
    text-align: center;
}

.products-table th:nth-child(6),
.products-table td:nth-child(6) {
    width: 100px; /* Status column */
    text-align: center;
}

.products-table th:nth-child(7),
.products-table td:nth-child(7) {
    width: 120px; /* Actions column */
    text-align: center;
}

.products-table tr:last-child td {
    border-bottom: none;
}

.products-table tr:hover {
    background-color: #f8f9fa;
}

/* Product Info */
.product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0; /* Prevents flex items from overflowing */
}

.product-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Action Buttons */
.actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Responsive Table */
@media (max-width: 992px) {
    .products-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .products-table th,
    .products-table td {
        min-width: 120px;
    }

    .product-info {
        min-width: 150px;
    }
}

/* For very small screens */
@media (max-width: 576px) {
    .products-table th,
    .products-table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }

    .btn-icon {
        width: 28px;
        height: 28px;
    }

    .status-badge {
        padding: 3px 8px;
        font-size: 0.75rem;
    }
}

/* Quantity Input Specific Styles */
.helper-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
    font-style: italic;
}

/* Adjust the input field to better fit the format */
#productQuantity {
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* Validation styles */
#productQuantity:invalid {
    border-color: #f87171;
    background-color: #fef2f2;
}

#productQuantity:valid {
    border-color: #34d399;
    background-color: #f0fdf4;
}

/* Make the helper text more subtle when input is focused */
#productQuantity:focus ~ .helper-text {
    color: #3b82f6;
}

/* Settings Page Styles */
.settings-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.settings-header h2 {
    font-size: 1.75rem;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-header h2 i {
    color: #4f46e5;
}

.section-description {
    color: #6b7280;
    margin: 0;
    font-size: 1rem;
}

.settings-container {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}

.settings-form {
    flex: 1;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1.125rem;
    color: #1f2937;
    margin: 0 0 1.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title i {
    color: #4f46e5;
    font-size: 1.1em;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 0.75rem;
    color: #9ca3af;
    font-size: 1rem;
}

.input-with-icon input,
.input-with-icon textarea,
.input-with-icon select {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    color: #1f2937;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-with-icon textarea {
    min-height: 100px;
    resize: vertical;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
}

.input-with-icon input:focus,
.input-with-icon textarea:focus,
.input-with-icon select:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-with-icon input::placeholder,
.input-with-icon textarea::placeholder {
    color: #9ca3af;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f3f4f6;
}

/* Settings Sidebar */
.settings-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.settings-card {
    background: #f9fafb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
}

.settings-card .card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.settings-card .card-icon i {
    font-size: 1.5rem;
    color: #4f46e5;
}

.settings-card h4 {
    font-size: 1.125rem;
    color: #1f2937;
    margin: 0 0 0.75rem 0;
}

.settings-card p {
    color: #6b7280;
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: 0 0 1.25rem 0;
}

.settings-tips {
    list-style: none;
    padding: 0;
    margin: 0;
}

.settings-tips li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
}

.settings-tips li i {
    color: #10b981;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

/* Required field indicator */
.required {
    color: #ef4444;
    margin-left: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .settings-container {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
        margin-top: 2rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Add Product and Save Changes buttons */
.btn.btn-primary[onclick*="openAddProductPopup"] {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn.btn-primary[onclick*="openAddProductPopup"]:hover {
    background-color: #0d1552; /* Darker shade of primary color */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn.btn-primary[onclick*="openAddProductPopup"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn.btn-primary[type="submit"] {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn.btn-primary[type="submit"]:hover {
    background-color: #0d1552; /* Darker shade of primary color */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn.btn-primary[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Button icons */
.btn.btn-primary i {
    font-size: 0.9em;
}

/* Add Product and Save Changes buttons */
.btn.btn-primary[onclick*="openAddProductPopup"] {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn.btn-primary[onclick*="openAddProductPopup"]:hover {
    background-color: #0d1552; /* Darker shade of primary color */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn.btn-primary[onclick*="openAddProductPopup"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn.btn-primary[type="submit"] {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn.btn-primary[type="submit"]:hover {
    background-color: #0d1552; /* Darker shade of primary color */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn.btn-primary[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Button icons */
.btn.btn-primary i {
    font-size: 0.9em;
}

/* Base button styles with transitions */
button,
.btn,
input[type="button"],
input[type="submit"],
input[type="button"] {
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Hover and active states for all buttons */
button:not(:disabled):hover,
.btn:not(:disabled):hover,
input[type="button"]:not(:disabled):hover,
input[type="submit"]:not(:disabled):hover,
input[type="reset"]:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:not(:disabled):active,
.btn:not(:disabled):active,
input[type="button"]:not(:disabled):active,
input[type="submit"]:not(:disabled):active,
input[type="reset"]:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Disabled state */
button:disabled,
.btn:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Specific button styles */
.action-buttons button,
.import-export-btns button,
.pagination button,
.modal-buttons button {
    transition: all 0.3s ease;
}

/* Product action buttons */
.btn-icon {
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin: 0 2px;
}

.btn-edit {
    background-color: #2196F3;
    color: white;
}

.btn-delete {
    background-color: #f44336;
    color: white;
}

.btn-icon:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-icon i {
    font-size: 1rem;
}

/* Make buttons larger on small screens */
@media (max-width: 768px) {
    .btn-icon {
        padding: 10px 16px;
        min-width: 44px; /* Minimum touch target size for better mobile UX */
    }
    
    .actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
}

/* Login Form Label Styles */
.login-form .input-span .label {
    color: #ffffff !important;
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Settings Section */
.settings-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 30px;
}

.settings-container h2 {
    color: var(--primary-color);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-form {
    max-width: 800px;
    margin: 0 auto;
}

.settings-form .form-group {
    margin-bottom: 20px;
}

.settings-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #444;
}

.settings-form .form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.settings-form .form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.1);
}

.settings-form textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-size: 14px;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #3949ab;
    border-color: #3949ab;
}

.btn-outline {
    background: transparent;
    border-color: #ddd;
    color: #555;
}

.btn-outline:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .settings-container {
        padding: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Items List Section */
.items-table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 20px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.items-table th,
.items-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.items-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.items-table tbody tr:hover {
    background-color: #f8f9fa;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background-color: #e6f7ee;
    color: #10b981;
}

.status-inactive {
    background-color: #fee2e2;
    color: #ef4444;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: #f1f3f5;
    color: #495057;
}

.action-btn.edit {
    color: #4d7cff;
}

.action-btn.delete {
    color: #ff4d4f;
}

.action-btn:hover.edit {
    background-color: #e6f0ff;
}

.action-btn:hover.delete {
    background-color: #fff1f0;
}

/* Checkbox Styles */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 30px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: all 0.2s;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: #adb5bd;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #4d7cff;
    border-color: #4d7cff;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Responsive Table */
@media (max-width: 768px) {
    .items-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .items-table th,
    .items-table td {
        padding: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-btn {
        width: 28px;
        height: 28px;
    }
}

/* Button Loader */
.btn-loader {
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
}

.btn-loader .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Trending Badge */
.trending-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ff4757;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}

/* Product Card Updates */
.product-card {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

/* Toggle Switch Styling */
.toggle-switch {
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-switch label {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-switch label:after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: all 0.3s;
}

.toggle-switch input:checked + label {
    background-color: #4CAF50;
}

.toggle-switch input:checked + label:after {
    left: 28px;
}

.toggle-switch .toggle-text {
    margin-left: 10px;
    font-size: 14px;
    color: #333;
}

/* Status Checkbox Styles */
.status-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.status-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.status-checkbox label {
    margin: 0;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    user-select: none;
}

/* Remove any existing toggle switch styles if they exist */
.toggle-switch {
    display: none;
}
