/* ==========================================================================
   TRUNG TÂM CÀO TRUYỆN (SCRAPER CONTROL CENTER) - iOS NATIVE STYLES
   ========================================================================== */

/* Main Container */
.scraper-hub-view {
  min-height: 100vh;
  background-color: var(--ios-bg, #F2F2F7);
  padding-bottom: calc(90px + var(--safe-bottom));
}

/* Header */
.scraper-hub-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--ios-separator, #E5E5EA);
  padding: max(12px, var(--safe-top)) 16px 10px 16px;
}

.scraper-hub-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.scraper-hub-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1C1C1E;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scraper-hub-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
}

.scraper-hub-status-pill.online {
  background: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
}

.scraper-hub-status-pill.offline {
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
}

.status-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Top Filter Pills (4 Smart Modes) */
.scraper-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 2px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.scraper-filter-bar::-webkit-scrollbar {
  display: none;
}

.scraper-filter-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 99px;
  background: #E5E5EA;
  color: #6E6E73;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.scraper-filter-pill.active {
  background: #1C1C1E;
  color: #FFFFFF;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.scraper-pill-badge {
  background: rgba(255, 255, 255, 0.25);
  color: inherit;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 800;
}

.scraper-filter-pill:not(.active) .scraper-pill-badge {
  background: #D1D1D6;
  color: #3A3A3C;
}

/* Master Sticky Top Buttons */
.sticky-master-container {
  padding: 12px 16px 4px 16px;
}

.master-action-btn {
  width: 100%;
  padding: 13px 18px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.28);
  transition: transform 0.15s, opacity 0.15s;
}

.master-action-btn:active {
  transform: scale(0.98);
}

.master-btn-orange {
  background: linear-gradient(135deg, #EA580C 0%, #F59E0B 100%);
  color: #FFFFFF;
}

.master-btn-blue {
  background: linear-gradient(135deg, #007AFF 0%, #2563EB 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.28);
}

/* Card Lists */
.scraper-list-content {
  padding: 8px 16px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Incomplete Card */
.scraper-item-card {
  background: #FFFFFF;
  border-radius: 18px;
  padding: 14px;
  border: 1px solid var(--ios-separator, #E5E5EA);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scraper-card-top-row {
  display: flex;
  gap: 12px;
}

.scraper-card-cover {
  width: 60px;
  height: 82px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.scraper-card-meta {
  flex: 1;
  min-width: 0;
}

.scraper-card-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #1C1C1E;
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scraper-card-chinese-title {
  font-size: 0.72rem;
  color: #8E8E93;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scraper-card-author-pill {
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 600;
  color: #6E6E73;
  background: #F2F2F7;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Incomplete Progress Bar */
.scraper-progress-container {
  background: #F9FAFB;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid #F3F4F6;
}

.scraper-progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.scraper-stopped-label {
  color: #EA580C;
}

.scraper-reason-text {
  font-size: 0.68rem;
  color: #DC2626;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Buttons in Card */
.scraper-card-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.scraper-btn-primary {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  background: #007AFF;
  color: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: opacity 0.15s;
}

.scraper-btn-secondary {
  padding: 9px 12px;
  border-radius: 10px;
  background: #F2F2F7;
  color: #1C1C1E;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #E5E5EA;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Ongoing Updates Card */
.scraper-update-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ECFDF5;
  color: #059669;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #A7F3D0;
}

.scraper-scan-time {
  font-size: 0.7rem;
  color: #8E8E93;
}

/* Genre Selector Chips */
.scraper-genre-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 16px;
  scrollbar-width: none;
}

.scraper-genre-chips-scroll::-webkit-scrollbar {
  display: none;
}

.scraper-genre-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 99px;
  background: #FFFFFF;
  border: 1px solid #E5E5EA;
  color: #3A3A3C;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.scraper-genre-chip.active {
  background: #EA580C;
  color: #FFFFFF;
  border-color: #EA580C;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

/* Rank Badges (Top China) */
.top-china-subtabs {
  display: flex;
  padding: 6px 16px;
  gap: 8px;
  overflow-x: auto;
}

.top-china-subtab-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 8px;
  background: #E5E5EA;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: #6E6E73;
  cursor: pointer;
}

.top-china-subtab-btn.active {
  background: #1C1C1E;
  color: #FFFFFF;
}

.rank-badge-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: #FFFFFF;
  flex-shrink: 0;
}

.rank-badge-1 {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.rank-badge-2 {
  background: linear-gradient(135deg, #94A3B8 0%, #64748B 100%);
}

.rank-badge-3 {
  background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
}

.rank-badge-other {
  background: #CBD5E1;
  color: #475569;
}

.synopsis-clamp {
  font-size: 0.75rem;
  color: #6E6E73;
  line-height: 1.4;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* REAL-TIME SCRAPING PROGRESS DRAWER */
.scraper-progress-drawer {
  position: fixed;
  bottom: calc(65px + var(--safe-bottom));
  left: 12px;
  right: 12px;
  max-width: 456px;
  margin: 0 auto;
  background: rgba(28, 28, 30, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  color: #FFFFFF;
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  z-index: 150;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: none;
  animation: slideUpDrawer 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.scraper-progress-drawer.show {
  display: block;
}

@keyframes slideUpDrawer {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.drawer-top-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.drawer-pulse-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #FBBF24;
}

.drawer-speed-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 7px;
  border-radius: 6px;
}

.drawer-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}

.drawer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F59E0B 0%, #EA580C 100%);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.drawer-subtext {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Studio Entry Banner */
.scraper-hub-banner {
  background: linear-gradient(135deg, #1C1C1E 0%, #2C2C2E 100%);
  color: #FFFFFF;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.15s;
}

.scraper-hub-banner:active {
  transform: scale(0.98);
}

.scraper-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scraper-hub-icon-glow {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #EA580C 0%, #F59E0B 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.4);
}

.scraper-banner-title {
  font-size: 0.95rem;
  font-weight: 800;
}

.scraper-banner-sub {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.scraper-hub-cta-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* Trial Button */
.scraper-btn-trial {
  padding: 7px 12px;
  border-radius: 10px;
  background: #EEF2FF;
  color: #4F46E5;
  border: 1px solid #C7D2FE;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.scraper-btn-trial:active {
  transform: scale(0.96);
  background: #E0E7FF;
}

/* Trial Player Drawer */
.trial-player-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #FFFFFF;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -12px 45px rgba(0, 0, 0, 0.28);
  z-index: 210;
  border-top: 1px solid #E5E5EA;
  padding: 12px 16px max(18px, var(--safe-bottom)) 16px;
  display: none;
  animation: slideUpTrial 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.trial-player-drawer.active {
  display: block;
}

@keyframes slideUpTrial {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.trial-drawer-handle {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: #D1D1D6;
  margin: 0 auto 10px auto;
}

.trial-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F2F2F7;
}

.trial-drawer-cover {
  width: 46px;
  height: 62px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.trial-drawer-info {
  flex: 1;
  min-width: 0;
}

.trial-drawer-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #1C1C1E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trial-drawer-sub {
  font-size: 0.72rem;
  color: #4F46E5;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.trial-drawer-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #4F46E5;
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s;
}

.trial-drawer-play-btn:active {
  transform: scale(0.92);
}

.trial-reader-box {
  max-height: 210px;
  overflow-y: auto;
  background: #F8FAFC;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid #E2E8F0;
  margin-bottom: 12px;
  font-family: "Merriweather", "Noto Serif", Georgia, serif;
}

.trial-paragraph {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #334155;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.25s ease;
}

.trial-paragraph.karaoke-active {
  background: #FEF3C7;
  color: #78350F;
  border-left: 3px solid #F59E0B;
  font-weight: 600;
}

.trial-promote-btn {
  width: 100%;
  padding: 13px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #DC2626 0%, #EA580C 100%);
  color: #FFFFFF;
  font-size: 0.92rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.32);
  transition: transform 0.15s;
}

.trial-promote-btn:active {
  transform: scale(0.98);
}

