:root {
  --bg-color: #0f172a;               /* Nền tối sâu */
  --glass-bg: rgba(30, 41, 59, 0.7); /* Kính mờ */
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;           /* Xanh dương nhạt */
  --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6); /* Gradient xanh-tím */
  --danger-color: #ef4444;
  --success-color: #10b981;
  --font-family: 'Inter', sans-serif;
  
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* --- Animated Blobs Background --- */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.5;
  animation: float 10s infinite alternate ease-in-out;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: #3b82f6;
  top: -10%;
  left: -10%;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: #8b5cf6;
  bottom: -20%;
  right: -10%;
  animation-delay: -5s;
}

@keyframes float {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(50px) scale(1.1); }
}

/* --- Main Layout --- */
.container {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  z-index: 10;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 3rem;
  animation: slideDown 0.6s ease-out;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--accent-gradient);
  border-radius: 16px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.logo .material-icons-outlined {
  font-size: 36px;
  color: white;
}

.gradient-text {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.8s ease-out;
}

/* Search Box */
#download-form {
  display: flex;
  gap: 1rem;
}

.input-wrapper {
  flex-grow: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .icon {
  position: absolute;
  left: 1rem;
  color: var(--text-secondary);
}

#url-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

#url-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Loading State */
.loading-state {
  text-align: center;
  margin-top: 3rem;
  color: var(--text-secondary);
  animation: fadeIn 0.3s;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

/* Error State */
.error-state {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  border-left: 4px solid var(--danger-color);
  color: #fca5a5;
}

.error-icon {
  font-size: 28px;
  color: var(--danger-color);
}

/* --- Results Section --- */
.result-container {
  margin-top: 2rem;
  animation: slideUp 0.5s ease-out;
}

.video-info {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.video-thumb-placeholder {
  width: 160px;
  height: 90px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.video-details h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-details .meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.meta-item .material-icons-outlined {
  font-size: 16px;
}

/* Links Table */
.links-table {
  width: 100%;
  border-collapse: collapse;
}

.links-table th, .links-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.links-table th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.links-table tr:last-child td {
  border-bottom: none;
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-weight: 500;
}

.badge-video { color: var(--accent-color); }
.badge-audio { color: var(--success-color); }

.size-text {
  color: var(--text-secondary);
  font-family: monospace;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-color);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn-download:hover {
  background: var(--accent-color);
  color: white;
}

.copy-cmd-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.6rem;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.btn-copy {
  background: none;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
}
.btn-copy:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* Utils */
.hidden { display: none !important; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
  #download-form { flex-direction: column; }
  .btn-primary { width: 100%; justify-content: center; }
  .video-info { flex-direction: column; }
  .video-thumb-placeholder { width: 100%; height: 180px; }
  .links-table th, .links-table td { padding: 0.8rem 0.5rem; font-size: 0.9rem; }
}
