/**
 * @file
 * Apple App Store inspired styles for DrupalX App Store.
 * Fully responsive: mobile (320px+) → tablet (768px+) → desktop (1024px+).
 */

/* ── Reset & Base ─────────────────────────────────────────────── */
/* ── Break out of theme .dx-content container ────────────────── */
.dx-appstore {
  /* Escape the 960px theme container to use full viewport width */
  max-width: none;
  margin: -2rem -2rem -3.5rem;
  padding: 0 16px 40px;
  background: #f5f5f7;
  min-height: 60vh;
  border: none;
  box-shadow: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #1d1d1f;
}

.dx-appstore *,
.dx-appstore *::before,
.dx-appstore *::after {
  box-sizing: border-box;
}

/* Inner content wrapper — centers and constrains width */
.dx-appstore__inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Hero Header ──────────────────────────────────────────────── */
.dx-appstore-hero {
  text-align: center;
  padding: 32px 0 20px;
}

.dx-appstore-hero__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.dx-appstore-hero__icon svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.dx-appstore-hero__title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
  margin: 0 0 6px;
  line-height: 1.15;
}

.dx-appstore-hero__subtitle {
  font-size: 15px;
  font-weight: 400;
  color: #86868b;
  margin: 0;
  line-height: 1.4;
}

/* ── Category Pills ───────────────────────────────────────────── */
.dx-appstore-nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 0 24px;
}

.dx-appstore-nav__pill {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1.5px solid #d2d2d7;
  color: #1d1d1f;
  background: #fff;
  white-space: nowrap;
  line-height: 1.4;
}

.dx-appstore-nav__pill:hover {
  background: #f5f5f7;
  border-color: #007AFF;
  color: #007AFF;
}

.dx-appstore-nav__pill--active {
  background: #007AFF;
  border-color: #007AFF;
  color: #fff;
}

.dx-appstore-nav__pill--active:hover {
  background: #0066d6;
  border-color: #0066d6;
  color: #fff;
}

/* Drupal category pill — Drupal blue */
.dx-appstore-nav__pill[href$="/drupal"] {
  border-color: #0678BE;
  color: #0678BE;
}
.dx-appstore-nav__pill[href$="/drupal"]:hover {
  background: #0678BE;
  color: #fff;
}
.dx-appstore-nav__pill[href$="/drupal"].dx-appstore-nav__pill--active {
  background: #0678BE;
  border-color: #0678BE;
  color: #fff;
}

/* ── Section Title ────────────────────────────────────────────── */
.dx-appstore-section-title {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.dx-appstore-section-count {
  font-size: 14px;
  font-weight: 400;
  color: #86868b;
  margin-left: 6px;
}

/* ── App Grid ─────────────────────────────────────────────────── */
.dx-appstore-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* ── App Card ─────────────────────────────────────────────────── */
.dx-app-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
}

.dx-app-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Drupal community modules — subtle blue tint to distinguish from first-party */
.dx-app-card--drupal {
  background: #f8fbff;
  border: 1px solid #e0edf8;
}
.dx-app-card--drupal:hover {
  box-shadow: 0 4px 16px rgba(6, 120, 190, 0.10);
}

/* DrupalX first-party apps — vivid highlight */
.dx-app-card--firstparty {
  background: #fff;
  border: 1px solid rgba(52, 199, 89, 0.25);
}
.dx-app-card--firstparty:hover {
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.15);
}

/* ── App Icon ─────────────────────────────────────────────────── */
.dx-app-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Category-based icon gradients */
.dx-app-card__icon--ai {
  background: linear-gradient(135deg, #5856D6 0%, #AF52DE 100%);
}
.dx-app-card__icon--commerce {
  background: linear-gradient(135deg, #FF9500 0%, #FF3B30 100%);
}
.dx-app-card__icon--marketing {
  background: linear-gradient(135deg, #FF2D55 0%, #FF6482 100%);
}
.dx-app-card__icon--distribution {
  background: linear-gradient(135deg, #30D158 0%, #34C759 100%);
}
.dx-app-card__icon--finance {
  background: linear-gradient(135deg, #007AFF 0%, #5AC8FA 100%);
}
.dx-app-card__icon--transportation {
  background: linear-gradient(135deg, #5AC8FA 0%, #007AFF 100%);
}
.dx-app-card__icon--utility {
  background: linear-gradient(135deg, #8E8E93 0%, #636366 100%);
}
.dx-app-card__icon--social {
  background: linear-gradient(135deg, #FF2D55 0%, #FF9500 100%);
}
.dx-app-card__icon--oss {
  background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
}
.dx-app-card__icon--industry {
  background: linear-gradient(135deg, #FF9500 0%, #FFCC00 100%);
}
.dx-app-card__icon--drupal {
  background: linear-gradient(135deg, #0678BE 0%, #4DB7EF 100%);
}

/* ── App Info ─────────────────────────────────────────────────── */
.dx-app-card__info {
  flex: 1;
  min-width: 0;
}

.dx-app-card__name {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 1px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dx-app-card__category {
  font-size: 11px;
  font-weight: 500;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 3px;
}

.dx-app-card__desc {
  font-size: 12px;
  font-weight: 400;
  color: #6e6e73;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Action Button (GET style) ────────────────────────────────── */
.dx-app-card__action {
  flex-shrink: 0;
  align-self: center;
}

.dx-app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
}

.dx-app-btn--get {
  background: rgba(0, 122, 255, 0.12);
  color: #007AFF;
}

.dx-app-btn--get:hover {
  background: #007AFF;
  color: #fff;
}

.dx-app-btn--visit {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}

.dx-app-btn--visit:hover {
  background: #34C759;
  color: #fff;
}

.dx-app-btn--download {
  background: rgba(255, 149, 0, 0.12);
  color: #c93400;
}

.dx-app-btn--download:hover {
  background: #FF9500;
  color: #fff;
}

.dx-app-btn--price {
  background: #007AFF;
  color: #fff;
  padding: 5px 16px;
}

.dx-app-btn--price:hover {
  background: #0066d6;
}

/* ── Trust Badge ──────────────────────────────────────────────── */
.dx-app-card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}

.dx-app-card__badge--curated {
  background: rgba(52, 199, 89, 0.12);
  color: #1a7f37;
}

.dx-app-card__badge--security {
  background: rgba(0, 122, 255, 0.10);
  color: #0056b3;
}

.dx-app-card__badge--stable {
  background: rgba(88, 86, 214, 0.10);
  color: #463fad;
}

.dx-app-card__badge--demo {
  background: rgba(255, 149, 0, 0.08);
  color: #c93400;
}

.dx-app-card__badge--community {
  background: rgba(142, 142, 147, 0.08);
  color: #8e8e93;
  border: 1px dashed #d2d2d7;
}

/* ── Empty State ──────────────────────────────────────────────── */
.dx-appstore-empty {
  text-align: center;
  padding: 60px 16px;
  color: #86868b;
}

.dx-appstore-empty__icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.dx-appstore-empty__text {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════════
   TABLET  (768px+)
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  .dx-appstore {
    padding: 0 24px 48px;
    margin: -2.25rem -2rem -3.5rem;
    box-shadow: none;
  }

  .dx-appstore-hero {
    padding: 40px 0 24px;
  }

  .dx-appstore-hero__icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }

  .dx-appstore-hero__icon svg {
    width: 32px;
    height: 32px;
  }

  .dx-appstore-hero__title {
    font-size: 34px;
  }

  .dx-appstore-hero__subtitle {
    font-size: 16px;
  }

  .dx-appstore-nav {
    gap: 8px;
    padding: 0 0 28px;
  }

  .dx-appstore-nav__pill {
    padding: 7px 18px;
    font-size: 14px;
  }

  .dx-appstore-section-title {
    font-size: 22px;
    margin-bottom: 18px;
  }

  .dx-appstore-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .dx-app-card {
    padding: 18px;
    border-radius: 16px;
    gap: 14px;
  }

  .dx-app-card__icon {
    width: 54px;
    height: 54px;
    border-radius: 13px;
    font-size: 24px;
  }

  .dx-app-card__name {
    font-size: 16px;
  }

  .dx-app-card__category {
    font-size: 12px;
  }

  .dx-app-card__desc {
    font-size: 13px;
  }

  .dx-app-btn {
    padding: 6px 16px;
    font-size: 14px;
  }

  .dx-app-card__badge {
    font-size: 10px;
    padding: 2px 8px;
    top: 10px;
    right: 10px;
  }
}

/* ══════════════════════════════════════════════════════════════
   DESKTOP  (1024px+)
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .dx-appstore {
    padding: 0 32px 60px;
    margin: -2.25rem -2rem -3.5rem;
    box-shadow: none;
  }

  .dx-appstore-hero {
    padding: 52px 0 28px;
  }

  .dx-appstore-hero__icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }

  .dx-appstore-hero__icon svg {
    width: 36px;
    height: 36px;
  }

  .dx-appstore-hero__title {
    font-size: 40px;
  }

  .dx-appstore-hero__subtitle {
    font-size: 17px;
  }

  .dx-appstore-nav {
    gap: 10px;
    padding: 0 0 32px;
  }

  .dx-appstore-nav__pill {
    padding: 8px 20px;
    font-size: 14px;
  }

  .dx-appstore-section-title {
    font-size: 24px;
    margin-bottom: 20px;
  }

  .dx-appstore-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
  }

  .dx-app-card {
    padding: 20px;
    gap: 16px;
  }

  .dx-app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  }

  .dx-app-card__icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    font-size: 26px;
  }

  .dx-app-card__name {
    font-size: 17px;
  }

  .dx-app-card__desc {
    -webkit-line-clamp: 2;
  }

  .dx-app-btn {
    padding: 6px 18px;
    font-size: 14px;
  }

  .dx-app-card__badge {
    top: 12px;
    right: 12px;
  }
}

/* ══════════════════════════════════════════════════════════════
   WIDE DESKTOP  (1280px+)
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 1280px) {
  .dx-appstore-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ══════════════════════════════════════════════════════════════
   SMALL MOBILE  (< 375px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 374px) {
  .dx-appstore {
    padding: 0 12px 32px;
  }

  .dx-appstore-hero {
    padding: 24px 0 16px;
  }

  .dx-appstore-hero__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .dx-appstore-hero__icon svg {
    width: 24px;
    height: 24px;
  }

  .dx-appstore-hero__title {
    font-size: 24px;
  }

  .dx-appstore-hero__subtitle {
    font-size: 13px;
  }

  .dx-appstore-nav {
    gap: 6px;
    padding: 0 0 18px;
  }

  .dx-appstore-nav__pill {
    padding: 5px 12px;
    font-size: 12px;
  }

  .dx-appstore-section-title {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .dx-app-card {
    padding: 12px;
    gap: 10px;
    border-radius: 12px;
  }

  .dx-app-card__icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 18px;
  }

  .dx-app-card__name {
    font-size: 14px;
  }

  .dx-app-card__category {
    font-size: 10px;
  }

  .dx-app-card__desc {
    font-size: 11px;
    -webkit-line-clamp: 1;
  }

  .dx-app-btn {
    padding: 4px 12px;
    font-size: 12px;
  }

  .dx-app-card__badge {
    font-size: 8px;
    padding: 1px 5px;
    top: 6px;
    right: 6px;
  }
}
