/* ==========================================================================
   DESIGN SYSTEM - SCANNERRECIBOSAI (TECH RED & BLACK THEME WITH GOLD ACCENTS)
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0a0a0c;
  --bg-secondary: #111115;
  --bg-tertiary: #16161c;
  --color-text: #f3f4f6;
  --color-text-muted: #9ca3af;
  
  /* Brand Tech Colors */
  --color-red: #ef4444;
  --color-red-glow: rgba(239, 68, 68, 0.45);
  --color-red-muted: rgba(239, 68, 68, 0.1);
  
  --color-yellow: #facc15;
  --color-yellow-glow: rgba(250, 204, 21, 0.4);
  --color-yellow-muted: rgba(250, 204, 21, 0.1);
  
  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.4);
  
  /* Borders & Glassmorphism */
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active-red: rgba(239, 68, 68, 0.5);
  --border-active-yellow: rgba(250, 204, 21, 0.5);
  
  --glass-bg: rgba(17, 17, 21, 0.75);
  --glass-bg-inner: rgba(25, 25, 32, 0.6);
  --shadow-neon: 0 8px 32px 0 rgba(0, 0, 0, 0.4), 0 0 20px rgba(239, 68, 68, 0.1);
  --shadow-neon-hover: 0 12px 40px 0 rgba(0, 0, 0, 0.55), 0 0 30px rgba(239, 68, 68, 0.25);
  
  /* Typography & Transitions */
  --font-family: 'Outfit', sans-serif;
  --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* ==========================================================================
   RESET & FOUNDATION
   ========================================================================== */

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Dynamic space particles background */
.stars-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 40px 70px, rgba(239, 68, 68, 0.4), rgba(0,0,0,0)),
    radial-gradient(2px 2px at 50px 160px, rgba(250, 204, 21, 0.3), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 80px 120px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 150px 30px, rgba(239, 68, 68, 0.2), rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.45;
  animation: bgScroll 120s linear infinite;
}

@keyframes bgScroll {
  from { background-position: 0 0; }
  to { background-position: 0 1000px; }
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */

.app-container {
  width: 100%;
  max-width: 960px;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  z-index: 10;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */

.app-header {
  text-align: center;
}

.logo-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.logo-icon {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--color-red);
  filter: drop-shadow(0 0 8px var(--color-red-glow));
  animation: rotateLogo 20s linear infinite;
}

@keyframes rotateLogo {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.logo-area h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--color-text);
  margin: 0;
  text-transform: uppercase;
}

.highlight-red {
  color: var(--color-red);
  text-shadow: 0 0 15px var(--color-red-glow);
}

.subtitle {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
  font-weight: 300;
  line-height: 1.6;
}

/* ==========================================================================
   MAIN CARD & GLASSMORPHISM
   ========================================================================== */

.card {
  border-radius: 24px;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-neon);
  overflow: hidden;
  position: relative;
  transition: var(--transition-smooth);
}

.card:hover {
  box-shadow: var(--shadow-neon-hover);
  border-color: rgba(239, 68, 68, 0.18);
}

.glassmorphism {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glassmorphism-inner {
  background: var(--glass-bg-inner);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
}

/* ==========================================================================
   PANEL TRANSITIONS (SLIDE & FADE)
   ========================================================================== */

.panel {
  display: none;
  padding: 3rem;
  animation: fadeSlideIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.panel.active {
  display: block;
}

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

.panel-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-title i {
  color: var(--color-red);
}

.panel-subtitle {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  font-weight: 300;
}

/* ==========================================================================
   PANEL 1: UPLOAD AREA
   ========================================================================== */

.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--color-red);
  background: rgba(239, 68, 68, 0.03);
  box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.05);
}

.glow-icon-container {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem auto;
  border: 1px solid rgba(239, 68, 68, 0.15);
  transition: var(--transition-smooth);
}

.drop-zone:hover .glow-icon-container {
  transform: translateY(-5px);
  background: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 20px var(--color-red-glow);
  border-color: var(--color-red);
}

.upload-illustration {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--color-red);
}

.drop-zone-text {
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.browse-link {
  color: var(--color-red);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.drop-zone-limits {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Selected File Details Box */
.selected-file-details {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  max-width: 450px;
  margin: 0.5rem auto 0 auto;
  text-align: left;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-check-icon {
  color: var(--color-green);
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
}

.file-info-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.file-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.remove-file-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.remove-file-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-red);
}

.action-bar {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Crimson Red Button */
.btn-primary {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.55), 0 0 10px rgba(239, 68, 68, 0.2);
}

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

/* Accent Tech Yellow Button */
.btn-accent {
  background: linear-gradient(135deg, #facc15 0%, #eab308 100%);
  color: #0c0c0e;
  box-shadow: 0 4px 15px rgba(250, 204, 21, 0.35);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(250, 204, 21, 0.55), 0 0 10px rgba(250, 204, 21, 0.2);
}

/* Outline Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   PANEL 2: SCANNING / LOADING STATE
   ========================================================================== */

.scanner-container {
  width: 160px;
  height: 220px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.01);
  margin: 0 auto 2rem auto;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

/* Glowing Neon Laser */
.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, #ef4444, transparent);
  box-shadow: 0 0 12px #ef4444, 0 0 4px #ef4444;
  animation: laserScan 2.4s ease-in-out infinite;
  z-index: 5;
}

@keyframes laserScan {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

/* Wireframe Ticket Inside Scanner */
.ticket-wireframe {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
}

.wireframe-line {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  width: 100%;
}

.wireframe-line.header-line {
  height: 14px;
  background: rgba(255, 255, 255, 0.15);
  margin-bottom: 0.5rem;
}

.wireframe-line.short {
  width: 60%;
}

.wireframe-line.total-line {
  margin-top: auto;
  background: rgba(250, 204, 21, 0.3);
  height: 10px;
}

.processing-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.processing-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* Terminal logs of server stages */
.terminal-logs {
  background: #070709;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.25rem 1.75rem;
  max-width: 480px;
  margin: 0 auto;
  font-family: monospace;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.log-line {
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition-smooth);
}

.log-bullet {
  font-weight: bold;
}

.log-line.active {
  color: var(--color-red);
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
  animation: pulseText 1.5s infinite alternate;
}

.log-line.completed {
  color: var(--color-green);
}

@keyframes pulseText {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

/* ==========================================================================
   PANEL 3: VALIDATION SCREEN (SPLIT VIEW)
   ========================================================================== */

.split-view {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .split-view {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* Preview Column */
.preview-container {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.preview-display {
  aspect-ratio: 3 / 4;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-display img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pdf-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--color-text-muted);
}

.pdf-preview-placeholder i {
  width: 4rem;
  height: 4rem;
  color: var(--color-red);
}

/* Form Column */
.validation-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group label i {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--color-red);
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.input-wrapper input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  color: white;
  font-family: var(--font-family);
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--color-red);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

.input-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  pointer-events: none;
  transition: var(--transition-smooth);
  opacity: 0;
  box-shadow: 0 0 15px var(--color-red-glow);
}

.input-wrapper input:focus + .input-glow {
  opacity: 0.25;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 1rem;
  margin-top: 1rem;
}

/* ==========================================================================
   PANEL 4: SUCCESS STATE
   ========================================================================== */

.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem auto;
}

/* Glowing Checkmark Animation */
.success-checkmark .check-icon {
  width: 80px;
  height: 80px;
  position: relative;
  border-radius: 50%;
  box-sizing: content-box;
  border: 4px solid var(--color-green);
  box-shadow: 0 0 20px var(--color-green-glow);
}

.success-checkmark .check-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--color-green);
}

.success-checkmark .check-icon .icon-line {
  height: 5px;
  background-color: var(--color-green);
  display: block;
  border-radius: 2px;
  position: absolute;
  z-index: 10;
}

.success-checkmark .check-icon .icon-line.line-tip {
  top: 43px;
  left: 19px;
  width: 25px;
  transform: rotate(45deg);
  animation: icon-line-tip 0.75s;
}

.success-checkmark .check-icon .icon-line.line-long {
  top: 38px;
  right: 17px;
  width: 47px;
  transform: rotate(-45deg);
  animation: icon-line-long 0.75s;
}

@keyframes icon-line-tip {
  0% { width: 0; left: 1px; top: 19px; }
  54% { width: 0; left: 1px; top: 19px; }
  70% { width: 17px; left: 9px; top: 37px; }
  84% { width: 17px; left: 14px; top: 45px; }
  100% { width: 25px; left: 19px; top: 43px; }
}

@keyframes icon-line-long {
  0% { width: 0; right: 46px; top: 54px; }
  65% { width: 0; right: 46px; top: 54px; }
  84% { width: 26px; right: 35px; top: 48px; }
  100% { width: 47px; right: 17px; top: 38px; }
}

.success-title {
  font-size: 1.85rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.75rem;
}

.success-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  max-width: 500px;
  margin: 0 auto 2rem auto;
  line-height: 1.6;
}

.airtable-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.2);
  color: var(--color-yellow);
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 auto 2.5rem auto;
  display: flex;
  max-width: fit-content;
}

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

/* ==========================================================================
   FOOTER / INSTRUCTIONS SECTION
   ========================================================================== */

.app-footer-info {
  text-align: center;
}

.info-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  padding: 1.5rem 2rem;
  text-align: left;
  max-width: 650px;
  margin: 0 auto 2rem auto;
}

.info-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
}

.info-card h3 i {
  color: var(--color-yellow);
}

.info-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.fields-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fields-list li {
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  border-left: 3px solid var(--color-red);
}

.field-type {
  color: var(--color-text-muted);
}

.copyright {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.2);
  margin-top: 1rem;
}

.success-color {
  color: var(--color-green) !important;
}
