/* ===== VARIABLES ===== */
:root {
  --md-cyan: #00FFFF;
  --md-cyan-dim: #00CCCC;
  --md-cyan-dark: #009999;
  --md-deep-blue: #1A2238;
  --md-dark-bg: #050A14;
  --md-surface: #0D1526;
  --md-card: #111D33;
  --md-border: #1E2D4A;
  --md-white: #FFFFFF;
  --md-off-white: #F0F2F5;
  --md-light-grey: #A0A8B8;
  --md-mid-grey: #6B7280;
  --md-radius: 12px;
  --md-radius-sm: 8px;
  --md-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --md-shadow: 0 4px 24px rgba(0, 255, 255, 0.06);
  --md-shadow-lg: 0 8px 40px rgba(0, 255, 255, 0.1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--md-font);
  background: var(--md-dark-bg);
  color: var(--md-off-white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== HEADER ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(5, 10, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--md-border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--md-white);
}

.header-logo {
  height: 72px;
  width: auto;
}

/* Header Steps / Breadcrumb */
.header-steps {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

.step-indicator.active {
  opacity: 1;
}

.step-indicator.completed {
  opacity: 0.7;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--md-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--md-light-grey);
  transition: all 0.3s ease;
}

.step-indicator.active .step-number {
  background: var(--md-cyan);
  color: var(--md-dark-bg);
}

.step-indicator.completed .step-number {
  background: var(--md-cyan-dim);
  color: var(--md-dark-bg);
}

.step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-light-grey);
}

.step-indicator.active .step-label {
  color: var(--md-white);
}

.step-divider {
  width: 24px;
  height: 1px;
  background: var(--md-border);
}

/* ===== MAIN ===== */
.main {
  padding-top: 80px;
  min-height: 100vh;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  animation: fadeIn 0.4s ease;
}

.screen--active {
  display: block;
}

/* ===== SCREEN 1: UPLOAD ===== */
.upload-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 48px 24px;
  text-align: center;
}

.hero-headline {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--md-white) 0%, var(--md-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 17px;
  color: var(--md-light-grey);
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: 40px;
}

/* Drop Zone */
.drop-zone {
  width: 100%;
  max-width: 520px;
  min-height: 240px;
  border: 2px dashed var(--md-cyan);
  border-radius: var(--md-radius);
  background: rgba(0, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.drop-zone:hover {
  background: rgba(0, 255, 255, 0.05);
  border-style: solid;
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.08), inset 0 0 40px rgba(0, 255, 255, 0.03);
}

.drop-zone--dragover {
  background: rgba(0, 255, 255, 0.08);
  border-style: solid;
  border-color: var(--md-white);
  box-shadow: 0 0 60px rgba(0, 255, 255, 0.15), inset 0 0 60px rgba(0, 255, 255, 0.05);
  transform: scale(1.02);
}

.drop-zone--has-file {
  border-color: var(--md-cyan-dim);
  border-style: solid;
  background: rgba(0, 255, 255, 0.04);
}

.drop-zone__prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.drop-zone__icon {
  width: 56px;
  height: 56px;
  color: var(--md-cyan);
  opacity: 0.7;
  transition: opacity 0.3s;
}

.drop-zone:hover .drop-zone__icon {
  opacity: 1;
}

.drop-zone__text {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-white);
}

.drop-zone__hint {
  font-size: 14px;
  color: var(--md-mid-grey);
}

.drop-zone__browse {
  color: var(--md-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color 0.2s;
}

.drop-zone__browse:hover {
  color: var(--md-white);
}

/* File Info inside drop zone */
.drop-zone__file-info {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.file-icon svg {
  width: 40px;
  height: 48px;
}

.file-details {
  flex: 1;
  text-align: left;
}

.file-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--md-white);
  word-break: break-all;
}

.file-size {
  font-size: 13px;
  color: var(--md-mid-grey);
  margin-top: 2px;
}

.file-remove {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-light-grey);
  transition: all 0.2s;
}

.file-remove:hover {
  background: rgba(255, 80, 80, 0.15);
  color: #ff6b6b;
}

.file-remove svg {
  width: 16px;
  height: 16px;
}

.upload-max {
  margin-top: 16px;
  font-size: 13px;
  color: var(--md-mid-grey);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--md-radius-sm);
  font-family: var(--md-font);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.btn__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn--primary {
  background: var(--md-cyan);
  color: var(--md-dark-bg);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

.btn--primary:hover {
  background: var(--md-white);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.35);
  transform: translateY(-1px);
}

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

.btn--outline {
  background: transparent;
  color: var(--md-cyan);
  border: 1.5px solid var(--md-cyan);
}

.btn--outline:hover {
  background: rgba(0, 255, 255, 0.08);
  transform: translateY(-1px);
}

.btn--lg {
  padding: 16px 36px;
  font-size: 16px;
  border-radius: var(--md-radius);
}

.btn--lg .btn__icon {
  width: 20px;
  height: 20px;
}

/* ===== HIDDEN ===== */
.hidden {
  display: none !important;
}

/* ===== SCREEN 2: PROCESSING ===== */
.processing-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  max-width: 960px;
  margin: 0 auto;
  padding: 80px 24px;
  min-height: calc(100vh - 64px);
  align-items: center;
}

.processing-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--md-white);
}

/* Stepper */
.stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stepper__step {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  position: relative;
}

.stepper__step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 17px;
  top: 56px;
  bottom: 0;
  width: 2px;
  background: var(--md-border);
}

.stepper__step.completed:not(:last-child)::after {
  background: var(--md-cyan-dim);
}

.stepper__circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-card);
  border: 2px solid var(--md-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.stepper__num {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-mid-grey);
  transition: opacity 0.3s;
}

.stepper__check {
  position: absolute;
  width: 18px;
  height: 18px;
  color: var(--md-dark-bg);
  opacity: 0;
  transition: opacity 0.3s;
}

/* Active step */
.stepper__step.active .stepper__circle {
  border-color: var(--md-cyan);
  background: rgba(0, 255, 255, 0.1);
  animation: pulse 2s ease-in-out infinite;
}

.stepper__step.active .stepper__num {
  color: var(--md-cyan);
}

/* Completed step */
.stepper__step.completed .stepper__circle {
  background: var(--md-cyan);
  border-color: var(--md-cyan);
}

.stepper__step.completed .stepper__num {
  opacity: 0;
}

.stepper__step.completed .stepper__check {
  opacity: 1;
}

.stepper__content {
  flex: 1;
  padding-top: 4px;
}

.stepper__label {
  font-size: 15px;
  font-weight: 600;
  color: var(--md-white);
  margin-bottom: 4px;
}

.stepper__step:not(.active):not(.completed) .stepper__label {
  color: var(--md-mid-grey);
}

.stepper__detail {
  font-size: 13px;
  color: var(--md-mid-grey);
  margin-bottom: 8px;
}

.stepper__step.active .stepper__detail {
  color: var(--md-light-grey);
}

.stepper__bar {
  height: 4px;
  background: var(--md-border);
  border-radius: 2px;
  overflow: hidden;
}

.stepper__step:not(.active):not(.completed) .stepper__bar {
  opacity: 0.4;
}

.stepper__progress {
  height: 100%;
  background: var(--md-cyan);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

.stepper__step.completed .stepper__progress {
  width: 100%;
}

/* Processing Visual */
.processing-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.spinner-ring {
  width: 180px;
  height: 180px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring__inner {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 3px solid var(--md-border);
  border-top-color: var(--md-cyan);
  border-right-color: var(--md-cyan);
  animation: spin 1.5s linear infinite;
  position: absolute;
}

.spinner-ring__pulse {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 255, 255, 0.08) 0%, transparent 70%);
  animation: pulseGlow 2s ease-in-out infinite;
  position: absolute;
}

.processing-percent {
  font-size: 36px;
  font-weight: 700;
  color: var(--md-cyan);
  position: relative;
  z-index: 2;
}

.processing-status {
  font-size: 14px;
  color: var(--md-light-grey);
  text-align: center;
}

/* ===== SCREEN 3: RESULTS ===== */
.results-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}

.results-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--md-white);
  margin-bottom: 8px;
}

.results-sub {
  font-size: 15px;
  color: var(--md-light-grey);
  margin-bottom: 40px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.stat-card {
  background: var(--md-card);
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius);
  padding: 24px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: rgba(0, 255, 255, 0.2);
  box-shadow: var(--md-shadow);
  transform: translateY(-2px);
}

.stat-card__label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--md-mid-grey);
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--md-cyan);
  line-height: 1.2;
}

.stat-card__sub {
  font-size: 13px;
  color: var(--md-light-grey);
  margin-top: 4px;
}

/* Preview Section */
.preview-heading {
  font-size: 20px;
  font-weight: 600;
  color: var(--md-white);
  margin-bottom: 20px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.preview-card {
  background: var(--md-card);
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius);
  padding: 24px;
}

.preview-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--md-white);
  margin-bottom: 16px;
}

/* CSS Bar Charts */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 100px;
}

.bar-chart__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar-chart__bar {
  width: 100%;
  background: linear-gradient(180deg, var(--md-cyan) 0%, var(--md-cyan-dark) 100%);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
  opacity: 0.85;
}

.bar-chart__bar:hover {
  opacity: 1;
}

.bar-chart__label {
  font-size: 10px;
  color: var(--md-mid-grey);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bar-chart__value {
  font-size: 10px;
  color: var(--md-light-grey);
  font-weight: 600;
}

.results-actions {
  text-align: center;
}

/* ===== SCREEN 4: DOWNLOAD ===== */
.download-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 48px 24px;
  text-align: center;
}

/* Success Checkmark */
.success-check {
  margin-bottom: 32px;
}

.success-check__svg {
  width: 80px;
  height: 80px;
}

.success-check__circle {
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  animation: checkCircle 0.6s ease forwards;
}

.success-check__tick {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: checkTick 0.4s ease 0.5s forwards;
}

.download-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--md-white);
  margin-bottom: 8px;
}

.download-sub {
  font-size: 16px;
  color: var(--md-light-grey);
  margin-bottom: 40px;
}

.download-details {
  display: flex;
  gap: 40px;
  margin-bottom: 40px;
  padding: 24px 40px;
  background: var(--md-card);
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius);
}

.download-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.download-detail__label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--md-mid-grey);
}

.download-detail__value {
  font-size: 16px;
  font-weight: 600;
  color: var(--md-white);
}

.download-actions {
  display: flex;
  gap: 16px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 255, 255, 0.3); }
  50%      { box-shadow: 0 0 0 8px rgba(0, 255, 255, 0); }
}

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

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50%      { transform: scale(1.15); opacity: 1; }
}

@keyframes checkCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes checkTick {
  to { stroke-dashoffset: 0; }
}

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

/* ===== ERROR STATE ===== */
.error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #331111;
  border: 1px solid #662222;
  color: #ff6b6b;
  padding: 14px 24px;
  border-radius: var(--md-radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  transition: transform 0.3s ease;
  max-width: 480px;
  text-align: center;
}

.error-toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ===== USER MENU ===== */
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-email {
  font-size: 13px;
  color: var(--md-light-grey);
}

.admin-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-cyan);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid rgba(0, 255, 255, 0.25);
  border-radius: 6px;
  transition: all 0.2s;
}

.admin-link:hover {
  background: rgba(0, 255, 255, 0.08);
  border-color: var(--md-cyan);
}

.btn--sm {
  padding: 6px 16px;
  font-size: 13px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header-steps {
    display: none;
  }

  .hero-headline {
    font-size: 28px;
  }

  .processing-layout {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 24px;
  }

  .processing-visual {
    order: -1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .download-details {
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px;
  }

  .download-actions {
    flex-direction: column;
    width: 100%;
  }

  .download-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 200px;
    padding: 24px;
  }

  .hero-headline {
    font-size: 24px;
  }
}
