/* ==============================================================================
   T-Movie Downloader - Modern Dark & Neon Theme
   ============================================================================== */
:root {
  --bg-primary: #0b0e14;
  --bg-secondary: #131722;
  --bg-card: #181d2c;
  --bg-card-hover: #1e2436;
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --accent-cyan: #00f0ff;
  --accent-pink: #ff2a85;
  --accent-gold: #ffbe0b;
  --accent-green: #05ffa1;
  --accent-purple: #9d4edd;
  --border-color: #272f44;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Header */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 32px;
}

.logo-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ff7b54, #ff2a85, #00f0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  gap: 10px;
}

.nav-btn {
  background: #1e2436;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.nav-btn:hover {
  color: var(--text-main);
  border-color: #3b4564;
}

.nav-btn.active {
  background: #00f0ff22;
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.nav-btn .badge {
  background: var(--accent-pink);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
}

/* Search Section */
.search-section {
  margin-bottom: 24px;
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 6px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s;
}

.search-box-wrapper:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}

.search-icon {
  font-size: 18px;
  color: var(--text-muted);
  margin-left: 8px;
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 16px;
  padding: 12px 14px;
  outline: none;
}

#searchInput::placeholder {
  color: #555f77;
}

.search-action-btn {
  background: linear-gradient(135deg, #00f0ff, #0077ff);
  border: none;
  color: #0b0e14;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.search-action-btn:hover {
  opacity: 0.9;
}

.search-tips {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
}

.tip-badge {
  color: #70d6ff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.tag-btn {
  background: #181d2c;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-btn:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 60px 20px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #1e2436;
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Results Section */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.results-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.results-header span {
  font-size: 13px;
  color: var(--text-muted);
}

.movies-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Movie Card */
.movie-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, border-color 0.2s;
}

.movie-card:hover {
  border-color: #3f4c6e;
}

.poster-box {
  width: 140px;
  height: 205px;
  border-radius: 8px;
  overflow: hidden;
  background: #10141f;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rating-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(11, 14, 20, 0.85);
  color: var(--accent-gold);
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.movie-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.title-area h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 2px;
}

.title-area .ko-title {
  color: var(--accent-cyan);
  margin-right: 6px;
}

.meta-tags-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.genres-pill {
  background: #232a3d;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #adb5bd;
}

.summary-text {
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.45;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Subtitle Badges */
.subtitle-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 6px 12px;
  background: #111520;
  border-radius: 8px;
  border: 1px solid #1f2738;
}

.sub-tag {
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sub-tag.available {
  color: var(--accent-green);
}

.sub-tag.unavailable {
  color: #64748b;
}

/* Torrent Resolution Selector */
.torrents-box {
  background: #121622;
  border: 1px solid #20273a;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.torrent-select-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.torrent-options-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.torrent-btn {
  background: #1c2335;
  border: 1px solid #2d3852;
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.torrent-btn:hover {
  border-color: #4b5b82;
}

.torrent-btn.selected {
  background: #00f0ff1a;
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

.torrent-btn.is-4k {
  border-color: #ffbe0b55;
}

.torrent-btn.is-4k.selected {
  background: #ffbe0b22;
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.quality-tag {
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
}

.q-1080p {
  background: #00b4d8;
  color: #0b0e14;
}

.q-2160p {
  background: var(--accent-gold);
  color: #0b0e14;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.download-package-btn {
  background: linear-gradient(135deg, #ff2a85, #ff7b54);
  border: none;
  color: white;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(255, 42, 133, 0.3);
  transition: transform 0.1s, opacity 0.2s;
}

.download-package-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.download-package-btn:disabled {
  background: #333d54;
  color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 36px 24px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-card h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

.empty-card p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Library View */
.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.library-header h2 {
  font-size: 20px;
  font-weight: 800;
}

.library-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.library-header .subtitle code {
  color: var(--accent-cyan);
}

.refresh-btn {
  background: #1e2436;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.library-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lib-info h4 {
  font-size: 15px;
  font-weight: 700;
  color: #f0f6fc;
  margin-bottom: 4px;
}

.lib-badges {
  display: flex;
  gap: 8px;
  font-size: 11px;
}

.lib-pill {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.pill-green {
  background: #05ffa122;
  color: var(--accent-green);
  border: 1px solid #05ffa144;
}

.pill-blue {
  background: #00f0ff22;
  color: var(--accent-cyan);
  border: 1px solid #00f0ff44;
}

.pill-orange {
  background: #ff7b5422;
  color: #ff7b54;
  border: 1px solid #ff7b5444;
}

.open-folder-btn {
  background: #252e44;
  border: 1px solid #3d4b6e;
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.open-folder-btn:hover {
  background: var(--accent-cyan);
  color: #0b0e14;
  border-color: var(--accent-cyan);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #181d2c;
  color: #f0f6fc;
  border: 1px solid var(--accent-cyan);
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-size: 13.5px;
  font-weight: 600;
  z-index: 1000;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

/* Active Downloads Styles */
.badge-active {
  background: var(--accent-cyan);
  color: #0b0e14;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.active-torrent-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}

.active-torrent-card:hover {
  border-color: var(--accent-cyan);
}

.active-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.active-title {
  font-size: 15px;
  font-weight: 700;
  color: #f0f6fc;
}

.active-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #252e44;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f0ff, #05ffa1);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-fill.completed {
  background: #05ffa1;
}

.active-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

.state-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.state-downloading {
  background: #00f0ff22;
  color: var(--accent-cyan);
  border: 1px solid #00f0ff44;
}

.state-completed {
  background: #05ffa122;
  color: var(--accent-green);
  border: 1px solid #05ffa144;
}

.hidden {
  display: none !important;
}

