@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Brand & Accent Tokens */
  --colors-primary: #005DE0;
  --colors-primary-deep: #0143B5;
  --colors-primary-pressed: #003296;
  --colors-primary-soft: rgba(1, 83, 223, 0.08);

  --colors-ink-deep: #0F1419;
  --colors-ink: #20272C;
  --colors-charcoal: #3E4B53;
  --colors-slate: #536471;
  --colors-steel: #8B98A5;
  --colors-stone: #AAB8C2;

  --colors-canvas: #FFFFFF;
  --colors-surface-soft: #F5F6F8;
  --colors-hairline: #E1E8ED;
  --colors-hairline-soft: #F0F3F5;

  --colors-success: #008837;
  --colors-warning: #FFD200;
  --colors-critical: #D9381E;

  /* Typography */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Geometry / Border Radius */
  --rounded-xs: 2px;
  --rounded-sm: 4px;
  --rounded-md: 6px;
  --rounded-lg: 8px;
  --rounded-xl: 16px;
  --rounded-xxl: 24px;
  --rounded-xxxl: 32px;
  --rounded-full: 100px;
}

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

body {
  background-color: var(--colors-canvas);
  color: var(--colors-ink-deep);
  font-family: var(--font-sans);
  min-height: 100vh;
  padding: 2rem 1.5rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header & Brand Navigation */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto 2.5rem auto;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--colors-hairline-soft);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--colors-ink-deep);
  border-radius: var(--rounded-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--colors-ink-deep);
  letter-spacing: -0.02em;
}

/* Tab Navigation */
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--colors-surface-soft);
  padding: 0.35rem;
  border-radius: var(--rounded-full);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--colors-slate);
  padding: 0.6rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: var(--rounded-full);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: -0.01em;
}

.tab-btn svg {
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--colors-ink-deep);
}

.tab-btn.active {
  color: #ffffff;
  background: var(--colors-ink-deep);
}

/* Main Container & Grid */
.main-container {
  max-width: 1280px;
  margin: 0 auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start; /* Prevents cards from stretching vertically */
}

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

/* Cards & Showcase Containers */
.glass-card {
  background: var(--colors-canvas);
  border: 1px solid var(--colors-hairline-soft);
  border-radius: var(--rounded-xxxl);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  position: relative;
  align-self: start; /* Fits content height without vertical stretching */
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--colors-hairline-soft);
  padding-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--colors-ink-deep);
  letter-spacing: -0.01em;
}

/* Forms & Control Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--colors-ink-deep);
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: -0.01em;
}

/* Primary Top-Level Section Label (e.g. Standard Visible Payload & Pad Area Extracted Stego Payload) */
.form-label-primary {
  font-size: 1rem;
  font-weight: 700;
  color: var(--colors-ink-deep);
}

/* Secondary Sub-Label (Smaller level for decryption inputs) */
.form-label-sub {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--colors-slate);
}

.form-label-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--colors-slate);
}

.form-label-hint.warning {
  color: var(--colors-critical);
  font-weight: 600;
}

.input-text, .select-input, .textarea-input {
  background: var(--colors-canvas);
  border: 1px solid var(--colors-hairline);
  border-radius: var(--rounded-lg);
  padding: 0.75rem 1rem;
  color: var(--colors-ink-deep);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
  height: 44px;
}

.textarea-input {
  resize: none;
  min-height: 90px;
  height: auto;
  line-height: 1.5;
}

.input-text:focus, .select-input:focus, .textarea-input:focus {
  border-color: var(--colors-primary);
  box-shadow: 0 0 0 3px var(--colors-primary-soft);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Collapsible Stego Banner with Smooth Transition */
.stego-banner {
  background: var(--colors-surface-soft);
  border: 1px solid var(--colors-hairline);
  border-radius: var(--rounded-xl);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.reader-crypto-panel {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.stego-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.stego-banner-title {
  color: var(--colors-ink-deep);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
}

/* Sub-title level for Decryption Keys (Smaller than Pad Area Extracted Stego Payload) */
.stego-banner-title-sub {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--colors-ink);
}

.stego-banner-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 800px;
  opacity: 1;
  overflow: visible;
  margin-top: 0.75rem;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin-top 0.25s ease;
}

.stego-banner-body.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.arrow-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: var(--rounded-full);
  color: var(--colors-slate);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.arrow-btn.collapsed {
  transform: rotate(-90deg);
}

/* Showcase Canvas Area */
.qr-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--colors-surface-soft);
  border-radius: var(--rounded-xxxl);
  padding: 2.5rem;
}

canvas#qrCanvas {
  border-radius: var(--rounded-xl);
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  max-width: 100%;
  height: auto;
}

/* Buttons */
.btn-group {
  display: flex;
  gap: 0.75rem;
}

.btn {
  padding: 14px 28px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: var(--rounded-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  height: 48px;
  flex: initial;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--colors-primary);
  border: none;
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--colors-primary-deep);
}

.btn-primary:active {
  background: var(--colors-primary-pressed);
}

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

.btn-secondary:hover {
  background: var(--colors-surface-soft);
}

.btn-ink {
  background: var(--colors-ink-deep);
  border: none;
  color: #ffffff;
}

.btn-ink:hover {
  background: var(--colors-charcoal);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: var(--rounded-full);
  font-weight: 700;
  font-size: 0.75rem;
}

.status-passed { background: rgba(0, 136, 55, 0.1); color: var(--colors-success); border: 1px solid rgba(0, 136, 55, 0.2); }
.status-failed { background: rgba(217, 56, 30, 0.1); color: var(--colors-critical); border: 1px solid rgba(217, 56, 30, 0.2); }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--colors-hairline);
  border-radius: var(--rounded-xxl);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--colors-surface-soft);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--colors-primary);
  background: var(--colors-primary-soft);
}

/* Centered Scanner Error State Overlay */
.scan-error-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--colors-surface-soft);
  border: 1px solid var(--colors-hairline);
  border-radius: var(--rounded-xxl);
  gap: 0.75rem;
}

.scan-error-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--colors-critical);
}

.scan-error-desc {
  font-size: 0.875rem;
  color: var(--colors-slate);
  max-width: 320px;
}

/* Custom Select Component Styles */
.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  background: var(--colors-canvas);
  border: 1px solid var(--colors-hairline);
  border-radius: var(--rounded-lg);
  padding: 0.75rem 1rem;
  color: var(--colors-ink-deep);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.custom-select-trigger:hover, .custom-select-container.open .custom-select-trigger {
  border-color: var(--colors-primary);
  box-shadow: 0 0 0 3px var(--colors-primary-soft);
}

.custom-select-trigger .chevron-icon {
  color: var(--colors-slate);
  transition: transform 0.25s ease;
}

.custom-select-container.open .chevron-icon {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 200;
  background: #ffffff;
  border: 1px solid var(--colors-hairline);
  border-radius: var(--rounded-xl);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 240px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-select-container.open .custom-select-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.custom-select-option {
  padding: 0.6rem 0.85rem;
  border-radius: var(--rounded-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--colors-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.custom-select-option:hover {
  background: var(--colors-surface-soft);
  color: var(--colors-ink-deep);
}

.custom-select-option.selected {
  background: var(--colors-primary-soft);
  color: var(--colors-primary);
  font-weight: 700;
}
