/* ═══════════════════════════════════════════════════
   Carto2Circuit — Premium Mobile-First Dark Theme
   ═══════════════════════════════════════════════════ */

:root {
  /* Core palette */
  --bg-primary: #0a0f1c;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  
  /* Accent colors */
  --accent: #4f8cff;
  --accent-glow: rgba(79, 140, 255, 0.25);
  --accent-hover: #6ba1ff;
  --dpd-red: #dc0032;
  --spoke-green: #22c55e;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  
  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Spacing */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

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

html, body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(79, 140, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(220, 0, 50, 0.05) 0%, transparent 50%),
    var(--bg-primary);
}

/* ─── Language Toggle ────────────────────────────── */
.lang-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.lang-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: scale(1.05);
}

/* ─── Header ─────────────────────────────────────── */
.app-header {
  padding: 20px 16px 12px;
  text-align: center;
}

.logo-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease;
}

.brand-logo:hover {
  transform: scale(1.1);
}

.app-title h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.app-title h1 .accent {
  color: var(--accent);
}

.app-title .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

/* ─── Container ──────────────────────────────────── */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px 32px;
}

/* ─── Steps ──────────────────────────────────────── */
.step {
  display: none;
  animation: fadeSlideUp 0.4s ease;
}

.step.active {
  display: block;
}

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

.step h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step-header h2 {
  margin-bottom: 0;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.2s;
}

.back-btn:hover {
  color: var(--accent);
}

/* ─── Mode Cards ─────────────────────────────────── */
.mode-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.06), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.mode-card:hover {
  border-color: rgba(79, 140, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.mode-card:hover::before {
  opacity: 1;
}

.mode-card:active {
  transform: translateY(0);
}

.mode-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.mode-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.mode-info p {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.mode-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, var(--accent), #3b6fd4);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ─── Drop Zone ──────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-glass);
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.04), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.05);
}

.drop-zone:hover::before,
.drop-zone.dragover::before {
  opacity: 1;
}

.drop-zone-content {
  position: relative;
  z-index: 1;
}

.drop-icon {
  color: var(--text-muted);
  margin-bottom: 12px;
  transition: color 0.3s, transform 0.3s;
}

.drop-zone:hover .drop-icon {
  color: var(--accent);
  transform: translateY(-4px);
}

.drop-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

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

/* ─── File Preview ───────────────────────────────── */
.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.file-preview:empty {
  display: none;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  animation: chipIn 0.3s ease;
}

.file-chip .remove-file {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: color 0.2s;
}

.file-chip .remove-file:hover {
  color: var(--error);
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ─── Buttons ────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 16px;
  margin-top: 16px;
  background: linear-gradient(135deg, var(--accent), #3b6fd4);
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--accent-glow);
  background: linear-gradient(135deg, var(--accent-hover), #4a7de8);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

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

.btn-arrow {
  transition: transform 0.2s;
}

.btn-primary:hover:not(:disabled) .btn-arrow {
  transform: translateX(4px);
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
}

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

/* ─── Progress ───────────────────────────────────── */
.progress-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
}

.progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-bg {
  fill: none;
  stroke: var(--border-glass);
  stroke-width: 6;
}

.progress-bar {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.5s ease;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.progress-message {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ─── Results Table ──────────────────────────────── */
.results-badge {
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  margin-left: auto;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.results-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table thead {
  background: rgba(79, 140, 255, 0.08);
  position: sticky;
  top: 0;
}

.results-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  border-bottom: 1px solid var(--border-glass);
}

.results-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-primary);
  vertical-align: top;
}

.results-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.results-table td[contenteditable="true"] {
  cursor: text;
  outline: none;
  transition: background 0.2s;
  border-radius: 4px;
}

.results-table td[contenteditable="true"]:focus {
  background: rgba(79, 140, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.btn-download {
  background: linear-gradient(135deg, var(--spoke-green), #16a34a);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.25);
}

.btn-download:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(34, 197, 94, 0.35);
}

/* ─── Toast ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3s forwards;
  border: 1px solid;
}

.toast.success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.toast.error {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--error);
}

.toast.info {
  background: rgba(79, 140, 255, 0.15);
  border-color: rgba(79, 140, 255, 0.3);
  color: var(--accent);
}

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

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ─── Responsive ─────────────────────────────────── */
@media (min-width: 500px) {
  .container {
    padding: 16px 24px 40px;
  }
}

/* ─── Info Card ──────────────────────────────────── */
.info-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.info-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.how-to h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.how-to-steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
}

.how-to-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
  padding-left: 4px;
}

.how-to-steps li:last-child {
  margin-bottom: 0;
}

/* ─── Privacy Footer ─────────────────────────────── */
.privacy-footer {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px 24px;
}

.privacy-badge {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.12);
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

.privacy-badge svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--spoke-green);
}

.footer-credit {
  text-align: center;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.6;
}

.footer-credit a {
  color: var(--spoke-blue);
  text-decoration: none;
  transition: opacity 0.2s;
}

.footer-credit a:hover {
  opacity: 0.8;
  text-decoration: underline;
}
