/* ===== Font ===== */
@font-face {
  font-family: 'Supreme';
  src: url('/fonts/Supreme-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ===== CSS Variables - Light Theme ===== */
:root {
  --color-primary: #014f99;
  --color-primary-hover: #003971;
  --color-secondary: #c9984d;
  --color-secondary-hover: #b58842;
  --color-text: #003971;
  --color-text-secondary: #4a6a8a;
  --color-text-muted: #6b7d92;
  --color-background: #F5F4D6;
  --color-surface: #ffffff;
  --color-surface-hover: #f9f2d5;
  --color-border: #c9984d;
  --color-border-light: #f8e1a9;
  --color-success: #10b981;
  --color-error: #ef4444;
  --color-error-bg: #fee2e2;
  --color-error-border: #fecaca;
  --color-text-on-primary: #F5F4D6;
}

/* ===== CSS Variables - Dark Theme ===== */
[data-theme="dark"] {
  --color-primary: #c9984d;
  --color-primary-hover: #f8e1a9;
  --color-secondary: #014f99;
  --color-secondary-hover: #0168c9;
  --color-text: #f9f2d5;
  --color-text-secondary: #f8e1a9;
  --color-text-muted: #7A8DA0;
  --color-background: #091428;
  --color-surface: #142640;
  --color-surface-hover: #1a3050;
  --color-border: #1e3a5a;
  --color-border-light: #162d4a;
  --color-success: #34d399;
  --color-error: #f87171;
  --color-error-bg: #1a0808;
  --color-error-border: #5c1a1a;
  --color-text-on-primary: #091428;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Supreme', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, var(--color-background) 100%);
  min-height: 100vh;
  color: var(--color-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background: linear-gradient(180deg, #0E1C32 0%, #091428 100%);
}

/* ===== Landing Page ===== */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  background: var(--color-surface);
}

.hero-content {
  max-width: 700px;
  text-align: center;
}

.hero-title {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.1;
  margin-bottom: 24px;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px rgba(1, 79, 153, 0.3);
}

.hero-cta:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 57, 113, 0.4);
}

.cta-arrow {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.hero-cta:hover .cta-arrow {
  transform: translateX(4px);
}

.hero-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}

.format-tag {
  padding: 6px 12px;
  background: var(--color-background);
  border: 1px solid var(--color-border-light);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.features {
  flex: 1;
  padding: 80px 32px;
  background: var(--color-background);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
  border-color: var(--color-primary);
}

.feature-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

.feature-description {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ===== Converter Page ===== */
.converter-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: 48px 32px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin-bottom: 16px;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.home-link:hover {
  color: var(--color-primary);
  background: var(--color-surface);
}

.home-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.home-link:hover .home-arrow {
  transform: translateX(-3px);
}

.home-link-text {
  line-height: 1;
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-error);
}

.connection-status.connected .status-dot {
  background: var(--color-success);
}

/* ===== File Uploader ===== */
.uploader-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.drop-zone {
  border: 3px dashed var(--color-border);
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--color-surface);
}

.drop-zone:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
}

.drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
  transform: scale(1.02);
}

.drop-zone.uploading {
  opacity: 0.7;
  cursor: wait;
}

.drop-zone-content {
  pointer-events: none;
}

.upload-button {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.drop-zone:hover .upload-button {
  background: var(--color-primary-hover);
  transform: scale(1.05);
}

.upload-button.uploading {
  background: var(--color-secondary);
}

.upload-icon {
  width: 36px;
  height: 36px;
  color: var(--color-text-on-primary);
}

.upload-icon.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.drop-zone h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 8px;
}

.drop-zone p {
  color: var(--color-text-secondary);
  margin: 4px 0;
}

.drop-zone .formats {
  font-size: 12px;
  margin-top: 12px;
  color: var(--color-text-muted);
}

.error-message {
  margin-top: 16px;
  padding: 12px;
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  border-radius: 8px;
  color: var(--color-error);
  font-size: 14px;
}

/* ===== Conversion Queue ===== */
.conversion-queue {
  width: 100%;
  max-width: 600px;
  margin: 32px auto 0;
}

.conversion-queue h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 16px;
}

/* ===== Conversion Item ===== */
.conversion-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 12px;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.status {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.status-uploading { color: var(--color-secondary); }
.status-uploaded { color: var(--color-primary); }
.status-pending { color: var(--color-secondary); }
.status-processing { color: var(--color-primary); }
.status-completed { color: var(--color-success); }
.status-error { color: var(--color-error); }

.progress-bar {
  height: 6px;
  background: var(--color-border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.format-selection {
  background: var(--color-surface-hover);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.selector-row {
  margin-bottom: 10px;
}

.selector-row:last-child {
  margin-bottom: 0;
}

.selector-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.format-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.format-buttons button {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.format-buttons button:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
}

.format-buttons button.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
}

.error-text {
  color: var(--color-error);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--color-error-bg);
  border-radius: 4px;
}

.item-actions {
  display: flex;
  gap: 8px;
}

.item-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.item-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.btn-convert {
  background: var(--color-success);
  color: white;
}

.btn-convert:hover:not(:disabled) {
  background: #059669;
}

.btn-download {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
}

.btn-download:hover {
  background: var(--color-primary-hover);
}

.btn-remove {
  background: var(--color-surface-hover);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-remove:hover {
  background: var(--color-border-light);
}

/* ===== Responsive - 768px ===== */
@media (max-width: 768px) {
  /* Landing */
  .hero { padding: 48px 20px; }
  .hero-subtitle { font-size: 16px; margin-bottom: 24px; }
  .hero-cta { padding: 14px 28px; font-size: 15px; width: 100%; justify-content: center; }
  .hero-formats { gap: 6px; margin-bottom: 24px; }
  .features { padding: 48px 20px; }
  .features-grid { grid-template-columns: 1fr; gap: 20px; }
  .feature-card { padding: 24px; }

  /* Converter */
  .main { padding: 32px 20px; }

  /* Uploader */
  .drop-zone { padding: 40px 16px; }
  .upload-button { width: 64px; height: 64px; margin-bottom: 16px; }
  .upload-icon { width: 28px; height: 28px; }
  .drop-zone h3 { font-size: 18px; }

  /* Queue */
  .conversion-queue { margin-top: 24px; }

  /* Item */
  .item-header { flex-direction: column; gap: 8px; }
  .status { font-size: 13px; }
  .item-actions { flex-wrap: wrap; }
  .item-actions button { flex: 1; min-width: 0; justify-content: center; padding: 10px 12px; }
  .format-buttons button { padding: 8px 10px; font-size: 12px; }
}

/* ===== Responsive - 480px ===== */
@media (max-width: 480px) {
  /* Landing */
  .hero { padding: 32px 16px; }
  .hero-subtitle { font-size: 15px; }
  .hero-formats { gap: 5px; }
  .format-tag { padding: 4px 10px; font-size: 11px; }
  .features { padding: 32px 16px; }
  .feature-card { padding: 20px; }
  .feature-title { font-size: 18px; }
  .feature-description { font-size: 14px; }

  /* Converter */
  .main { padding: 24px 16px; }
  .connection-status { font-size: 12px; margin-bottom: 16px; }

  /* Uploader */
  .drop-zone { padding: 32px 12px; border-width: 2px; }
  .upload-button { width: 56px; height: 56px; margin-bottom: 12px; }
  .upload-icon { width: 24px; height: 24px; }
  .drop-zone h3 { font-size: 16px; }
  .drop-zone p { font-size: 14px; }
  .drop-zone .formats { font-size: 11px; }
  .error-message { font-size: 13px; padding: 10px; }

  /* Queue */
  .conversion-queue { margin-top: 20px; }
  .conversion-queue h2 { font-size: 16px; margin-bottom: 12px; }

  /* Item */
  .conversion-item { padding: 12px; }
  .file-name { font-size: 14px; }
  .file-meta { font-size: 12px; }
  .item-actions { flex-direction: column; }
  .item-actions button { width: 100%; padding: 12px; font-size: 14px; }
  .format-selection { padding: 10px; }
  .format-buttons { gap: 4px; }
  .format-buttons button { padding: 6px 8px; font-size: 11px; }
  .error-text { font-size: 12px; }
}
