.subcategories-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;

  // Loading state
  .loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;

    .spinner {
      width: 48px;
      height: 48px;
      border: 4px solid #d3dad9;
      border-top-color: #497671;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    p {
      color: #697777;
      font-size: var(--font-size-lg, 1rem);
      font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      margin: 0;
    }
  }

  // Error state
  .error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    padding: 24px;

    p {
      color: #dc2626;
      font-size: var(--font-size-lg, 1rem);
      font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      text-align: center;
      margin: 0;
    }

    button {
      padding: 10px 24px;
      background: #497671;
      color: white;
      border: none;
      border-radius: var(--radius-sm, 8px);
      font-size: var(--font-size-md, 0.9375rem);
      font-weight: var(--font-weight-medium, 500);
      font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      cursor: pointer;
      transition: all 0.2s ease;

      &:hover {
        background: #3a5f5b;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(73, 118, 113, 0.3);
      }

      &:active {
        transform: translateY(0);
      }
    }
  }

  // Empty subcategories state
  .no-subcats {
    text-align: center;
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    .no-subcats-icon {
      width: 100px;
      height: 100px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #f5f3f9;
      border-radius: 50%;
      margin-bottom: 24px;
    }

    h3 {
      font-size: var(--font-size-2xl, 1.25rem);
      font-weight: var(--font-weight-bold, 700);
      color: #1e3c38;
      margin: 0 0 8px 0;
    }

    p {
      font-size: var(--font-size-md, 0.9375rem);
      color: #697777;
      margin: 0 0 24px 0;
      max-width: 340px;
      line-height: 1.5;
    }

    .no-subcats-btn {
      display: inline-flex;
      align-items: center;
      padding: 10px 28px;
      background: #497671;
      color: white;
      border-radius: var(--radius-lg, 13px);
      font-family: "DM Sans", sans-serif;
      font-size: var(--font-size-md, 0.9375rem);
      font-weight: var(--font-weight-semibold, 600);
      text-decoration: none;
      transition: background 0.2s ease, transform 0.15s ease;

      &:hover {
        background: #3d635f;
        transform: translateY(-1px);
      }
    }
  }

  .sub-header {
    margin-bottom: 28px;

    h2 {
      font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      font-size: var(--font-size-4xl, 2rem);
      color: #1e3c38;
      margin: 0;
      font-weight: var(--font-weight-bold, 700);
      letter-spacing: -0.02em;
    }
  }

  .categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    width: 100%;
  }

  .category-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    &:hover {
      transform: translateY(-4px);

      .category-image {
        box-shadow: 0 6px 8px 0 rgba(0, 0, 0, 0.2);
      }

      .category-info {
        box-shadow: 0 6px 8px 0 rgba(0, 0, 0, 0.2);
      }
    }
  }

  .category-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid #d3dad9;
    border-radius: 13px 13px 0 0;
    box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.3s ease;
    }

    &:hover img {
      transform: scale(1.05);
    }
  }

  .category-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    font-weight: var(--font-weight-bold, 700);
    color: #497671;
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  }

  .category-info {
    width: 100%;
    border: 1px solid #d3dad9;
    border-top: none;
    border-radius: 0 0 13px 13px;
    padding: 12px 16px;
    box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
    background: #f5f3f9;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    transition: background 0.3s ease;
  }

  .category-name {
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: var(--font-weight-semibold, 600);
    font-size: clamp(14px, 1.4vw, 18px);
    color: #1e3c38;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: calc(2 * 1.3em);
  }

  .category-count {
    font-family: "DM Sans", sans-serif;
    font-size: var(--font-size-sm, 0.8125rem);
    color: #697777;
  }

  .category-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 20px;
    font-family: "DM Sans", sans-serif;
    font-size: var(--font-size-sm, 0.8125rem);
    color: #697777;

    span {
      padding: 2px 7px;
      border-radius: var(--radius-full, 999px);
      background: rgba(73, 118, 113, 0.1);
      color: #3d635f;
      white-space: nowrap;
    }
  }

  .category-mixed {
    width: fit-content;
    padding: 2px 7px;
    border-radius: var(--radius-full, 999px);
    background: #eef1f1;
    color: #697777;
    font-family: "DM Sans", sans-serif;
    font-size: var(--font-size-xs, 0.75rem);
  }

  // Items section within subcategories page
  .category-items-section {
    margin-top: 40px;

    .items-section-title {
      font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      font-size: var(--font-size-3xl, 1.5rem);
      font-weight: var(--font-weight-bold, 700);
      color: #1e3c38;
      margin: 0 0 20px 0;
    }
  }

  .items-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }

  .item-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border: 1px solid #d3dad9;
    border-radius: var(--radius-lg, 13px);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;

    &:hover {
      transform: translateY(-4px);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }
  }

  .item-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f5f5f5;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.3s ease;
    }

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

    .item-discount {
      position: absolute;
      top: 8px;
      right: 8px;
      background: #dc2626;
      color: white;
      font-size: var(--font-size-xs, 0.75rem);
      font-weight: var(--font-weight-bold, 700);
      padding: 2px 8px;
      border-radius: 6px;
    }

    .item-badges {
      position: absolute;
      top: 8px;
      left: 8px;
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
    }

    .item-badge {
      font-size: 0.65rem;
      font-weight: var(--font-weight-semibold, 600);
      padding: 2px 6px;
      border-radius: var(--radius-xs, 4px);
      text-transform: uppercase;
    }
  }

  .item-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .item-name {
    font-family: "DM Sans", sans-serif;
    font-size: var(--font-size-base, 0.875rem);
    font-weight: var(--font-weight-semibold, 600);
    color: #1e3c38;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .item-price {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;

    .old-price {
      font-size: var(--font-size-sm, 0.8125rem);
      color: #a1b4b5;
      text-decoration: line-through;
    }

    .current-price {
      font-size: var(--font-size-lg, 1rem);
      font-weight: var(--font-weight-bold, 700);
      color: #1e3c38;
    }
  }

  .item-cart-btn {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm, 8px);
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.2s ease;

    &:hover {
      background: var(--primary-hover);
    }
  }

  // Keyframes
  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  // Responsive
  @media (max-width: 1200px) {
    padding: 24px;

    .categories-grid {
      grid-template-columns: repeat(3, 1fr);
      gap: 24px;
    }

    .items-grid {
      grid-template-columns: repeat(3, 1fr);
      gap: 20px;
    }
  }

  @media (max-width: 992px) {
    .categories-grid {
      grid-template-columns: repeat(3, 1fr);
      gap: 20px;
    }
  }

  @media (max-width: 768px) {
    padding: 16px;

    .sub-header {
      margin-bottom: 20px;

      h2 {
        font-size: var(--font-size-3xl, 1.5rem);
      }
    }

    .categories-grid {
      grid-template-columns: repeat(2, 1fr);
      gap: 16px;
    }

    .items-grid {
      grid-template-columns: repeat(2, 1fr);
      gap: 16px;
    }

    .category-info {
      padding: 10px 12px;
    }
  }

  @media (max-width: 480px) {
    padding: 12px;

    .sub-header {
      margin-bottom: 16px;

      h2 {
        font-size: var(--font-size-3xl, 1.5rem);
      }
    }

    .categories-grid {
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }

    .items-grid {
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }

    .category-info {
      padding: 8px 10px;
    }

    .category-card:hover {
      transform: translateY(-2px);
    }
  }
}
