/* ==========================================================================
   ShortDramas Components - Cards, Buttons, Chips, Modals & Sheets
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 18px rgba(255, 45, 85, 0.4);
}
.btn-primary:hover {
  background: var(--brand-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(255, 45, 85, 0.55);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(10px);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.btn-gold {
  background: var(--vip-gradient);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(255, 184, 0, 0.35);
}
.btn-gold:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-outline {
  border: 1px solid var(--line-light);
  color: var(--text-main);
  background: transparent;
}
.btn-outline:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.btn-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
}
.btn-icon-circle:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.08);
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 16px;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .title-icon {
  font-size: 18px;
}

.section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.section-link:hover {
  color: var(--accent-pink);
}

/* Grids */
.drama-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px;
}

@media (max-width: 768px) {
  .drama-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* Standard Drama Card */
.drama-card {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line-subtle);
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s, border-color 0.28s;
}

.drama-card:hover {
  transform: translateY(-6px);
  border-color: var(--line-highlight);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.card-poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: #191c28;
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.drama-card:hover .card-poster {
  transform: scale(1.05);
}

.card-top-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand-gradient);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.card-top-badge.rank-1 {
  background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
  color: #000;
}

.card-top-badge.rank-2 {
  background: linear-gradient(135deg, #e6e6e6 0%, #a8a8a8 100%);
  color: #000;
}

.card-top-badge.rank-3 {
  background: linear-gradient(135deg, #cd7f32 0%, #a0522d 100%);
  color: #fff;
}

.card-rating-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  color: #ffd043;
  display: flex;
  align-items: center;
  gap: 3px;
}

.card-body {
  padding: 10px 12px 14px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Continue Watching Card */
.continue-shelf {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
}
.continue-shelf::-webkit-scrollbar {
  height: 4px;
}

.continue-card {
  flex: 0 0 clamp(220px, 25vw, 300px);
  scroll-snap-align: start;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line-subtle);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.continue-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-highlight);
}

.continue-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #191c28;
}

.continue-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.continue-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.continue-card:hover .continue-play-overlay {
  opacity: 1;
}

.play-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 45, 85, 0.5);
}

.progress-bar {
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.2);
}

.progress-fill {
  height: 100%;
  background: var(--accent-pink);
}

.continue-info {
  padding: 10px 12px;
}

.continue-title {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Top 10 Card - Completely uniform dimensions for all 10 items */
.top10-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 26px 20px;
  align-items: stretch;
}

@media (max-width: 1200px) {
  .top10-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .top10-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

.top10-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding-left: 36px;
}

.top10-card:hover {
  transform: translateY(-6px);
}

.top10-rank-num {
  position: absolute;
  left: 0;
  bottom: 0;
  font-size: clamp(64px, 5.5vw, 100px);
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: -4px;
  color: transparent;
  -webkit-text-stroke: 3px rgba(255, 255, 255, 0.32);
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  user-select: none;
  z-index: 1;
  pointer-events: none;
  transition: color 0.2s, -webkit-text-stroke 0.2s;
}

.top10-card:hover .top10-rank-num {
  color: rgba(255, 45, 85, 0.25);
  -webkit-text-stroke-color: var(--accent-pink);
}

.top10-poster-box {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line-subtle);
  background: #191c28;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 2;
}

.top10-poster-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top10-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 10px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent);
  color: #fff;
}

.top10-meta-title {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top10-meta-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Chips & Pills */
.filter-pills-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 24px;
}
.filter-pills-row::-webkit-scrollbar {
  display: none;
}

.pill-item {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-subtle);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.pill-item.active {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 45, 85, 0.35);
}

/* Modals & Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.modal-backdrop.open {
  display: flex;
  opacity: 1;
}

.modal-dialog {
  width: min(540px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-backdrop.open .modal-dialog {
  transform: translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Missing Section & Utility Classes */
.section-container {
  margin-bottom: 32px;
}

.mode-toggle-chip {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-full);
}

.remove-fav-btn {
  color: var(--accent-pink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.remove-fav-btn:hover {
  text-decoration: underline;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-dialog {
    width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
  }
  .modal-backdrop.open .modal-dialog {
    transform: translateY(0);
  }

  .top10-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 12px;
  }
  .top10-card {
    padding-left: 28px;
  }
  .top10-rank-num {
    font-size: 64px;
    letter-spacing: -2px;
  }
}
