/* ============================================================
   Business Directory Pro — Frontend Styles
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --bd-primary:       #6366f1;
  --bd-primary-dark:  #4f46e5;
  --bd-success:       #22c55e;
  --bd-text:          #1e293b;
  --bd-text-muted:    #64748b;
  --bd-border:        #e2e8f0;
  --bd-bg:            #f8fafc;
  --bd-card-bg:       #ffffff;
  --bd-radius:        12px;
  --bd-radius-sm:     6px;
  --bd-shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --bd-shadow-hover:  0 4px 12px rgba(0,0,0,.12), 0 8px 32px rgba(0,0,0,.10);
  --bd-transition:    0.2s ease;
  --bd-font:          inherit;
  --bd-gap:           24px;
}

/* ── Directory Wrapper ─────────────────────────────────────── */
.bd-directory {
  font-family: var(--bd-font);
  color: var(--bd-text);
}

/* ── Search Bar ────────────────────────────────────────────── */
.bd-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.bd-search-input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid var(--bd-border);
  border-radius: var(--bd-radius-sm);
  font-size: 15px;
  line-height: 1.4;
  transition: border-color var(--bd-transition);
  outline: none;
  background: var(--bd-card-bg);
  color: var(--bd-text);
}
.bd-search-input:focus {
  border-color: var(--bd-primary);
}
.bd-search-btn {
  padding: 10px 14px;
  background: var(--bd-primary);
  color: #fff;
  border: none;
  border-radius: var(--bd-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--bd-transition);
  line-height: 0;
}
.bd-search-btn:hover { background: var(--bd-primary-dark); }

/* ── Filter Tabs ───────────────────────────────────────────── */
.bd-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.bd-filter-tab {
  padding: 8px 18px;
  border: 2px solid var(--bd-border);
  border-radius: 999px;
  background: transparent;
  color: var(--bd-text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--bd-transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.bd-filter-tab:hover {
  border-color: var(--bd-primary);
  color: var(--bd-primary);
}
.bd-filter-tab.active {
  background: var(--bd-primary);
  border-color: var(--bd-primary);
  color: #fff;
}
.bd-cat-icon {
  font-size: 16px;
  line-height: 1;
}

/* ── Grid ──────────────────────────────────────────────────── */
.bd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--bd-gap);
}
.bd-grid--1col { grid-template-columns: 1fr; }
.bd-grid--2col { grid-template-columns: repeat(2, 1fr); }
.bd-grid--3col { grid-template-columns: repeat(3, 1fr); }
.bd-grid--4col { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .bd-grid,
  .bd-grid--3col,
  .bd-grid--4col { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .bd-grid,
  .bd-grid--2col,
  .bd-grid--3col,
  .bd-grid--4col { grid-template-columns: 1fr; }
  .bd-filter-bar { gap: 6px; }
  .bd-filter-tab { padding: 6px 12px; font-size: 13px; }
}

/* ── Card ──────────────────────────────────────────────────── */
.bd-card {
  background: var(--bd-card-bg);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--bd-transition), transform var(--bd-transition);
  position: relative;
}
.bd-card:hover {
  box-shadow: var(--bd-shadow-hover);
  transform: translateY(-2px);
}

/* Featured card accent */
.bd-card--featured {
  border: 2px solid var(--bd-primary);
}

/* ── Card Image ────────────────────────────────────────────── */
.bd-card__image-link {
  display: block;
  overflow: hidden;
}
.bd-card__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.bd-card:hover .bd-card__image { transform: scale(1.03); }

.bd-card__image--placeholder {
  width: 100%;
  height: 200px;
  background: var(--bd-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bd-border);
}

/* ── Card Body ─────────────────────────────────────────────── */
.bd-card__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

/* ── Category Labels ───────────────────────────────────────── */
.bd-card__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bd-card__cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bd-primary);
  text-decoration: none;
}
.bd-card__cat:hover { color: var(--bd-primary-dark); }

/* ── Card Title ────────────────────────────────────────────── */
.bd-card__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.bd-card__title a {
  color: var(--bd-text);
  text-decoration: none;
}
.bd-card__title a:hover { color: var(--bd-primary); }
.bd-card__price {
  font-size: 13px;
  font-weight: 500;
  color: var(--bd-text-muted);
}

/* ── Tagline ───────────────────────────────────────────────── */
.bd-card__tagline {
  margin: 0;
  font-size: 14px;
  color: var(--bd-text-muted);
  line-height: 1.5;
  font-style: italic;
}

/* ── Meta ──────────────────────────────────────────────────── */
.bd-card__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}
.bd-card__meta-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  color: var(--bd-text-muted);
  line-height: 1.4;
}
.bd-card__meta-item svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--bd-primary);
}
.bd-card__meta-item a {
  color: inherit;
  text-decoration: none;
}
.bd-card__meta-item a:hover { color: var(--bd-primary); }

/* ── Card Actions ──────────────────────────────────────────── */
.bd-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.bd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: var(--bd-radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--bd-transition);
  line-height: 1;
}
.bd-btn--primary {
  background: var(--bd-primary);
  color: #fff;
  border-color: var(--bd-primary);
}
.bd-btn--primary:hover {
  background: var(--bd-primary-dark);
  border-color: var(--bd-primary-dark);
  color: #fff;
}
.bd-btn--outline {
  background: transparent;
  color: var(--bd-primary);
  border-color: var(--bd-primary);
}
.bd-btn--outline:hover {
  background: var(--bd-primary);
  color: #fff;
}
.bd-btn--lg { padding: 12px 28px; font-size: 16px; }

/* ── Badges ────────────────────────────────────────────────── */
.bd-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}
.bd-badge--featured {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bd-primary);
  color: #fff;
  z-index: 2;
}

/* ── No Results ────────────────────────────────────────────── */
.bd-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--bd-text-muted);
  font-size: 16px;
}

/* ── Spinner ───────────────────────────────────────────────── */
.bd-spinner {
  display: flex;
  justify-content: center;
  padding: 32px;
}
.bd-spinner[hidden] { display: none; }
.bd-spinner__icon {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bd-border);
  border-top-color: var(--bd-primary);
  border-radius: 50%;
  animation: bd-spin 0.7s linear infinite;
}
@keyframes bd-spin { to { transform: rotate(360deg); } }

/* ── Pagination ────────────────────────────────────────────── */
.bd-pagination {
  margin-top: 32px;
  display: flex;
  justify-content: center;
}
.bd-pagination .page-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.bd-pagination .page-numbers li { display: inline; }
.bd-pagination .page-numbers a,
.bd-pagination .page-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--bd-radius-sm);
  border: 2px solid var(--bd-border);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--bd-text);
  transition: all var(--bd-transition);
}
.bd-pagination .page-numbers .current {
  background: var(--bd-primary);
  border-color: var(--bd-primary);
  color: #fff;
}
.bd-pagination .page-numbers a:hover {
  border-color: var(--bd-primary);
  color: var(--bd-primary);
}

/* ── Minimal card style ────────────────────────────────────── */
.bd-style-minimal .bd-card {
  box-shadow: none;
  border: 1px solid var(--bd-border);
}
.bd-style-minimal .bd-card__image { height: 160px; }
.bd-style-minimal .bd-card__body  { padding: 14px; gap: 6px; }
.bd-style-minimal .bd-card__actions { display: none; }

/* ── Detailed card style ───────────────────────────────────── */
.bd-style-detailed .bd-card__image { height: 240px; }
.bd-style-detailed .bd-card__body  { padding: 24px; gap: 12px; }

/* ── Submission Form ───────────────────────────────────────── */
.bd-submit-form {
  max-width: 680px;
}
.bd-form-row {
  margin-bottom: 20px;
}
.bd-form-row label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--bd-text);
}
.bd-form-row input[type="text"],
.bd-form-row input[type="email"],
.bd-form-row input[type="tel"],
.bd-form-row input[type="url"],
.bd-form-row input[type="search"],
.bd-form-row select,
.bd-form-row textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--bd-border);
  border-radius: var(--bd-radius-sm);
  font-size: 15px;
  color: var(--bd-text);
  background: var(--bd-card-bg);
  transition: border-color var(--bd-transition);
  box-sizing: border-box;
  outline: none;
}
.bd-form-row input:focus,
.bd-form-row select:focus,
.bd-form-row textarea:focus {
  border-color: var(--bd-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.bd-form-row textarea { resize: vertical; }
.bd-form-row--half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 560px) { .bd-form-row--half { grid-template-columns: 1fr; } }
.bd-form-divider {
  border: none;
  border-top: 1px solid var(--bd-border);
  margin: 28px 0 20px;
}
.bd-form-section-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bd-text-muted);
  margin: 0 0 16px;
}
.bd-form-submit { margin-top: 8px; }

/* ── Photo Upload Zone ─────────────────────────────────────── */
.bd-upload-zone {
  position: relative;
  border: 2px dashed var(--bd-border);
  border-radius: var(--bd-radius);
  background: var(--bd-bg);
  transition: border-color var(--bd-transition), background var(--bd-transition);
  overflow: hidden;
  cursor: pointer;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bd-upload-zone:hover,
.bd-upload-zone.bd-drag-over {
  border-color: var(--bd-primary);
  background: rgba(99,102,241,.04);
}
.bd-upload-zone.bd-has-file {
  border-style: solid;
  border-color: var(--bd-primary);
  background: transparent;
  min-height: auto;
}

/* Invisible full-size file input sits on top */
.bd-upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
/* When a preview is shown, shrink the hit area so the clear button works */
.bd-upload-zone.bd-has-file .bd-upload-input {
  display: none;
}

/* Drop-zone UI layer */
.bd-upload-zone__ui {
  text-align: center;
  padding: 32px 20px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.bd-upload-zone__icon {
  color: var(--bd-primary);
  display: block;
  line-height: 0;
}
.bd-upload-zone__prompt {
  margin: 0;
  font-size: 15px;
  color: var(--bd-text-muted);
  line-height: 1.5;
}
.bd-upload-zone__cta {
  color: var(--bd-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bd-upload-zone__preview-name {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--bd-text);
}
.bd-upload-zone__preview-name[hidden] { display: none; }

/* Image preview */
.bd-upload-preview {
  position: relative;
  width: 100%;
}
.bd-upload-preview[hidden] { display: none; }
.bd-upload-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--bd-radius) - 2px);
}
.bd-upload-clear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background var(--bd-transition);
  line-height: 1;
}
.bd-upload-clear:hover { background: rgba(0,0,0,.8); }

/* Hint text below the zone */
.bd-upload-hint {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--bd-text-muted);
  line-height: 1.6;
}
.bd-upload-hint strong { color: var(--bd-text); }

/* ── Alerts ────────────────────────────────────────────────── */
.bd-alert {
  border-radius: var(--bd-radius-sm);
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 20px;
}
.bd-alert--success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.bd-alert--error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ── Submission Success Card ───────────────────────────────── */
.bd-success-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 5px solid #16a34a;
  border-radius: var(--bd-radius);
  padding: 28px 28px 28px 24px;
  margin-bottom: 24px;
}
.bd-success-card__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: #16a34a;
  border-radius: 50%;
  color: #fff;
}
.bd-success-card__body {
  flex: 1;
}
.bd-success-card__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: #14532d;
  line-height: 1.3;
}
.bd-success-card__msg {
  margin: 0 0 20px;
  color: #166534;
  font-size: 15px;
  line-height: 1.6;
}
.bd-success-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.bd-success-card__actions .bd-btn--primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bd-success-card__actions .bd-btn--outline {
  background: transparent;
  border: 2px solid #16a34a;
  color: #16a34a;
  font-weight: 600;
}
.bd-success-card__actions .bd-btn--outline:hover {
  background: #16a34a;
  color: #fff;
}

@media (max-width: 480px) {
  .bd-success-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 18px;
  }
  .bd-success-card__actions {
    justify-content: center;
  }
}

/* ── Single Business Page ──────────────────────────────────── */
.bd-single {
  max-width: 900px;
  margin: 0 auto;
}
.bd-single__header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.bd-single__image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--bd-radius);
  margin-bottom: 32px;
}
.bd-single__meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 28px 0;
  padding: 24px;
  background: var(--bd-bg);
  border-radius: var(--bd-radius);
}
.bd-single__meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bd-single__meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bd-text-muted);
}
.bd-single__meta-value {
  font-size: 15px;
  color: var(--bd-text);
  font-weight: 500;
}
.bd-single__meta-value a {
  color: var(--bd-primary);
  text-decoration: none;
}
.bd-single__meta-value a:hover { text-decoration: underline; }
.bd-single__social {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.bd-single__social a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--bd-border);
  border-radius: var(--bd-radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--bd-text);
  text-decoration: none;
  transition: all var(--bd-transition);
}
.bd-single__social a:hover {
  background: var(--bd-primary);
  border-color: var(--bd-primary);
  color: #fff;
}

/* ── Form Validation ──────────────────────────────────────── */

/* Error state on inputs, selects, textareas */
.bd-submit-form .bd-field-error,
.bd-submit-form .bd-field-error:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important;
  outline: none;
}

/* Inline error message under a field */
.bd-field-error-msg {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 5px 0 0;
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  animation: bd-shake .3s ease;
}
.bd-field-error-msg span[aria-hidden] {
  flex-shrink: 0;
  margin-top: 1px;
}

@keyframes bd-shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-4px); }
  40%  { transform: translateX(4px); }
  60%  { transform: translateX(-3px); }
  80%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

/* Summary banner shown at the top of the form on submit */
.bd-validation-summary {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-left: 4px solid #dc2626;
  border-radius: var(--bd-radius-sm);
  padding: 14px 16px;
  margin-bottom: 24px;
  color: #991b1b;
  font-size: 14px;
}
.bd-validation-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}
.bd-validation-summary ul {
  margin: 0;
  padding-left: 18px;
}
.bd-validation-summary li {
  margin: 3px 0;
  line-height: 1.5;
}
