/* ========================================
   Free Apps Page Styles
   ======================================== */

/* --- Apps Hero --- */
.apps-hero {
  padding: 8rem 0 3rem;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-alt) 100%);
  text-align: center;
}

.apps-hero h1 {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.apps-hero p {
  font-size: 1.15rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- App Cards --- */
.app-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  margin-bottom: 2.5rem;
  transition: box-shadow 0.3s ease;
}

.app-card:hover {
  box-shadow: var(--shadow-lg);
}

.app-card:nth-child(even) .app-card-media {
  order: 2;
}

.app-card:nth-child(even) .app-card-content {
  order: 1;
}

/* App icon badge */
.app-icon-badge {
  position: absolute;
  top: -12px;
  left: -12px;
  width: 56px;
  height: 56px;
  background: var(--bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 2;
}

.app-icon-badge img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.app-card-media {
  position: relative;
}

/* Media showcase - video + screenshots side by side */
.app-media-showcase {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

/* Device images — emulator frame already baked into the image */
.device-img {
  flex: 1;
  min-width: 0;
}

.device-img img,
.device-img video {
  width: 100%;
  display: block;
  border-radius: 6px;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.2));
}

.app-media-three {
  gap: 0;
  justify-content: center;
  align-items: center;
  padding: 2rem 0;
  position: relative;
}

.app-media-three .device-img {
  flex: 0 0 42%;
  transition: transform 0.4s ease, filter 0.4s ease, opacity 0.4s ease;
}

.app-media-three .device-img:nth-child(1) {
  margin-right: -10%;
  transform: rotate(-4deg) translateY(8px);
  z-index: 1;
}

.app-media-three .device-img:nth-child(2) {
  z-index: 3;
  transform: translateY(-8px) scale(1.04);
}

.app-media-three .device-img:nth-child(3) {
  margin-left: -10%;
  transform: rotate(4deg) translateY(8px);
  z-index: 1;
}

/* Blur + dim non-spotlight phones */
.app-media-three.cycling .device-img:not(.spotlight) {
  filter: blur(3px);
  opacity: 0.5;
}

/* Spotlight phone: center, big, sharp */
.app-media-three .device-img.spotlight {
  z-index: 10;
  filter: none;
  opacity: 1;
}

/* Left phone → center slot */
.app-media-three .device-img:nth-child(1).spotlight {
  transform: translateX(76%) scale(1.18) rotate(0deg) translateY(-8px);
}

/* Center phone stays in center slot */
.app-media-three .device-img:nth-child(2).spotlight {
  transform: scale(1.18) translateY(-8px);
}

/* Right phone → center slot */
.app-media-three .device-img:nth-child(3).spotlight {
  transform: translateX(-76%) scale(1.18) rotate(0deg) translateY(-8px);
}

/* === Swap non-spotlight phones into fan slots === */

/* Left phone spotlit: center → left fan, right stays */
.app-media-three:has(.device-img:nth-child(1).spotlight) .device-img:nth-child(2) {
  transform: translateX(-76%) rotate(-4deg) translateY(8px);
  z-index: 2;
}

.app-media-three:has(.device-img:nth-child(1).spotlight) .device-img:nth-child(3) {
  transform: rotate(4deg) translateY(8px);
  z-index: 2;
}

/* Center phone spotlit: left and right stay in fan slots */
.app-media-three:has(.device-img:nth-child(2).spotlight) .device-img:nth-child(1) {
  transform: rotate(-4deg) translateY(8px);
  z-index: 2;
}

.app-media-three:has(.device-img:nth-child(2).spotlight) .device-img:nth-child(3) {
  transform: rotate(4deg) translateY(8px);
  z-index: 2;
}

/* Right phone spotlit: center → right fan, left stays */
.app-media-three:has(.device-img:nth-child(3).spotlight) .device-img:nth-child(1) {
  transform: rotate(-4deg) translateY(8px);
  z-index: 2;
}

.app-media-three:has(.device-img:nth-child(3).spotlight) .device-img:nth-child(2) {
  transform: translateX(76%) rotate(4deg) translateY(8px);
  z-index: 2;
}

.app-media-three .device-img img {
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.35));
}

.app-screenshots {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

/* Placeholder for apps without screenshots yet */
.app-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-placeholder-inner {
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
}

.app-placeholder-inner svg {
  margin-bottom: 0.75rem;
}

/* Card content */
.app-card-content {
  padding: 0.5rem 0;
}

.app-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.app-card-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.app-badge {
  display: inline-block;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.app-desc {
  font-size: 1.05rem;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.app-features {
  list-style: none;
  margin-bottom: 1.75rem;
}

.app-features li {
  font-size: 0.95rem;
  color: var(--text-light);
  padding: 0.35rem 0;
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.5;
}

.app-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.app-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --- PWA Benefits --- */
.pwa-benefits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 3.5rem;
}

.pwa-benefit {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.pwa-benefit-icon {
  width: 56px;
  height: 56px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  color: var(--accent);
}

.pwa-benefit h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.pwa-benefit p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
}

/* --- Install Instructions --- */
.install-instructions {
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.install-tab-buttons {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.install-tab-btn {
  flex: 1;
  padding: 1rem;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  font-family: inherit;
}

.install-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(59, 130, 246, 0.04);
}

.install-tab-btn:hover:not(.active) {
  color: var(--text);
  background: var(--bg-alt);
}

.install-tab-content {
  display: none;
  padding: 1.5rem 2rem 2rem;
}

.install-tab-content.active {
  display: block;
}

.install-steps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.install-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.install-step-num {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.install-step strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.install-step p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* --- CTA --- */
.cta-box {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 0;
}

.cta-box h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.cta-box p {
  font-size: 1.05rem;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.cta-email {
  font-size: 0.9rem !important;
  margin-top: 1rem !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .apps-hero {
    padding: 6rem 0 2rem;
  }

  .apps-hero h1 {
    font-size: 2.25rem;
  }

  .app-card {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1.5rem;
  }

  .app-card:nth-child(even) {
    direction: ltr;
  }

  .app-media-showcase {
    flex-direction: column;
    align-items: center;
  }

  .app-media-three {
    flex-direction: row;
  }

  .app-screenshots {
    flex-direction: row;
  }

  .pwa-benefits {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .install-tab-content {
    padding: 1.25rem 1.25rem 1.5rem;
  }

  .app-card-header h2 {
    font-size: 1.4rem;
  }
}

@media (max-width: 480px) {
  .app-screenshots {
    flex-direction: column;
  }

  .app-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ========== Premium Services ========== */

.premium-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 700px;
  margin: 0 auto;
}

.premium-app-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
}

.premium-app-card:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
}

.premium-app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.premium-app-info {
  flex: 1;
  min-width: 0;
}

.premium-app-info h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: #1e293b;
}

.premium-app-info p {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.premium-app-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.premium-app-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
}

.premium-app-trial {
  font-size: 0.75rem;
  color: #3b82f6;
  font-weight: 600;
}

.premium-app-arrow {
  font-size: 1.2rem;
  color: #94a3b8;
  flex-shrink: 0;
}

/* ========== App Detail Modal ========== */

.app-detail-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}

.app-detail-overlay.active {
  opacity: 1;
  visibility: visible;
}

.app-detail-modal {
  background: white;
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.25s;
}

.app-detail-overlay.active .app-detail-modal {
  transform: translateY(0);
}

.app-detail-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-detail-close:hover { color: #1e293b; }

.app-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.app-detail-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.app-detail-header h2 {
  font-size: 1.4rem;
  margin-bottom: 0.2rem;
}

.app-detail-pricing {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-detail-price {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.app-detail-trial {
  font-size: 0.8rem;
  color: #3b82f6;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.08);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.app-detail-desc {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.app-detail-features-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #1e293b;
}

.app-detail-features {
  list-style: none;
  padding: 0;
  margin-bottom: 1.5rem;
}

.app-detail-features li {
  font-size: 0.85rem;
  color: #475569;
  padding: 0.35rem 0;
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.4;
}

.app-detail-features li::before {
  content: '\2713';
  color: #22c55e;
  font-weight: 700;
  position: absolute;
  left: 0;
}

.app-detail-cta {
  display: block;
  text-align: center;
  padding: 0.85rem;
  font-size: 1rem;
  border-radius: 12px;
  text-decoration: none;
}

.app-detail-note {
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.75rem;
}

@media (max-width: 600px) {
  .premium-app-card {
    flex-direction: column;
    text-align: center;
  }
  .premium-app-meta { justify-content: center; }
  .premium-app-arrow { display: none; }
  .app-detail-modal { padding: 1.5rem; }
  .app-detail-header { flex-direction: column; text-align: center; }
}
