/* ==========================================================================
   Orient TypeSecure — Design System
   ========================================================================== */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --card-bg: rgba(17, 25, 40, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;
  
  /* Primary Accents */
  --accent-purple: #6366f1;
  --accent-purple-glow: rgba(99, 102, 241, 0.4);
  --accent-teal: #06b6d4;
  --accent-teal-glow: rgba(6, 182, 212, 0.3);
  
  /* Status Colors */
  --color-success: #10b981;
  --color-success-glow: rgba(16, 185, 129, 0.2);
  --color-warning: #f59e0b;
  --color-warning-glow: rgba(245, 158, 11, 0.2);
  --color-danger: #ef4444;
  --color-danger-glow: rgba(239, 68, 68, 0.2);

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Fira Code', 'Courier New', Courier, monospace;
}

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

body {
  font-family: var(--font-sans);
  background: radial-gradient(circle at 50% 0%, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  line-height: 1.5;
  padding: 20px;
}

/* ==========================================================================
   App Container & Universal Glassmorphism
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 1280px;
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel {
  background: rgba(17, 25, 40, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
}

/* Glowing Ambient Orbs */
.glow-accent {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.glow-accent.top-right {
  top: -100px;
  right: -100px;
  background: var(--accent-purple);
}

.glow-accent.bottom-left {
  bottom: -100px;
  left: -100px;
  background: var(--accent-teal);
}

/* Hide inactive modules */
.interface-hidden {
  display: none !important;
}

/* ==========================================================================
   Landing Module Styles
   ========================================================================== */
#landing-screen {
  max-width: 650px;
  display: none;
}

#landing-screen.active {
  display: block;
}

.landing-header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo .icon {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--accent-teal);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.instruction-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 30px;
  position: relative;
  z-index: 1;
}

.instruction-box h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.instruction-box p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
  line-height: 1.6;
}

.steps-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.step-badge {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--text-main);
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.user-form {
  position: relative;
  z-index: 1;
}

.user-form label {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 12px;
}

.user-form input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 14px 18px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.user-form input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.input-helper {
  font-size: 0.8rem;
  color: var(--text-dark);
  margin-top: 8px;
}

/* ==========================================================================
   Buttons Setup
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-purple) 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-purple-glow);
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

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

.primary-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-dark);
  box-shadow: none;
  cursor: not-allowed;
}

.outline-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

.outline-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
}

.danger-hover:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.05);
}

.active-btn {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
  background: rgba(6, 182, 212, 0.08);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pulse-glow {
  animation: pulse-glow-anim 2s infinite alternate;
}

@keyframes pulse-glow-anim {
  0% { box-shadow: 0 0 10px rgba(99, 102, 241, 0.3); }
  100% { box-shadow: 0 0 25px rgba(99, 102, 241, 0.7); }
}

/* ==========================================================================
   Main Telemetry Workspace
   ========================================================================== */
#main-interface {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Status Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  position: relative;
  z-index: 10;
}

.header-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user-info .avatar {
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.header-user-info .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-user-info .val {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-teal);
}

.header-progress {
  flex: 1;
  max-width: 500px;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.progress-details span:first-child {
  font-weight: 600;
  color: var(--text-main);
}

.progress-details span:last-child {
  color: var(--text-muted);
}

.progress-segments {
  display: flex;
  gap: 4px;
  width: 100%;
}

.progress-seg {
  flex: 1;
  height: 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  transition: background 0.35s ease, transform 0.2s ease;
  cursor: default;
  position: relative;
}

.progress-seg.done {
  background: var(--accent-teal);
}

.progress-seg.active {
  background: var(--accent-purple);
  transform: scaleY(1.4);
}

.progress-seg.active::after {
  transform: translateX(-50%) scaleY(calc(1 / 1.4));
}

.progress-seg::after {
  content: attr(data-title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 30, 0.95);
  color: var(--text-main);
  font-size: 0.72rem;
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
}

.progress-seg:hover::after {
  opacity: 1;
}

/* Workspace Layout Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.prompt-panel, .editor-panel {
  padding: 30px;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
}

.badge {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--accent-teal);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
}

.lead-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Copy Target Card */
.copy-target-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
  transition: all 0.3s ease;
}

.copy-target-box.hidden {
  display: none !important;
}

.copy-target-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: 0.5px;
}

.badge-mini {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  outline: none;
}

.copy-target-text {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-teal);
  line-height: 1.6;
  white-space: pre-wrap;
  user-select: none; /* prevent copying the text directly from page! */
}

.copy-target-text .facts-list {
  margin: 0;
  padding-left: 22px;
  white-space: normal;
}

.copy-target-text .facts-list li {
  margin-bottom: 10px;
}

.copy-target-text .facts-list li:last-child {
  margin-bottom: 0;
}

/* Flashed timer controls */
.flash-control-box {
  background: rgba(99, 102, 241, 0.04);
  border: 1px dashed rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-top: 10px;
}

.flash-control-box.hidden {
  display: none !important;
}

.timer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
}

.timer-display.hidden {
  display: none !important;
}

.timer-num {
  font-size: 3.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-warning);
  text-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
  line-height: 1;
}

.timer-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.flash-helper {
  font-size: 0.8rem;
  color: var(--text-dark);
}

/* Editor Input Area */
.word-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.editor-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.editor-panel textarea {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 250px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
  outline: none;
  resize: none;
  transition: all 0.3s ease;
}

.editor-panel textarea:focus {
  border-color: var(--accent-purple);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

.editor-panel textarea:disabled {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.03);
  color: var(--text-dark);
  cursor: not-allowed;
}

/* Typing keypress feedback visualizer */
.typing-pulse {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--accent-teal);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.typing-pulse.active {
  animation: keypulse-anim 0.15s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes keypulse-anim {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7); }
  100% { transform: scale(3.5); opacity: 0; box-shadow: 0 0 0 10px rgba(6, 182, 212, 0); }
}

/* Validation status & Submit Footer */
.panel-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 16px;
  margin-top: 20px;
  gap: 10px;
}

.validation-hint {
  font-size: 0.78rem;
  color: rgba(255, 200, 100, 0.85);
  text-align: right;
  margin: 0;
  min-height: 1.1em;
  width: 100%;
}

.validation-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-indicator {
  font-size: 1.1rem;
  line-height: 1;
}

.status-indicator.green { color: var(--color-success); }
.status-indicator.yellow { color: var(--color-warning); }
.status-indicator.red { color: var(--color-danger); }

/* ==========================================================================
   Telemetry HUD dashboard - Visual event logging
   ========================================================================== */
.telemetry-hud {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  align-items: stretch;
  position: relative;
  z-index: 10;
}

@media (max-width: 900px) {
  .telemetry-hud {
    grid-template-columns: 1fr;
  }
}

.hud-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric .m-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.metric .m-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--font-mono);
}

.hud-log {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  height: 140px;
}

.hud-log-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.hud-log-status {
  color: var(--accent-teal);
  font-family: var(--font-mono);
  animation: blink-anim 1.5s infinite alternate;
}

@keyframes blink-anim {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.hud-log-stream {
  flex: 1;
  min-height: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 8px;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.log-row {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  line-height: 1.6;
  flex-shrink: 0;
}

.log-row.info { color: var(--text-dark); }
.log-row.keydown { color: #f472b6; }
.log-row.keyup { color: #c084fc; }
.log-row.paste { color: #f43f5e; font-weight: bold; }
.log-row.selection { color: #60a5fa; }
.log-row.click { color: #34d399; }
.log-row.system { color: var(--accent-teal); font-weight: 500; }

/* ==========================================================================
   Completion Screen
   ========================================================================== */
#completion-screen {
  max-width: 600px;
  text-align: center;
  display: none;
}

#completion-screen.active {
  display: block;
}

.check-animation {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: bold;
  color: white;
  margin: 0 auto 20px auto;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.4);
}

.completion-summary {
  margin: 30px 0;
  text-align: left;
}

.completion-summary h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

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

.summary-table td {
  padding: 10px 0;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-table tr:last-child td {
  border-bottom: none;
}

.summary-table td:first-child {
  color: var(--text-muted);
  width: 40%;
}

.summary-table td:last-child {
  font-family: var(--font-mono);
  text-align: right;
}

.summary-table td.highlight {
  color: var(--accent-purple);
  font-weight: 600;
}

.dir-code {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--accent-teal);
}

.completion-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.bulk-upload-status {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}
