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

/* OPEN DESIGN SYSTEM - PREMIUM DARK MODE & GLASSMORPHISM */
:root {
  /* Colors */
  --bg-darker: #06080F;
  --bg-dark: #0A0D17;
  --bg-card: rgba(17, 21, 36, 0.4);
  --bg-card-hover: rgba(22, 28, 48, 0.6);
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;

  /* Accents */
  --accent-primary: #7C3AED;
  --accent-primary-hover: #8B5CF6;
  --accent-primary-glow: rgba(124, 58, 237, 0.25);

  --accent-secondary: #EC4899;
  --accent-secondary-glow: rgba(236, 72, 153, 0.25);

  /* Semantic */
  --status-positive: #10B981;
  --status-neutral: #6366F1;
  --status-negative: #EF4444;

  /* Borders & Shadows */
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(124, 58, 237, 0.5);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 20px var(--accent-primary-glow);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;

  /* Typography */
  --font-display: 'Outfit', sans-serif;
  --font-sans: 'Inter', sans-serif;

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-darker);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Mesh Background */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, var(--accent-primary-glow) 0%, transparent 60%);
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, var(--accent-secondary-glow) 0%, transparent 60%);
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
}

/* HUD Layout */
.app-container {
  display: flex;
  height: 100vh;
}

/* Glass Sidebar */
.glass-sidebar {
  width: 280px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
}
.brand-icon svg {
  width: 28px;
  height: 28px;
  stroke: url(#brand-gradient); /* Will use JS/Inline or fallback */
  color: var(--accent-secondary);
}
.brand-text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.text-accent {
  color: var(--accent-primary);
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.nav-item {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  text-align: left;
}
.nav-item svg {
  width: 20px;
  height: 20px;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}
.nav-item.active {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-footer {
  margin-top: auto;
}
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
}
.user-info {
  display: flex;
  flex-direction: column;
}
.user-name {
  font-size: 14px;
  font-weight: 600;
}
.user-role {
  font-size: 12px;
  color: var(--text-muted);
}

/* Main Workspace */
.workspace {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(236, 72, 153, 0.4);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  align-items: flex-start;
}

/* Glass Panels */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-glass);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}
.badge {
  background: rgba(255,255,255,0.05);
  padding: 4px 12px;
  border-radius: var(--radius-xl);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-light);
}
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--status-neutral);
}
.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--status-neutral);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--status-neutral);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(0.95); opacity: 1; }
}

/* Inputs */
.input-wrapper textarea {
  width: 100%;
  height: 240px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  resize: none;
  transition: var(--transition);
  margin-bottom: 16px;
}
.input-wrapper textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-primary-glow);
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.char-count {
  font-size: 13px;
  color: var(--text-muted);
}
.btn-glow {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-glow:hover {
  background: var(--accent-primary-glow);
  box-shadow: 0 0 15px var(--accent-primary-glow);
}

/* Results Content */
.results-content.hidden {
  display: none;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  gap: 16px;
  height: 300px;
}
.hologram-icon svg {
  width: 48px;
  height: 48px;
  stroke: var(--border-focus);
  opacity: 0.5;
}

/* Sentiment Row */
.sentiment-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.metric-card {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-light);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.metric-card.positive { border-top: 2px solid var(--status-positive); }
.metric-card.neutral { border-top: 2px solid var(--status-neutral); }
.metric-card.negative { border-top: 2px solid var(--status-negative); }

.metric-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.metric-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}

/* Breakdowns */
.breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.breakdown-card h4 {
  font-size: 15px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.glass-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.glass-list li {
  background: rgba(255,255,255,0.03);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.02);
}

.summary-card {
  background: rgba(0,0,0,0.15);
  padding: 20px;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-secondary);
}
.summary-card h4 {
  font-size: 15px;
  margin-bottom: 12px;
}
.glass-text {
  font-size: 14px;
  color: #D1D5DB;
  line-height: 1.7;
}

/* Loading Animation */
.analyzing .panel-header .badge {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  animation: pulse 1s infinite alternate;
}

/* Glassmorphic Auth Modal & History Styling */
.user-profile {
  cursor: pointer;
  transition: var(--transition);
}
.user-profile:hover {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: #0E1220;
  border: 1px solid var(--border-light);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 420px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.form-group label {
  font-size: 13px;
  color: var(--text-muted);
}
.form-group input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-sans);
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.auth-error {
  color: var(--status-negative);
  font-size: 13px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
}

.modal-footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.modal-footer a {
  color: var(--accent-primary);
  text-decoration: none;
}

/* History Cards */
.history-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}
.history-title {
  font-weight: 600;
  color: var(--text-main);
  font-size: 15px;
}

