:root {
  --bg-color: #050505;
  --surface-color: #121212;
  --surface-hover: #1e1e1e;
  --border-color: #27272a;
  --primary-color: #e11d48;
  --primary-hover: #be123c;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --success-color: #22c55e;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  color: var(--primary-color);
  background: rgba(225, 29, 72, 0.1);
  padding: 8px;
  border-radius: var(--radius-md);
  display: flex;
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.025em;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 40px 0;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 12px;
  background: linear-gradient(to right, #fff, #a1a1aa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0 0 32px;
}

/* Search Box */
.search-box {
  max-width: 600px;
  margin: 0 auto;
}

.input-group {
  display: flex;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px;
  transition: border-color 0.2s;
}

.input-group:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.2);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 1rem;
  outline: none;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.search-btn:hover {
  background: var(--primary-hover);
}

/* Result Card */
.result-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

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

.video-meta {
  padding: 24px;
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border-color);
}

.thumb-wrapper {
  position: relative;
  flex-shrink: 0;
  width: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}

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

.duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.meta-info h3 {
  margin: 0 0 8px;
  font-size: 1.125rem;
  line-height: 1.4;
}

.channel-name {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.875rem;
}

/* Tabs */
.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0,0,0,0.2);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 16px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.02);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: rgba(225, 29, 72, 0.05);
}

/* Download Table */
.tab-content {
  padding: 0;
}

.download-table {
  width: 100%;
}

.table-header {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr;
  padding: 12px 24px;
  background: rgba(0,0,0,0.2);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-body .table-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr;
  padding: 16px 24px;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.table-body .table-row:last-child {
  border-bottom: none;
}

.table-body .table-row:hover {
  background: var(--surface-hover);
}

.col-type {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.quality-text {
  color: var(--text-primary);
}

.badge-bitrate, .badge-hd {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--border-color);
  color: var(--text-secondary);
}

.badge-hd {
  background: rgba(225, 29, 72, 0.2);
  color: var(--primary-color);
  font-weight: 700;
}

.col-size {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.format-badge {
  text-transform: uppercase;
  font-size: 0.75rem;
  background: #27272a;
  padding: 2px 6px;
  border-radius: 4px;
}

.col-action {
  text-align: right;
  display: flex;
  justify-content: flex-end;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-color);
  color: #000;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: filter 0.2s;
}

.btn-download:hover {
  filter: brightness(1.1);
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

/* Loader */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Feedback Toast */
.feedback-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 100;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Footer */
.footer {
  padding: 24px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.hidden {
  display: none !important;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .hero-title {
    font-size: 1.5rem;
  }
  
  .video-meta {
    flex-direction: column;
    padding: 16px;
  }
  
  .thumb-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
  }
  
  .search-btn span {
    display: none;
  }
  
  .search-btn {
    padding: 10px;
  }
  
  .table-header, .table-body .table-row {
    grid-template-columns: 1fr 0.8fr 1fr;
    padding: 12px 16px;
    gap: 8px;
  }
  
  .col-type {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  
  .btn-download {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .btn-download svg {
    display: none;
  }
}
