/* ============================================= */
/* ===         CE VENDORS PAGE STYLES          === */
/* ============================================= */

/* --- 1. Global Variables & Page Layout --- */
:root {
  --ce-color-text-primary: #2d1684;
  --ce-color-text-secondary: #475569;
  --ce-color-text-muted: #64748B;
  --ce-color-text-link: #2563EB;
  --ce-color-bg-page: #FDFBFF;
  --ce-color-bg-card: #FFFFFF;
  --ce-color-border: #E2E8F0;
  --ce-color-badge-bg: #F0F9FF;
  --ce-shadow: 0 4px 12px -2px rgba(15, 23, 42, .05);
}

.ce-vendors {
  max-width: 1280px;
  margin-inline: auto;
  padding: 24px 16px 48px;
}

/* --- 2. Header Section --- */
.ce-vendors__header {
  display: flex;
  flex-direction: column; /* Stacked on mobile by default */
  gap: 24px;
  margin-bottom: 24px; /* Reduced margin as A-Z nav is separate */
}

.ce-vendors__intro {
  flex-grow: 1;
}

.ce-vendors__description {
  margin: 8px 0 0;
  font-size: 1.05rem;
  color: var(--ce-color-text-secondary);
  max-width: 65ch; /* Improves readability */
}

.ce-vendors__tools {
  /* This container now just holds the search bar */
}

/* New wrapper for search input and icon */
.ce-search-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  height: 48px;
  padding: 5px 10px 5px 10px; /* Add padding only on the left for the icon */
  background-color: #fff;
  border: 1px solid var(--ce-color-border);
  border-radius: 10px;
  box-shadow: var(--ce-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Modern focus state: When the input inside is focused, style the wrapper */
.ce-search-wrapper:focus-within {
  border-color: var(--ce-color-text-link);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* The icon is now a simple flex item, NOT absolutely positioned */
.ce-search__icon {
  width: 20px;
  height: 20px;
  color: #94a3b8;
  flex-shrink: 0; /* Prevents the icon from shrinking */
  margin-right: 8px; /* Creates space between the icon and the text */
}

/* The input field is now transparent and fills the remaining space */
.ce-vendors__search {
  width: 100%;
  height: 100%; /* Fill the wrapper's height */
  flex-grow: 1; /* Allows the input to take all available space */
  font-size: 1rem;
  color: var(--ce-color-text-primary);
  /* CRITICAL: Remove all borders and backgrounds so it's transparent inside the wrapper */
  border: none !important;
  background-color: transparent;
  box-shadow: none;
  padding: 0 14px 0 0; /* Add padding to the right for nice spacing */
  outline: none; /* The focus outline is now on the wrapper */
}

.ce-cat-search {border: none !important;}

.ce-vendors__search::placeholder {
  color: var(--ce-color-text-muted);
  opacity: 1;
}

/* Add some focus styles for accessibility and visual feedback */
.ce-vendors__search:focus {
  outline: none;
  border-color: var(--ce-color-text-link);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Also ensure placeholder text color is consistent */
.ce-vendors__search::placeholder {
  color: var(--ce-color-text-muted); /* Using one of your defined muted colors */
  opacity: 1; /* Firefox default opacity can make it lighter */
}

/* --- Responsive Adjustments (Tablet & Desktop) --- */
@media (min-width: 768px) {
  .ce-vendors__tools {
    width: 100%;
    max-width: 320px; /* Control the max width of the search bar */
    flex-shrink: 0;
  }
}

/* --- A-Z Navigation Bar (now a separate element) --- */
.ce-az {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* Center links on mobile */
  gap: 6px;
  margin-bottom: 32px;
}

.ce-az__link {
  flex-grow: 1;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 6px;
  border-radius: 8px;
  color: var(--ce-color-text-secondary);
  background-color: #f1f5f9;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-width: 32px;
}

.ce-az__link:hover {
  background-color: #e2e8f0;
  color: var(--ce-color-text-primary);
}


/* --- 3. Responsive Header (Tablet & Desktop) --- */
@media (min-width: 768px) {
  .ce-vendors__header {
    flex-direction: row; /* Side-by-side on desktop */
    justify-content: space-between;
    align-items: center; /* Center vertically */
  }

  .ce-vendors__tools {
    width: 100%;
    max-width: 320px; /* Control the max width of the search bar */
    flex-shrink: 0; /* Prevents search bar from shrinking */
  }

  .ce-az {
    justify-content: flex-start; /* Left-align links */
  }

  .ce-az__link {
    flex-grow: 0;
    padding: 8px 12px;
  }
}



/* --- 4. Vendors Grid --- */
.ce-vendors__grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
}

/* 3 columns for tablets */
@media (min-width: 768px) {
  .ce-vendors__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 4 columns for desktops */
@media (min-width: 1024px) {
  .ce-vendors__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* --- 5. Vendor Card --- */
.ce-vendor-card {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--ce-color-bg-card);
  border: 1px solid var(--ce-color-border);
  border-radius: 14px;
  box-shadow: var(--ce-shadow);
  text-decoration: none;
  overflow: hidden;
  transition: transform .08s ease, box-shadow .18s ease, border-color .18s ease;
}

.ce-vendor-card:hover {
  transform: translateY(-1px);
  border-color: #c7d2fe;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .08);
}

.ce-vendor-card__media {
  display: grid;
  place-items: center;
  background: var(--ce-color-bg-page);
  padding: 18px;
}

.ce-vendor-thumb {
  width: 120px;
  height: auto;
  object-fit: contain;
}

.ce-vendor-thumb--ph {
  width: 120px;
  height: 120px;
}

.ce-vendor-card__body {
  padding: 12px 14px 14px;
}

.ce-vendor-card__title {
  margin: 0 0 6px;
  color: var(--ce-color-text-primary);
  font-weight: 700;
  font-size: 1.05rem;
}

.ce-vendor-card__count {
  margin: 0 0 10px;
  color: var(--ce-color-text-secondary);
  font-size: .9rem;
}

.ce-vendor-card__cta {
  display: inline-block;
  margin-top: 2px;
  color: var(--ce-color-text-link);
  font-weight: 700;
  font-size: .92rem;
}