/* ==========================================================================
   LeadXP IVR Stylesheet - Premium Dark Glassmorphic Design System
   ========================================================================== */

/* Design Tokens & Variables */
:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  
  /* Color Palette */
  --bg-primary: #080c14;
  --bg-secondary: #0d1321;
  --glass-bg: rgba(13, 19, 33, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(6, 180, 212, 0.4);
  
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.4);
  --accent: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.4);
  --violet: #8b5cf6;
  --violet-glow: rgba(139, 92, 246, 0.3);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
  
  /* Shadows & Radius */
  --card-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  --glow-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Ambient Backlighting */
.ambient-light-1 {
  position: absolute;
  top: -10%;
  left: 10%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, var(--violet-glow) 0%, rgba(139, 92, 246, 0) 70%);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
  animation: pulse-ambient 12s infinite alternate;
}

.ambient-light-2 {
  position: absolute;
  bottom: -10%;
  right: 10%;
  width: 45vw;
  height: 45vw;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, rgba(6, 182, 212, 0) 75%);
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
  animation: pulse-ambient 15s infinite alternate-reverse;
}

@keyframes pulse-ambient {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.15) translate(5%, 5%); }
}

/* App Container Layout */
.app-container {
  width: 100%;
  max-width: 1280px;
  min-height: 90vh;
  margin: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 10;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding: 10px 20px;
  background: rgba(13, 19, 33, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

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

.logo-icon {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px var(--primary-glow));
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.accent-text {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}

.status-indicator-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  transition: var(--transition);
}

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-dot.offline {
  background-color: var(--error);
  box-shadow: 0 0 10px var(--error);
}

/* Main Layout Grid */
.main-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 25px;
  margin-bottom: 25px;
  align-items: stretch;
}

@media (max-width: 968px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Glassmorphic Cards */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

/* Form Section */
.form-card {
  padding: 35px;
  display: flex;
  flex-direction: column;
}

.card-header {
  margin-bottom: 25px;
}

.card-header h2 {
  font-size: 1.7rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.card-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Input Fields & Groups */
.lead-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-grow: 1;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.input-group label i {
  color: var(--accent);
}

.optional-label {
  font-size: 0.75rem;
  color: var(--text-dark);
  font-style: italic;
}

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

.input-wrapper input,
.input-wrapper textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.input-wrapper textarea {
  resize: vertical;
}

.input-wrapper input::placeholder,
.input-wrapper textarea::placeholder {
  color: var(--text-dark);
}

.input-wrapper input:hover,
.input-wrapper textarea:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Custom animated border on focus */
.input-focus-line {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
  border-radius: 20px;
  pointer-events: none;
}

.input-wrapper input:focus ~ .input-focus-line,
.input-wrapper textarea:focus ~ .input-focus-line {
  width: 90%;
}

.input-wrapper input:focus,
.input-wrapper textarea:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-border-focus);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.1);
}

.error-msg {
  color: var(--error);
  font-size: 0.8rem;
  display: none;
  animation: fadeIn 0.2s ease;
  margin-top: 2px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Submit Button */
.submit-btn {
  margin-top: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--primary-glow);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
}

.submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

.submit-btn:hover::before {
  left: 100%;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5), 0 0 15px var(--accent-glow);
  filter: brightness(1.1);
}

.submit-btn:active {
  transform: translateY(1px);
}

.submit-btn .btn-spinner {
  display: none;
}

.submit-btn.submitting .btn-text {
  opacity: 0.7;
}

.submit-btn.submitting .btn-spinner {
  display: inline-block;
}

.submit-btn.submitting {
  pointer-events: none;
  background: linear-gradient(135deg, #1e293b, #334155);
  box-shadow: none;
}

/* Overlay Status Card */
.status-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.status-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.status-content {
  text-align: center;
  max-width: 320px;
  display: none;
  animation: scaleUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleUp {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.status-content.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.success-icon-wrapper,
.error-icon-wrapper {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  margin-bottom: 20px;
}

.success-icon-wrapper {
  background-color: var(--success-glow);
  border: 1px solid var(--success);
  color: var(--success);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.25);
  animation: bounceCheck 0.5s ease-out;
}

.error-icon-wrapper {
  background-color: var(--error-glow);
  border: 1px solid var(--error);
  color: var(--error);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.25);
  animation: wobbleError 0.5s ease-in-out;
}

@keyframes bounceCheck {
  0% { transform: scale(0.3); }
  50% { transform: scale(1.1); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes wobbleError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.status-content h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.status-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 25px;
}

.action-btn {
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

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

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

/* Console Section */
.console-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-color: rgba(6, 182, 212, 0.12);
  min-height: 480px;
}

.console-header {
  background: rgba(8, 12, 20, 0.8);
  padding: 12px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.console-controls {
  display: flex;
  gap: 6px;
}

.console-controls .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.console-controls .dot.red { background-color: #ff5f56; }
.console-controls .dot.yellow { background-color: #ffbd2e; }
.console-controls .dot.green { background-color: #27c93f; }

.console-title {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.console-title i {
  color: var(--accent);
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  padding: 2px;
}

.clear-btn:hover {
  color: var(--error);
}

.console-body {
  flex-grow: 1;
  background: #04060b;
  padding: 20px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-y: auto;
  color: #38bdf8;
  max-height: 430px;
}

/* Custom Scrollbar for Console */
.console-body::-webkit-scrollbar {
  width: 8px;
}

.console-body::-webkit-scrollbar-track {
  background: #04060b;
}

.console-body::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 10px;
}

.console-body::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Console Log Syntax Styling */
.log-line {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.log-line.system { color: #38bdf8; } /* Light Blue */
.log-line.request { color: #f59e0b; } /* Yellow */
.log-line.success { color: #10b981; } /* Emerald */
.log-line.error { color: #f43f5e; } /* Rose */
.log-line.info { color: #a855f7; } /* Purple */

.log-header-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.log-timestamp {
  color: var(--text-dark);
  white-space: nowrap;
}

.log-text {
  word-break: break-all;
}

.log-payload {
  margin-top: 4px;
  margin-left: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-all;
  color: #e2e8f0;
}

/* App Footer Styling */
.app-footer {
  margin-top: 25px;
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  color: var(--text-dark);
}

@media (max-width: 600px) {
  .app-footer {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-link {
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-link:hover {
  color: var(--accent);
}
