/* ==========================================================================
   VOXSCRIBE PRO - DESIGN SYSTEM (VANILLA CSS)
   Theme: Vibrant Dark Glassmorphic with Neon Micro-Glows
   ========================================================================== */

:root {
  --bg-primary: #090a0f;
  --card-bg: rgba(18, 20, 32, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  
  /* Harmonious Color Palette */
  --color-primary: #00f2fe;     /* Neon Cyan */
  --color-secondary: #4facfe;   /* Electric Blue */
  --color-danger: #ff416c;      /* Hot Coral/Red */
  --color-success: #00f260;     /* Neon Green */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --input-bg: rgba(255, 255, 255, 0.04);
  
  /* Layout */
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset and Core Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  font-family: var(--font-family);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* Mobile-Friendly Safe Scrollbar */
::-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.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* Glowing Ambient Backgrounds */
.glass-bg-glow {
  position: fixed;
  top: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.12) 0%, rgba(79, 172, 254, 0) 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

.glass-bg-glow-secondary {
  position: fixed;
  bottom: -10%;
  right: -10%;
  width: 55%;
  height: 55%;
  background: radial-gradient(circle, rgba(255, 65, 108, 0.08) 0%, rgba(9, 10, 15, 0) 75%);
  z-index: -1;
  pointer-events: none;
  filter: blur(90px);
}

/* Layout Containers */
body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  min-height: 100vh;
}

.app-container {
  width: 100%;
  max-width: 480px;
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 10;
}

/* Card - Glassmorphism Container */
.card {
  width: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  animation: cardFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.card.active {
  display: flex;
}

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

/* Brand Headers */
.brand-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand-logo {
  font-size: 54px;
  margin-bottom: 12px;
  display: inline-block;
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.brand-header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.brand-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Forms & Inputs */
.input-group {
  margin-bottom: 24px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.input-group input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  outline: none;
  transition: var(--transition-smooth);
}

.input-group input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
  background: rgba(255, 255, 255, 0.07);
}

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  outline: none;
  overflow: hidden;
  transition: var(--transition-smooth);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #0575e6) 0%;
  box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #00f260 0%, #0575e6) 0%;
  box-shadow: 0 4px 15px rgba(0, 242, 96, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 96, 0.5);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-glow {
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  transition: 0.75s;
  pointer-events: none;
}

.btn:hover .btn-glow {
  left: 120%;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 16px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 26px;
}

.app-logo h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.vps-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 242, 96, 0.1);
  border: 1px solid rgba(0, 242, 96, 0.2);
  color: var(--color-success);
}

.vps-badge.local {
  background: rgba(255, 65, 108, 0.1);
  border: 1px solid rgba(255, 65, 108, 0.2);
  color: var(--color-danger);
}

/* Recorder Section */
.recorder-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  gap: 20px;
}

.status-indicator {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  display: inline-block;
}

.recording .status-indicator {
  color: var(--color-danger);
  animation: pulseColor 1.5s infinite;
}

.recording .status-indicator::before {
  background-color: var(--color-danger);
  animation: pulseBlink 1.5s infinite;
}

@keyframes pulseColor {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

@keyframes pulseBlink {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
}

.timer-display {
  font-size: 54px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

/* Sound Wave Canvas */
.wave-container {
  width: 100%;
  height: 80px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

#wave-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Record Button with Rings */
.record-trigger-container {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}

.record-button {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-danger) 0%, #ff416c) 0%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 10px 25px rgba(255, 65, 108, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  outline: none;
}

.record-icon {
  width: 32px;
  height: 32px;
  background-color: white;
  border-radius: 50%;
  transition: all 0.3s ease;
}

/* Morph to square when recording */
.recording .record-button {
  background: #fff;
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
}

.recording .record-icon {
  background-color: var(--color-danger);
  border-radius: 6px;
  transform: scale(0.85);
}

.pulse-ring {
  position: absolute;
  width: 100px;
  height: 100px;
  border: 1px solid var(--color-danger);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.recording .pulse-ring {
  animation: soundRing 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.recording .ring-2 {
  animation-delay: 0.6s;
}

@keyframes soundRing {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.record-button:active {
  transform: scale(0.92);
}

.helper-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: 16px;
  width: 100%;
  margin-top: 16px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.action-bar button {
  flex: 1;
}

/* Processing View */
.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 0;
}

.spinner-container {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 24px;
}

.double-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--color-primary);
  border-bottom-color: var(--color-secondary);
  animation: spin 1.5s cubic-bezier(0.53, 0.21, 0.29, 0.67) infinite;
}

.spinner-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px;
  animation: pulseCore 1.5s infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulseCore {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

.loader-content h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.loader-content p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* Progress bar */
.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 28px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  transition: width 0.4s ease;
  border-radius: 3px;
}

/* Processing Steps UI */
.processing-steps {
  width: 100%;
  text-align: left;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.step {
  font-size: 13.5px;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.step:last-child {
  margin-bottom: 0;
}

.step.active {
  color: var(--color-primary);
  font-weight: 500;
}

.step.complete {
  color: var(--color-success);
  font-weight: 500;
}

/* Report Screen Styling */
#report-screen {
  max-width: 800px;
  padding: 24px;
}

#report-screen .app-header {
  margin-bottom: 16px;
}

.report-actions {
  display: flex;
  gap: 8px;
}

.report-content-wrapper {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 24px;
  max-height: 62vh;
  overflow-y: auto;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Rendered Markdown Typography */
.markdown-body {
  font-size: 15px;
  line-height: 1.6;
  color: #e5e7eb;
}

.markdown-body h1 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 16px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.markdown-body h2 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--color-secondary);
}

.markdown-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 8px;
  color: #fff;
}

.markdown-body p {
  margin-bottom: 16px;
}

.markdown-body hr {
  height: 1px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  margin: 20px 0;
}

.markdown-body ul, .markdown-body ol {
  margin-bottom: 16px;
  padding-left: 20px;
}

.markdown-body li {
  margin-bottom: 6px;
}

/* Premium Markdown Table */
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13.5px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.markdown-body th {
  background: rgba(79, 172, 254, 0.15);
  color: var(--color-primary);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.markdown-body td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.markdown-body tr:last-child td {
  border-bottom: none;
}

.markdown-body blockquote {
  border-left: 4px solid var(--color-primary);
  background: rgba(0, 242, 254, 0.05);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Error Messages */
.error-message {
  color: var(--color-danger);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  font-weight: 500;
}

/* Footer */
.app-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  opacity: 0.6;
}

/* Safe area padding for iPhones with notch */
@supports (padding: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}
