/**
 * Adventure Post Directory for Elementor
 * Frontend Styles — PedalFlow Edition
 * Version: 1.0.0
 */

/* ─── CSS Custom Properties ──────────────────────────────────────── */
:root {
  --apd-green-900: #1a3a2a;
  --apd-green-800: #1b4332;
  --apd-green-700: #2d6a4f;
  --apd-green-600: #40916c;
  --apd-green-400: #74c69d;
  --apd-green-100: #d8f3dc;
  --apd-easy:     #40916c;
  --apd-moderate: #f4a261;
  --apd-hard:     #e76f51;
  --apd-expert:   #c1121f;
  --apd-shadow-sm: 0 2px 8px rgba(0,0,0,.08);
  --apd-shadow-md: 0 8px 32px rgba(0,0,0,.12);
  --apd-shadow-lg: 0 20px 60px rgba(0,0,0,.16);
  --apd-radius:   16px;
  --apd-radius-sm: 8px;
  --apd-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --apd-transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Directory Wrapper ───────────────────────────────────────────── */
.apd-directory {
  position: relative;
  font-family: var(--apd-font-sans);
  color: #2d3748;
}

/* ─── Header ──────────────────────────────────────────────────────── */
.apd-directory__header {
  margin-bottom: 40px;
  text-align: center;
}

.apd-directory__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--apd-green-900);
  margin: 0 0 10px;
  line-height: 1.1;
}

.apd-directory__subtitle {
  font-size: 1.05rem;
  color: #718096;
  margin: 0 0 24px;
}

.apd-directory__title-line {
  display: inline-block;
  width: 64px;
  height: 4px;
  background: linear-gradient(90deg, var(--apd-green-700), var(--apd-green-400));
  border-radius: 2px;
}

/* ─── Stats Bar ───────────────────────────────────────────────────── */
.apd-stats-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  background: var(--apd-green-900);
  border-radius: var(--apd-radius);
  margin-bottom: 36px;
  overflow: hidden;
}

.apd-stats-bar__item {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  border-right: 1px solid rgba(255,255,255,.08);
  transition: var(--apd-transition);
}

.apd-stats-bar__item:last-child {
  border-right: none;
}

.apd-stats-bar__item:hover {
  background: rgba(255,255,255,.06);
}

.apd-stats-bar__icon {
  font-size: 1.75rem;
  margin-bottom: 6px;
  display: block;
}

.apd-stats-bar__value {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.apd-stats-bar__label {
  font-size: 0.75rem;
  color: rgba(255,255,255,.65);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ─── Filter Bar ──────────────────────────────────────────────────── */
.apd-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: #f7f9fc;
  border: 1px solid #e2e8f0;
  border-radius: var(--apd-radius);
  padding: 16px 20px;
  margin-bottom: 32px;
}

.apd-filter-bar__search {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.apd-search-input {
  width: 100%;
  padding: 10px 16px 10px 44px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--apd-radius-sm);
  font-size: 0.9rem;
  background: #fff;
  transition: var(--apd-transition);
  outline: none;
  box-sizing: border-box;
}

.apd-search-input:focus {
  border-color: var(--apd-green-600);
  box-shadow: 0 0 0 3px rgba(64, 145, 108, .15);
}

.apd-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #9aa5b4;
  pointer-events: none;
}

.apd-filter-bar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.apd-filter-select {
  padding: 9px 36px 9px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--apd-radius-sm);
  font-size: 0.875rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239aa5b4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") right 12px center no-repeat;
  appearance: none;
  cursor: pointer;
  transition: var(--apd-transition);
  outline: none;
}

.apd-filter-select:focus {
  border-color: var(--apd-green-600);
  box-shadow: 0 0 0 3px rgba(64, 145, 108, .15);
}

.apd-filter-reset {
  padding: 9px 16px;
  border: 1.5px solid #cbd5e0;
  border-radius: var(--apd-radius-sm);
  background: transparent;
  font-size: 0.875rem;
  color: #718096;
  cursor: pointer;
  transition: var(--apd-transition);
}

.apd-filter-reset:hover {
  border-color: var(--apd-green-600);
  color: var(--apd-green-700);
  background: var(--apd-green-100);
}

.apd-filter-bar__count {
  font-size: 0.85rem;
  color: #718096;
  margin-left: auto;
  white-space: nowrap;
}

.apd-filter-bar__count [data-apd-count] {
  font-weight: 700;
  color: var(--apd-green-700);
}

/* ─── Tour Grid ───────────────────────────────────────────────────── */
.apd-tour-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(3, 1fr);
}

.apd-cols--1 .apd-tour-grid { grid-template-columns: 1fr; }
.apd-cols--2 .apd-tour-grid { grid-template-columns: repeat(2, 1fr); }
.apd-cols--3 .apd-tour-grid { grid-template-columns: repeat(3, 1fr); }
.apd-cols--4 .apd-tour-grid { grid-template-columns: repeat(4, 1fr); }

/* List layout */
.apd-layout--list .apd-tour-grid {
  grid-template-columns: 1fr !important;
}
.apd-layout--list .apd-tour-card {
  display: flex;
  flex-direction: row;
}
.apd-layout--list .apd-tour-card__image {
  width: 280px;
  flex-shrink: 0;
  border-radius: var(--apd-radius) 0 0 var(--apd-radius) !important;
  overflow: hidden;
}
.apd-layout--list .apd-tour-card__image img {
  height: 100%;
  object-fit: cover;
  border-radius: var(--apd-radius) 0 0 var(--apd-radius) !important;
}
.apd-layout--list .apd-tour-card__body {
  flex: 1;
}

/* ─── Tour Card ───────────────────────────────────────────────────── */
.apd-tour-card {
  background: #fff;
  border-radius: var(--apd-radius);
  box-shadow: var(--apd-shadow-sm);
  overflow: hidden;
  transition: var(--apd-transition);
  border: 1px solid #f0f4f8;
  display: flex;
  flex-direction: column;
}

.apd-hover-lift .apd-tour-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--apd-shadow-lg);
}

/* Card Image */
.apd-tour-card__image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: #e2e8f0;
}

.apd-tour-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.apd-tour-card:hover .apd-tour-card__img {
  transform: scale(1.05);
}

/* Badges */
.apd-difficulty-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  backdrop-filter: blur(8px);
}

.apd-family-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: var(--apd-shadow-sm);
}

.apd-difficulty--easy    { background: var(--apd-easy); }
.apd-difficulty--moderate { background: var(--apd-moderate); }
.apd-difficulty--hard    { background: var(--apd-hard); }
.apd-difficulty--expert  { background: var(--apd-expert); }

/* Card Body */
.apd-tour-card__body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apd-tour-card__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.apd-tour-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.apd-tour-card__title a:hover {
  color: var(--apd-green-700);
}

/* Stats Row */
.apd-tour-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 14px;
  background: #f7f9fc;
  border-radius: var(--apd-radius-sm);
}

.apd-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: #4a5568;
}

.apd-stat__icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.apd-stat__value {
  font-weight: 600;
  color: #2d3748;
}

.apd-stat--difficulty .apd-difficulty-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.apd-difficulty-dot.apd-difficulty--easy    { background: var(--apd-easy); }
.apd-difficulty-dot.apd-difficulty--moderate { background: var(--apd-moderate); }
.apd-difficulty-dot.apd-difficulty--hard    { background: var(--apd-hard); }
.apd-difficulty-dot.apd-difficulty--expert  { background: var(--apd-expert); }

/* Starting Point */
.apd-tour-card__start {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.84rem;
  color: #718096;
}

.apd-tour-card__start-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Description */
.apd-tour-card__description {
  font-size: 0.875rem;
  line-height: 1.65;
  color: #4a5568;
  flex: 1;
}

/* Card Footer */
.apd-tour-card__footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

/* ─── Buttons ─────────────────────────────────────────────────────── */
.apd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--apd-radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: var(--apd-transition);
  border: 2px solid transparent;
  white-space: nowrap;
}

.apd-btn--primary {
  background: var(--apd-green-700);
  color: #fff;
}

.apd-btn--primary:hover {
  background: var(--apd-green-800);
  color: #fff;
  transform: translateX(2px);
}

.apd-btn--outline {
  background: transparent;
  border-color: var(--apd-green-600);
  color: var(--apd-green-700);
}

.apd-btn--outline:hover {
  background: var(--apd-green-100);
}

/* ─── No Results ──────────────────────────────────────────────────── */
.apd-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  background: #f7f9fc;
  border-radius: var(--apd-radius);
  border: 2px dashed #e2e8f0;
}

.apd-no-results__icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.apd-no-results h3 {
  font-size: 1.3rem;
  color: #2d3748;
  margin: 0 0 8px;
}

.apd-no-results p {
  color: #718096;
  margin: 0;
}

/* ─── Loading Overlay ─────────────────────────────────────────────── */
.apd-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--apd-radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}

.apd-loading-overlay.is-loading {
  opacity: 1;
  pointer-events: all;
}

.apd-spinner__ring {
  width: 44px;
  height: 44px;
  border: 4px solid var(--apd-green-100);
  border-top-color: var(--apd-green-700);
  border-radius: 50%;
  animation: apd-spin 0.7s linear infinite;
}

@keyframes apd-spin {
  to { transform: rotate(360deg); }
}

/* ─── AJAX fade animation ─────────────────────────────────────────── */
.apd-tour-card {
  animation: apd-card-in 0.35s ease both;
}

@keyframes apd-card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .apd-cols--4 .apd-tour-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .apd-tour-grid,
  .apd-cols--3 .apd-tour-grid,
  .apd-cols--4 .apd-tour-grid { grid-template-columns: repeat(2, 1fr); }

  .apd-stats-bar__item { padding: 18px 12px; }
  .apd-stats-bar__value { font-size: 1.5rem; }

  .apd-layout--list .apd-tour-card { flex-direction: column; }
  .apd-layout--list .apd-tour-card__image {
    width: 100%;
    border-radius: var(--apd-radius) var(--apd-radius) 0 0 !important;
  }
  .apd-layout--list .apd-tour-card__image img {
    border-radius: var(--apd-radius) var(--apd-radius) 0 0 !important;
  }
}

@media (max-width: 600px) {
  .apd-tour-grid,
  .apd-cols--2 .apd-tour-grid,
  .apd-cols--3 .apd-tour-grid,
  .apd-cols--4 .apd-tour-grid { grid-template-columns: 1fr; }

  .apd-stats-bar { flex-wrap: wrap; }
  .apd-stats-bar__item {
    flex: 1 0 40%;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }

  .apd-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .apd-filter-bar__filters { flex-direction: column; }
  .apd-filter-select { width: 100%; }
  .apd-filter-bar__search { min-width: 0; }
  .apd-filter-bar__count { margin-left: 0; }

  .apd-directory__title { font-size: 2rem; }
}

/* ─── Elementor Editor Tweaks ─────────────────────────────────────── */
.elementor-editor-active .apd-loading-overlay {
  display: none !important;
}
