:root {
  --bg: #0b1020;
  --card: #121a39;
  --card-header-bg: rgba(255, 255, 255, 0.03);
  --text: #e9ecf6;
  --muted: #9aa3bc;
  --primary: #4f7cff;
  --primary-2: #7ea2ff;
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.25);
  --success: #3ecf8e;
  --error: #ff7b8c;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius-sm: 10px;
}

body {
  background: linear-gradient(180deg, #0b1020, #0f1530);
  padding-bottom: 60px;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
  color: var(--text);
}

/* ===== Topbar ===== */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.topbar .logo {
  font-size: 20px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row.between {
  justify-content: space-between;
}

/* ===== Buttons ===== */
.btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn:hover {
  background: var(--primary-2);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--border-hover);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
  display: none;
}
.btn.loading .btn-text {
  display: none;
}
.btn.loading .btn-loader {
  display: block;
  margin: 0 auto;
}

/* ===== Container & Cards ===== */
.container {
  max-width: 680px;
  margin-top: 24px;
  padding: 0 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-header {
  text-align: center;
  margin-bottom: 8px;
}
.card-title {
  margin: 0;
  font-size: 22px;
}
.card-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ===== Form styles ===== */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label {
  font-size: 13px;
  color: #cfe0ff;
  font-weight: 500;
}
.input {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0f1633;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.18);
  border-color: var(--primary);
}
.message {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}
.message.error {
  color: var(--error);
}

/* ===== Upload Page Specifics ===== */
#loginCard {
  display: none;
}
#uploadCard {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
  background-color: rgba(255, 255, 255, 0.02);
}
.dropzone:hover,
.dropzone.hover {
  transform: scale(1.02);
  background-color: rgba(79, 124, 255, 0.05);
  border-color: var(--primary);
}
.dropzone-content .icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--primary-2);
}
.dropzone-content .text {
  font-size: 16px;
  margin: 4px 0;
  color: var(--text);
}
.dropzone-content .text b {
  color: var(--primary-2);
  font-weight: 600;
}
.dropzone-content .file-name {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  word-break: break-all;
  min-height: 18px;
}

.progress-box {
  position: relative;
  height: 24px;
  background: #0e1330;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 8px 0;
  display: none; /* Initially hidden */
}
.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.3s ease-in-out;
}
.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.output-container {
  background: #0f1633;
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-sm);
  word-break: break-word;
  font-size: 14px;
  min-height: 80px;
}
.output-placeholder {
  color: var(--muted);
}
.output-container a {
  color: var(--success);
  font-weight: 600;
  text-decoration: underline;
}

/* ===== Animation ===== */
@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .container {
    margin-top: 16px;
  }
  .card-body {
    padding: 16px;
  }
  .dropzone {
    padding: 24px 16px;
  }
  .topbar .brand strong {
    font-size: 14px;
  }
  .btn {
    font-size: 13px;
    padding: 5px 10px;
  }
}
