/**
 * AVVOLTO CORE ENGINE - UI/UX SPECIFICATIONS
 * @version: 2026.4.19
 * @author: Gemini 3 Flash (Paid Tier)
 * @description: High-fidelity dark neon aesthetic with glassmorphism layers.
 */

:root {
  /* -- Color Palette: Semantic Tokens -- */
  --bg:        #0E0C0F;
  --bg2:       #141118;
  --amber:     #E8936A;
  --rose:      #C97B8A;
  --sage:      #7BA99A;
  --steel:     #7A9EBD;
  --gold:      #C9A84C;
  --text:      #EDE8E3;
  --text-dim:  #7A7068;
  
  /* -- Surface & Glass Effects -- */
  --glass:     rgba(255, 255, 255, 0.03);
  --glass-b:   rgba(255, 255, 255, 0.07);
  --radius:    16px;
  
  /* -- Typography -- */
  --font:      'Space Grotesk', sans-serif;
  --mono:      'Space Mono', monospace;
}

/* ------------------------------------------------------------------ */
/* [01] GLOBAL RESET & INITIALIZATION                                 */
/* ------------------------------------------------------------------ */
*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* [02] ENVIRONMENTAL EFFECTS (GRID & ORBS)                           */
/* ------------------------------------------------------------------ */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232, 147, 106, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 147, 106, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 14s ease-in-out infinite alternate;
  will-change: transform;
}

.bg-orb-1 { 
  width: 640px; height: 640px; 
  background: rgba(232, 147, 106, 0.07); 
  top: -200px; left: -200px; 
}

.bg-orb-2 { 
  width: 520px; height: 520px; 
  background: rgba(122, 158, 189, 0.06); 
  bottom: -150px; right: -150px; 
  animation-delay: -7s; 
}

@keyframes orb-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.08); }
}

/* ------------------------------------------------------------------ */
/* [03] VIEWPORT LAYER CONTROL                                        */
/* ------------------------------------------------------------------ */
.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen.hidden { 
  display: none !important; 
}

/* ------------------------------------------------------------------ */
/* [04] UPLOAD INTERFACE                                              */
/* ------------------------------------------------------------------ */
#screen-upload {
  flex-direction: column;
  padding: 40px 20px;
}

.home {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  font-family: var(--mono);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -2px;
  background: linear-gradient(135deg, var(--amber) 0%, var(--rose) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  text-align: center;
}

.logo-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 60px;
}

.upload-card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: 24px;
  padding: 60px 48px;
  width: 100%;
  max-width: 520px;
  text-align: center;
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.upload-card.drag-over {
  border-color: var(--amber);
  box-shadow: 0 0 40px rgba(232, 147, 106, 0.12);
  transform: scale(1.02);
}

.upload-icon {
  width: 72px; height: 72px;
  margin: 0 auto 24px;
  background: rgba(232, 147, 106, 0.07);
  border: 1px solid rgba(232, 147, 106, 0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-icon svg { width: 32px; height: 32px; }

.upload-card h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.upload-card p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 32px;
}

.upload-card p span {
  color: var(--amber);
  font-weight: 500;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--amber), var(--rose));
  color: #1A0F0A;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px 32px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.btn-upload:hover {
  opacity: 0.92;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(232, 147, 106, 0.22);
}

#file-input { display: none; }

.upload-hint {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ------------------------------------------------------------------ */
/* [05] OPERATIONAL STEPS (HOW-TO)                                    */
/* ------------------------------------------------------------------ */
.how-to {
  margin-top: 48px;
  max-width: 520px;
  width: 100%;
}

.how-to h3 {
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.steps { display: flex; flex-direction: column; gap: 10px; }

.step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: 12px;
  padding: 14px 16px;
}

.step-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--amber);
  background: rgba(232, 147, 106, 0.08);
  border-radius: 6px;
  padding: 3px 8px;
  flex-shrink: 0;
}

.step p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.step p strong { color: var(--text); }

/* ------------------------------------------------------------------ */
/* [06] DATA PROCESSING STATE (LOADING)                               */
/* ------------------------------------------------------------------ */
#screen-loading {
  flex-direction: column;
  gap: 32px;
  text-align: center;
}

.loader-ring {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(232, 147, 106, 0.1);
  border-top-color: var(--amber);
  animation: spin 0.9s linear infinite;
}

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

.loading-text { font-size: 1.1rem; color: var(--text-dim); }

.loading-text strong {
  color: var(--text);
  display: block;
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* ------------------------------------------------------------------ */
/* [07] EXCEPTION HANDLING (ERROR)                                    */
/* ------------------------------------------------------------------ */
#screen-error {
  flex-direction: column;
  gap: 20px;
  text-align: center;
  padding: 40px;
}

.error-icon { font-size: 3rem; }

#error-message {
  color: var(--rose);
  font-size: 1rem;
  max-width: 400px;
}

.btn-retry {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 12px 28px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-retry:hover { border-color: var(--amber); color: var(--amber); }

/* ------------------------------------------------------------------ */
/* [08] ANALYTICS DASHBOARD (RESULTS)                                 */
/* ------------------------------------------------------------------ */
#screen-results {
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  padding: 0;
}

.results-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 48px;
}

.results-title {
  font-family: var(--mono);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--amber) 0%, var(--rose) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.results-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.results-meta span { font-size: 0.85rem; color: var(--text-dim); }
.results-meta strong { color: var(--text); }

.btn-new {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 8px 18px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.btn-new:hover { border-color: var(--amber); color: var(--amber); }

/* --- Stats Visualization Layout --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--radius);
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
  animation: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--amber), var(--rose));
  opacity: 0.5;
}

.stat-card .label {
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.stat-card .value {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
  line-height: 1;
}

.stat-card .sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* --- Content Dividers --- */
.section-title {
  font-size: 0.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-b);
}

/* --- Personality Matrices --- */
.personalities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.personality-card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--radius);
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.personality-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.15);
}

.personality-card .glow {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  filter: blur(60px);
  top: -40px; right: -40px;
  opacity: 0.3;
}

.p-author {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.p-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.p-tone {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-top: 10px;
  font-weight: 500;
}

.tone-positive { background: rgba(123, 169, 154, 0.14); color: var(--sage); }
.tone-negative { background: rgba(201, 123, 138, 0.14); color: var(--rose); }
.tone-neutral  { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); }

/* --- Charts Framework --- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.chart-card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--radius);
  padding: 20px;
  overflow: hidden;
  animation: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.chart-card.col-6  { grid-column: span 6; }
.chart-card.col-7  { grid-column: span 7; }
.chart-card.col-5  { grid-column: span 5; }
.chart-card.col-12 { grid-column: span 12; }

@media (max-width: 768px) {
  .chart-card.col-6, .chart-card.col-7, .chart-card.col-5 { grid-column: span 12; }
}

.author-words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

/* ------------------------------------------------------------------ */
/* [09] COMPONENT OVERRIDES & ANIMATION ENGINE                        */
/* ------------------------------------------------------------------ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Staggered Delay System */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* Plotly Interface Optimization */
.js-plotly-plot .plotly .modebar { 
  display: none !important; 
}

.home {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* END OF SPECIFICATIONS */