@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Lexend:wght@400;500;600;700&display=swap");

:root {
  --bg-gradient-start: #f0f9ff;
  --bg-gradient-mid: #e0f2fe;
  --bg-gradient-end: #dbeafe;
  --ink: #0f172a;
  --ink-light: #334155;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #8b5cf6;
  --secondary-light: #ede9fe;
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px;
  gap: 32px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 24px;
  z-index: 100;
  transition: all 0.3s ease;
}

.topbar:hover {
  box-shadow: var(--shadow-xl);
}

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

.logo-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.logo-mark:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.logo-title {
  font-family: "Lexend", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.logo-subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  color: var(--ink-light);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.nav a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-light);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.nav a:hover {
  color: var(--primary);
  transform: translateY(-2px);
}

.nav a:hover::before {
  opacity: 1;
}

.nav a:active {
  transform: translateY(0);
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: fade-up 0.6s ease;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  align-items: center;
}

.hero-text h1 {
  font-family: "Lexend", sans-serif;
  font-size: clamp(2.25rem, 5vw, 2.75rem);
  font-weight: 800;
  margin: 16px 0 20px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--ink);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-text p {
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.7;
  max-width: 600px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--primary);
}

.hero-actions {
  margin-top: 28px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: float-in 0.8s ease;
  transition: all 0.4s ease;
}

.hero-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-2xl);
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.stat-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.steps {
  padding-left: 24px;
  margin: 0 0 20px;
  color: var(--ink-light);
  font-size: 1.05rem;
  line-height: 1.8;
}

.steps li {
  margin-bottom: 8px;
}

.card-highlight {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-light) 100%);
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  color: var(--ink);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.info-card {
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.info-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.info-card.accent {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--secondary-light) 100%);
  border-color: var(--accent);
}

.info-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.info-card:hover::before {
  transform: scaleX(1);
}

.info-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-family: "Lexend", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
}

.info-card p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.info-card a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.3s ease;
}

.info-card a:hover {
  gap: 10px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: fade-up 0.6s ease;
  transition: box-shadow 0.3s ease;
}

.panel:hover {
  box-shadow: var(--shadow-xl);
}

.panel.split {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.panel-header h2 {
  margin: 0;
  font-family: "Lexend", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
}

.panel-header h3 {
  margin: 0;
  font-family: "Lexend", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.panel-header p {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0;
}

.meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta strong {
  color: var(--ink);
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 20px;
}

.field label {
  font-weight: 700;
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.95rem;
}

.field textarea,
.field input[type="text"],
.field input[type="password"],
.field input[type="file"],
.field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: var(--card);
  color: var(--ink);
}

.field textarea:focus,
.field input[type="text"]:focus,
.field input[type="password"]:focus,
.field input[type="file"]:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.field textarea {
  min-height: 180px;
  resize: vertical;
  font-family: "Consolas", "Monaco", monospace;
  line-height: 1.6;
}

.field-error {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--radius-full);
  border: none;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.btn.primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

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

.btn.ghost {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--ink);
}

.btn.ghost:hover {
  background: var(--card-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-light) 100%);
}

th {
  text-align: left;
  padding: 16px;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}

td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-light);
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: var(--card-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

.file-list {
  display: grid;
  gap: 16px;
}

.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--card-hover);
  border: 1px solid var(--border);
  padding: 18px 20px;
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.file-row:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.file-row strong {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
}

.file-row span {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 4px;
}

.file-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.link {
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.link:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
}

.alert {
  background: var(--secondary-light);
  color: var(--secondary);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.alert.success {
  background: var(--success-light);
  color: var(--success);
  border-left-color: var(--success);
}

.empty {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 40px 20px;
  font-size: 1.05rem;
}

.file-preview {
  background: var(--ink);
  color: #e2e8f0;
  padding: 24px;
  border-radius: var(--radius-md);
  overflow: auto;
  max-height: 500px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 20px;
  border-top: 2px solid var(--border);
  margin-top: 40px;
}

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

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Result panel styling */
.panel.result {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid var(--primary-light);
}

/* Loading state */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .panel.split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-text h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
  }

  .cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 16px;
    gap: 24px;
  }

  .topbar {
    top: 16px;
    padding: 16px;
  }

  .panel {
    padding: 20px;
  }

  .hero-card {
    padding: 24px;
  }

  .file-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .file-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .meta {
    flex-direction: column;
    gap: 12px;
  }

  .btn {
    width: 100%;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection styling */
::selection {
  background: var(--primary-light);
  color: var(--primary);
}

::-moz-selection {
  background: var(--primary-light);
  color: var(--primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: var(--radius-sm);
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Utility classes */
.text-center {
  text-align: center;
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--primary);
}

.badge.success {
  background: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.badge.secondary {
  background: var(--secondary-light);
  color: var(--secondary);
  border-color: var(--secondary);
}

/* Divider */
.divider {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--border) 50%, transparent 100%);
  margin: 32px 0;
}

/* Card grid improvements */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

/* Improved input file styling */
.field input[type="file"] {
  cursor: pointer;
}

.field input[type="file"]::file-selector-button {
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 12px;
}

.field input[type="file"]::file-selector-button:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

/* Select dropdown styling */
.field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient-start: #0f172a;
    --bg-gradient-mid: #1e293b;
    --bg-gradient-end: #334155;
    --ink: #f1f5f9;
    --ink-light: #cbd5e1;
    --muted: #94a3b8;
    --card: #1e293b;
    --card-hover: #334155;
    --border: #334155;
    --primary-light: rgba(37, 99, 235, 0.2);
    --secondary-light: rgba(139, 92, 246, 0.2);
    --accent-light: rgba(245, 158, 11, 0.2);
    --success-light: rgba(16, 185, 129, 0.2);
    --danger-light: rgba(239, 68, 68, 0.2);
  }

  .topbar {
    background: rgba(30, 41, 59, 0.9);
  }

  .file-preview {
    background: #0f172a;
    color: #cbd5e1;
  }

  thead {
    background: rgba(37, 99, 235, 0.15);
  }
}
