body {
  background-color: var(--accent1);
}

body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

.heading {
  font-size: 2rem;
  margin-top: 30px;
  text-align: center;
  margin-bottom: 20px;
}

.heading h1 {
  color: var(--accent3);
  font-weight: bold;
}

.categories-container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}

.category-card {
  position: relative;
  width: 150px;
  height: 150px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent1);
  border: var(--accent3) 2px solid;
  border-radius: 8px;
  cursor: pointer;
}

.category-name {
  color: #333;
  font-size: 1.2rem;
  text-align: center;
  padding: 15px;
  z-index: 2;
  background-color: rgba(255, 255, 255, 0.8);
  width: 100%;
}

.category-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

/* Custom Modal Styles - Perfect Centering */
.custom-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.custom-modal-content {
  position: absolute;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Perfect centering */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.custom-modal-header {
  padding: 15px 20px;
  background-color: var(--accent2);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-modal-title {
  margin: 0;
  font-size: 1.3rem;
  color: #f1f1f1;
  font-weight: 400;
}

.custom-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0 10px;
  line-height: 1;
}

.custom-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.custom-modal-footer {
  padding: 15px 20px;
  background-color: #f5f5f5;
  text-align: right;
  border-top: 1px solid #ddd;
}

.custom-modal-button {
  padding: 8px 16px;
  background-color: var(--accent2);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

/* Subcategories List Styles */
.subcategories-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.subcategory-item {
  padding: 12px;
  background-color: #f8f9fa;
  border-radius: 6px;
  transition: all 0.3s ease;
  text-align: center;
}

.subcategory-item:hover {
  background-color: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.subcategory-link {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 500;
  display: block;
}

.loading-text,
.no-subcategories,
.error-message {
  text-align: center;
  padding: 20px;
  color: #666;
}

.error-message {
  color: #e74c3c;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .categories-container {
    width: 95%;
    gap: 15px;
  }
  
  .category-card {
    width: calc(50% - 15px);
    height: 120px;
  }
  
  .category-name {
    font-size: 1rem;
  }
  
  .custom-modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .subcategories-list {
    grid-template-columns: 1fr;
  }
  
  /* Small screen adjustment */
  @media (max-height: 600px) {
    .custom-modal-content {
      top: 20px;
      transform: translate(-50%, 0);
      max-height: calc(100vh - 40px);
    }
  }
}

@media (max-width: 480px) {
  .category-card {
    width: 100%;
    height: 100px;
  }
  
  .heading {
    font-size: 1.5rem;
    margin-top: 20px;
  }
}