/* Base styles */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

/* Logo glow effect */
.logo-container img {
  object-fit: cover;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
  transition: filter 0.3s ease;
}

.logo-container:hover img {
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

/* Category cards */
.category-card {
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 0.5rem;
  background: white;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  text-align: center;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.category-card.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.category-card.active .category-icon {
  background: rgba(255, 255, 255, 0.2);
}

.category-card h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0.75rem 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.category-card p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
  line-height: 1.4;
  color: #666;
  margin-bottom: 0;
  flex-grow: 1;
}

/* Product card styles */
.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  border: none;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.product-card .card-img-top {
  width: 100%;
  height: 19px;
  object-fit: contain;
  padding: 0;
  background: #f8f9fa;
  border: none;
}

.product-card .card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card .card-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.product-card .card-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
  color: #666;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  flex-grow: 1;
}

.product-card .card-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 0.75rem;
}

.product-footer {
  margin-top: auto;
  padding: 0 1.25rem 1.25rem;
}

.product-footer .btn {
  width: 100%;
}

/* Button animations */
.btn {
  transition: all 0.3s ease;
  border-radius: 0.375rem;
  font-weight: 500;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Search input */
#searchInput:focus {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  border-color: #667eea;
}

/* Modal animations */
.modal-enter {
  animation: modalEnter 0.3s ease-out;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Status badges */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
  font-size: 0.75em;
}

.status-active {
  background-color: #10b981;
  color: white;
}

.status-inactive {
  background-color: #ef4444;
  color: white;
}

/* Loading spinner */
.loading-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Table styles */
.admin-table {
  border-collapse: collapse;
  width: 100%;
}

.admin-table th,
.admin-table td {
  border: 1px solid #e5e7eb;
  padding: 12px;
  text-align: left;
}

.admin-table th {
  background-color: #f9fafb;
  font-weight: 600;
}

.admin-table tr:nth-child(even) {
  background-color: #f9fafb;
}

.admin-table tr:hover {
  background-color: #f3f4f6;
}

.admin-table td {
  vertical-align: middle;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Utility classes */
.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-truncate-multiline {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .category-card {
    padding: 1rem;
  }

  .category-card h3 {
    font-size: 1rem;
  }

  .category-card p {
    -webkit-line-clamp: 2;
  }

  .product-card .card-img-top {
    height: 140px;
  }

  .product-card .card-title {
    font-size: 0.9375rem;
  }

  .product-card .card-description {
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 576px) {
  .category-card {
    padding: 0.75rem;
  }

  .product-card .card-img-top {
    height: 120px;
  }

  .product-card .card-body,
  .product-footer {
    padding: 0.75rem;
  }
}

.modal-content-container {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding-right: 8px;
}

.modal-text-block {
  word-break: break-word;
}

.modal-sticky-footer {
  position: sticky;
  bottom: 0;
  background: white;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.body-no-scroll {
  overflow: hidden;
}

/* Product image styles */
.product-card img {
  transition: transform 0.3s ease;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card:hover img {
  transform: scale(1.05);
}

/* Image preview in form */
#imagePreview {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border: none;
}

/* File input styling */
input[type="file"]::file-selector-button {
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  padding: 0.375rem 0.75rem;
  margin-right: 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

input[type="file"]::file-selector-button:hover {
  background-color: #e5e7eb;
}

/* Categories grid - fixed 4 columns with perfect centering */
#categoriesGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

.category-card {
  width: 100%;
  margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  #categoriesGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  #categoriesGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  #categoriesGrid {
    grid-template-columns: minmax(0, 1fr);
  }
}