:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-solid: #121826;
  --bg-card-hover: #1a2234;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(59, 130, 246, 0.4);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --accent-gradient-orange: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --success: #10b981;
  --danger: #ef4444;
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 35px -5px rgba(59, 130, 246, 0.25);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Background Glow */
.background-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.glow-1 {
  width: 450px;
  height: 450px;
  top: -100px;
  left: 10%;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
}
.glow-2 {
  width: 500px;
  height: 500px;
  top: 30%;
  right: 5%;
  background: radial-gradient(circle, #8b5cf6, transparent 70%);
}

/* Header */
.header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(12px);
}
.header-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-icon {
  background: var(--accent-gradient);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.logo-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}

/* Navigation Tabs in Header */
.nav-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
}
.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.nav-tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}
.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}
.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: var(--text-primary);
}

/* Main Container */
.main-container {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
  position: relative;
  z-index: 5;
}

.view-content {
  animation: fadeIn 0.25s ease;
}

/* Hero */
.hero-section {
  text-align: center;
  margin-bottom: 2rem;
}
.hero-title {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.6rem;
  line-height: 1.2;
}
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}
kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* Dropzone */
.upload-section {
  margin-bottom: 2.5rem;
}
.dropzone, .conv-dropzone {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.dropzone:hover, .dropzone.dragover, .conv-dropzone:hover, .conv-dropzone.dragover {
  border-color: var(--accent-primary);
  background: rgba(26, 34, 52, 0.85);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
  transform: scale(1.003);
}
.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}
.upload-icon-wrapper {
  width: 68px;
  height: 68px;
  margin: 0 auto 1.25rem;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  transition: transform 0.2s ease;
}
.conv-icon {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}
.dropzone:hover .upload-icon-wrapper, .conv-dropzone:hover .upload-icon-wrapper {
  transform: translateY(-4px);
}
.dropzone-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.dropzone-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}
.dropzone-hint {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.hint-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.font-highlight {
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.08);
  font-weight: 600;
}

/* Converter Card & Controls */
.converter-section {
  margin-bottom: 2.5rem;
}
.converter-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}
.conv-dropzone {
  margin-bottom: 1.5rem;
  padding: 2.5rem 1.5rem;
}
.conv-preview-wrap {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.conv-video {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #000;
}
.conv-video-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}
.conv-video-name {
  font-weight: 600;
  color: var(--text-primary);
}
.conv-video-size {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.conv-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.setting-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-select {
  background: #0b0f19;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.form-select:focus {
  border-color: var(--accent-primary);
}
.conv-actions {
  display: flex;
  justify-content: center;
}
.conv-progress-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Upload Progress Overlay */
.upload-progress-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 20;
  border-radius: var(--radius-lg);
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1.25rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.progress-info {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 380px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.progress-percent {
  font-family: var(--font-mono);
  color: var(--accent-primary);
  font-weight: 600;
}
.progress-bar-container {
  width: 100%;
  max-width: 380px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  transition: width 0.15s ease;
}

/* Results Section */
.results-section, .history-section {
  margin-bottom: 3rem;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.section-title {
  font-size: 1.35rem;
  font-weight: 700;
}
.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.badge-count {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
}
.results-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Result Card */
.result-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-media {
  position: relative;
  background: #06090f;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  max-height: 240px;
}
.result-media img, .result-media video {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.media-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.result-filename {
  font-weight: 600;
  font-size: 1rem;
  word-break: break-all;
}
.result-size {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* Link formats */
.link-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}
.link-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.link-tab.active {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.12);
}

.link-box {
  display: flex;
  gap: 0.5rem;
  background: #06090f;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  align-items: center;
}
.link-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}
.btn-copy-direct {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-copy-direct:hover {
  background: var(--accent-primary-hover);
}
.btn-copy-direct.copied {
  background: var(--success);
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  align-items: center;
  flex-wrap: wrap;
}
.btn-open-link {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.btn-open-link:hover {
  color: var(--text-primary);
}
.btn-convert-card {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-convert-card:hover {
  background: rgba(139, 92, 246, 0.3);
  color: white;
}
.btn-delete-link {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-decoration: none;
  margin-left: auto;
}
.btn-delete-link:hover {
  color: var(--danger);
}

/* History Grid */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}
.history-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.history-thumb {
  height: 130px;
  background: #06090f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.history-thumb img, .history-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.history-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.history-name {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
}
.history-copy-btn:hover {
  background: var(--accent-primary);
  color: white;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: var(--text-primary);
}
.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}
.modal-body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #93c5fd;
}
.code-box {
  background: #06090f;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.btn-copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}
.btn-copy-code:hover {
  color: white;
  background: var(--accent-primary);
}
.modal-list {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  border: 1px solid var(--success);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  animation: toastIn 0.25s ease;
}
.toast-icon {
  color: var(--success);
  font-weight: bold;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
  position: relative;
  z-index: 5;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 0.75rem;
  }
  .result-card {
    grid-template-columns: 1fr;
  }
  .hero-title {
    font-size: 1.75rem;
  }
  .dropzone, .conv-dropzone {
    padding: 2rem 1rem;
  }
  .conv-settings-grid {
    grid-template-columns: 1fr;
  }
}