/* APOD Gallery & Details Specific Styles */
.apod-hero { position: relative; min-height: 55dvh; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.apod-bg { position: absolute; inset: 0; background-color: #0a0e1a; }
.apod-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; opacity: 1; }
.apod-bg-shimmer { position: absolute; inset: 0; background-color: #05070a33; z-index: 0; }

.apod-content { 
  position: relative; z-index: 2; padding: 20px 20px 24px; 
  background: linear-gradient(to top, rgba(8,11,18,0.95) 0%, rgba(8,11,18,0.4) 50%, rgba(8,11,18,0) 100%);
}
.apod-meta-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.apod-label { display: flex; align-items: center; gap: 6px; font-family: var(--fn-mono); font-size: 11px; letter-spacing: 1.5px; color: #ffffff; }
.apod-label-dot { width: 5px; height: 5px; border-radius: 50%; background: #249ef2; }
.apod-date { font-family: var(--fn-mono); font-size: 11px; color: #ffffff; }
.apod-title { font-family: var(--fn-display); font-size: clamp(26px, 6vw, 38px); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; color: var(--text); margin-bottom: 14px; }
.apod-excerpt { font-size: 14px; color: rgba(238,241,248,0.65); line-height: 1.7; font-weight: 300; margin-bottom: 24px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-clamp: 3; }
.apod-actions { display: flex; gap: 10px; }
.btn-read { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; background: var(--accent); color: #080b12; font-weight: 700; font-size: 14px; border-radius: 10px; text-decoration: none; border: none; transition: all 0.2s; }
.btn-hd { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 13px 18px; background: transparent; color: var(--text); font-weight: 500; font-size: 14px; border-radius: 10px; text-decoration: none; border: 1px solid var(--border-hi); transition: all 0.2s; }



.hero-video-wrapper { position: absolute; inset: 0; background: black; }
.hero-video-wrapper iframe { width: 100%; height: 100%; border: none; }

@media (min-width: 1100px) {
  .apod-content { padding: 40px 40px 48px; max-width: 600px; }
  .apod-title { font-size: clamp(32px, 4vw, 52px); }
  .apod-excerpt { -webkit-line-clamp: 4; line-clamp: 4; }
}

/* APOD Explorer Specific */
.apod-explorer { min-height: 100vh; animation: fadeIn 0.6s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.apod-nav-bar { background: rgba(14, 20, 32, 0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 12px 20px; position: relative; z-index: 80; }
.apod-nav-container { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }

.apod-search-box { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 12px; }
.search-icon { color: var(--muted); font-size: 14px; margin-right: 8px; }
.apod-search-box input { background: transparent; border: none; color: white; padding: 8px 0; font-family: var(--fn-mono); font-size: 13px; width: 100%; outline: none; color-scheme: dark; cursor: pointer; }
.btn-search { background: var(--accent); color: var(--bg); border: none; padding: 6px 16px; border-radius: 6px; font-weight: 700; font-size: 12px; cursor: pointer; transition: opacity 0.2s; }
.btn-search:hover { opacity: 0.9; }

.apod-nav-actions { display: flex; gap: 8px; }
.btn-nav-action { flex: 1; text-align: center; padding: 10px 16px; border-radius: 8px; background: var(--surface-hi); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 500; transition: all 0.2s; }
.btn-nav-action:hover { border-color: var(--accent); }
.btn-nav-action.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

@media (min-width: 768px) {
  .apod-nav-container { flex-direction: row; align-items: center; justify-content: space-between; }
  .apod-search-box { width: 320px; }
  .apod-nav-actions { width: auto; }
  .btn-nav-action { flex: none; }
}

/* Detail View */
.apod-detail-view { background-size: cover; background-position: center; padding: 60px 20px; min-height: 80vh; display: flex; align-items: center; }
.apod-detail-container { max-width: 1100px; margin: 0 auto; width: 100%; }
.apod-detail-card { background: rgba(14, 20, 32, 0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--border-hi); border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 40px 100px rgba(0,0,0,0.6); }
.apod-detail-img-box { width: 100%; cursor: zoom-in; }
.apod-detail-img-box img { width: 100%; height: auto; display: block; max-height: 70vh; object-fit: contain; }
.apod-detail-info { padding: 32px; }
.apod-detail-date { font-family: var(--fn-mono); font-size: 12px; color: var(--accent); letter-spacing: 2px; margin-bottom: 12px; }
.apod-detail-title { font-family: var(--fn-display); font-size: clamp(24px, 5vw, 42px); line-height: 1.1; margin-bottom: 24px; }
.apod-detail-text { color: rgba(238,241,248,0.85); line-height: 1.8; font-size: 16px; font-weight: 300; margin-bottom: 32px; }
.apod-detail-copyright { font-family: var(--fn-mono); font-size: 11px; color: var(--muted); margin-bottom: 32px; padding-top: 16px; border-top: 1px solid var(--border); }
.apod-detail-btns { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-action-primary { background: var(--accent); color: var(--bg); border: none; padding: 14px 28px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer; transition: all 0.2s; }
.btn-action-secondary { background: var(--surface-hi); color: var(--text); border: 1px solid var(--border); padding: 14px 24px; border-radius: 12px; font-weight: 500; font-size: 14px; text-decoration: none; transition: all 0.2s; }
.btn-action-primary:hover, .btn-action-secondary:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.3); }

.apod-share-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.share-btn { 
  background: var(--surface-hi); color: var(--text); border: 1px solid var(--border); 
  padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; text-decoration: none; 
  display: flex; align-items: center; gap: 6px; transition: all 0.2s;
}
.share-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.share-btn.fb { color: #1877f2; }
.share-btn.x { color: #ffffff; }
.share-btn.rd { color: #ff4500; }

@media (max-width: 767px) {
  .apod-detail-info { padding: 24px 20px; }
  .apod-detail-btns { gap: 8px; }
  .btn-action-primary, .btn-action-secondary { padding: 10px 16px; font-size: 13px; border-radius: 10px; flex: 1; text-align: center; }
  .apod-share-bar { gap: 6px; }
  .share-btn { padding: 8px 10px; font-size: 11px; flex: 1; justify-content: center; }
}

/* Gallery View */
.apod-gallery-view { padding: 60px 20px; }
.gallery-container { max-width: 1200px; margin: 0 auto; }
.gallery-title { font-family: var(--fn-display); font-size: 28px; margin-bottom: 40px; text-align: center; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.gallery-item { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; text-decoration: none; color: inherit; transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1); }
.gallery-item:hover { transform: translateY(-8px); border-color: var(--accent-glow); box-shadow: 0 20px 40px rgba(0,0,0,0.4); }
.gallery-img-box { height: 200px; overflow: hidden; position: relative; }
.gallery-img-box img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.gallery-item:hover .gallery-img-box img { transform: scale(1.1); }
.gallery-info { padding: 16px; }
.gallery-date { font-family: var(--fn-mono); font-size: 11px; color: var(--accent); margin-bottom: 6px; }
.gallery-title-sm { font-size: 14px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-clamp: 2; }

@media (min-width: 768px) {
  .apod-detail-card { flex-direction: row; }
  .apod-detail-img-box { width: 50%; border-right: 1px solid var(--border-hi); }
  .apod-detail-info { width: 50%; padding: 48px; display: flex; flex-direction: column; justify-content: center; }
}

.img-skeleton { position: absolute; inset: 0; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hi) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; transition: opacity 0.3s; z-index: 1; }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
.gallery-img-box img { opacity: 0; transition: opacity 0.5s; position: relative; z-index: 2; }
.gallery-img-box img.loaded { opacity: 1; }
.gallery-img-box img.loaded + .img-skeleton { opacity: 0; pointer-events: none; }

.video-play-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 3; font-size: 40px; color: white; background: rgba(0,0,0,0.2); pointer-events: none; text-shadow: 0 0 20px rgba(0,0,0,0.5); }
.video-container { position: relative; width: 100%; aspect-ratio: 16/9; background: black; }
.video-container iframe, .video-container video { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

.gallery-load-more { margin-top: 60px; display: flex; justify-content: center; }
.btn-load-more { background: var(--surface-hi); border: 1px solid var(--border); color: var(--text); padding: 16px 32px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; transition: all 0.2s; min-width: 220px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.btn-load-more:hover { border-color: var(--accent); transform: translateY(-2px); }
.btn-load-more.loading .btn-text { opacity: 0.5; }
.btn-load-more.loading .btn-loader { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.1); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
