/**
 * Aliff Financial Advisor - Styles
 * Next-generation AI-powered financial analysis platform
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
  /* Brand Colors */
  --gold-primary: hsl(43, 62%, 60%);
  --gold-dark: hsl(43, 62%, 48%);
  --gold-light: hsl(45, 75%, 70%);
  --victory-green: hsl(142, 76%, 46%);
  --navy: hsl(215, 28%, 17%);
  --navy-dark: hsl(215, 28%, 12%);
  --navy-light: hsl(215, 28%, 25%);

  /* UI Colors */
  --bg-primary: hsl(210, 40%, 98%);
  --bg-secondary: hsl(0, 0%, 100%);
  --text-primary: var(--navy);
  --text-secondary: hsl(215, 16%, 47%);
  --text-muted: hsl(215, 15%, 65%);
  --border: hsl(210, 6%, 88%);

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.2);
}

/* ============================================
   RESET & BASE
   ============================================ */

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
}

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

.advisor-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.logo {
  height: 48px;
  width: auto;
}

.header-title h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--space-1);
}

.header-title p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */

.advisor-main {
  min-height: calc(100vh - 80px);
  padding: 0;
}

.advisor-container {
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 45% 55%;
  height: calc(100vh - 80px);
  background: var(--bg-primary);
}

/* ============================================
   CONVERSATION PANEL (Left)
   ============================================ */

.conversation-panel {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.conversation-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.aliff-avatar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.avatar-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-lg);
  animation: avatarPulse 3s ease-in-out infinite;
}

.avatar-circle svg {
  width: 28px;
  height: 28px;
}

@keyframes avatarPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 10px 15px rgba(200, 157, 92, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 15px 25px rgba(200, 157, 92, 0.4);
  }
}

.avatar-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--victory-green);
  animation: statusBlink 2s ease-in-out infinite;
}

@keyframes statusBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Messages Area */
.conversation-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  scroll-behavior: smooth;
}

.message {
  display: flex;
  gap: var(--space-3);
  animation: messageSlideIn 0.4s ease;
}

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

.aliff-message {
  align-items: flex-start;
}

.user-message {
  align-items: flex-start;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.message-avatar svg {
  width: 20px;
  height: 20px;
}

.user-message .message-avatar {
  background: var(--navy);
}

.message-content {
  max-width: 75%;
}

.message-text {
  padding: var(--space-4);
  border-radius: 1rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.aliff-message .message-text {
  background: linear-gradient(135deg, rgba(200, 157, 92, 0.1) 0%, rgba(200, 157, 92, 0.05) 100%);
  border: 1px solid rgba(200, 157, 92, 0.2);
  border-top-left-radius: 0;
}

.user-message .message-text {
  background: var(--navy);
  color: white;
  border-top-right-radius: 0;
}

.message-text p {
  margin-bottom: var(--space-3);
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text strong {
  color: var(--gold-dark);
  font-weight: 700;
}

.user-message .message-text strong {
  color: var(--gold-light);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4);
  background: rgba(200, 157, 92, 0.1);
  border-radius: 1rem;
  border-top-left-radius: 0;
  width: fit-content;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-primary);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* ============================================
   INPUT AREA
   ============================================ */

.conversation-input {
  padding: var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.input-wrapper {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

#userInput {
  flex: 1;
  padding: var(--space-4);
  border: 2px solid var(--border);
  border-radius: 1rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  transition: all var(--transition-base);
}

#userInput:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(200, 157, 92, 0.1);
}

.send-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.send-button:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: scale(1);
}

.send-button svg {
  width: 20px;
  height: 20px;
}

/* Suggestions */
.input-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.suggestion-btn {
  padding: var(--space-2) var(--space-4);
  background: rgba(200, 157, 92, 0.1);
  border: 1px solid rgba(200, 157, 92, 0.3);
  border-radius: var(--space-6);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--gold-dark);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-btn:hover {
  background: rgba(200, 157, 92, 0.2);
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}

/* Progress Indicator */
.progress-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(200, 157, 92, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  transition: width var(--transition-slow);
}

.progress-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 80px;
  text-align: right;
}

/* ============================================
   DASHBOARD PANEL (Right)
   ============================================ */

.dashboard-panel {
  background: var(--bg-primary);
  padding: var(--space-8);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.dashboard-header h2 {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: var(--space-2);
}

.dashboard-header p {
  color: var(--text-secondary);
  margin: 0;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.metric-card {
  background: var(--bg-secondary);
  padding: var(--space-5);
  border-radius: 1rem;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.metric-icon svg {
  width: 24px;
  height: 24px;
}

.metric-content {
  flex: 1;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  font-weight: 600;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
}

/* Charts */
.chart-container {
  background: var(--bg-secondary);
  padding: var(--space-6);
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Insights Panel */
.insights-panel {
  background: var(--bg-secondary);
  padding: var(--space-6);
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.insights-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.insights-header svg {
  width: 24px;
  height: 24px;
  color: var(--gold-primary);
}

.insights-header h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.insight-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  background: rgba(200, 157, 92, 0.05);
  border-left: 3px solid var(--gold-primary);
  border-radius: 0.5rem;
}

.insight-item svg {
  width: 20px;
  height: 20px;
  color: var(--gold-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.insight-item p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Report CTA */
.report-cta {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  padding: var(--space-8);
  border-radius: 1rem;
  color: white;
  box-shadow: var(--shadow-xl);
}

.report-preview {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.report-preview svg {
  width: 48px;
  height: 48px;
  color: var(--gold-light);
}

.report-info h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.report-info p {
  margin: 0;
  opacity: 0.9;
}

.report-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  padding: var(--space-3) var(--space-6);
  border-radius: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--transition-base);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.btn-primary svg,
.btn-secondary svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
  .advisor-container {
    grid-template-columns: 1fr;
    height: auto;
  }

  .conversation-panel {
    height: 80vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .dashboard-panel {
    height: auto;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 var(--space-4);
  }

  .logo {
    height: 40px;
  }

  .header-title h1 {
    font-size: 1rem;
  }

  .dashboard-panel {
    padding: var(--space-4);
  }

  .conversation-messages {
    padding: var(--space-4);
  }

  .conversation-input {
    padding: var(--space-4);
  }

  .message-content {
    max-width: 85%;
  }

  .report-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden {
  display: none !important;
}

/* Scrollbar Styling */
.conversation-messages::-webkit-scrollbar,
.dashboard-panel::-webkit-scrollbar {
  width: 8px;
}

.conversation-messages::-webkit-scrollbar-track,
.dashboard-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.conversation-messages::-webkit-scrollbar-thumb,
.dashboard-panel::-webkit-scrollbar-thumb {
  background: var(--gold-primary);
  border-radius: 4px;
}

.conversation-messages::-webkit-scrollbar-thumb:hover,
.dashboard-panel::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dark);
}

/* ============================================
   DISCLAIMER MODAL
   ============================================ */

.disclaimer-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: var(--space-6);
}

.disclaimer-content {
  background: var(--bg-secondary);
  max-width: 700px;
  width: 100%;
  border-radius: 1.5rem;
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.disclaimer-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(200, 157, 92, 0.1) 0%, rgba(200, 157, 92, 0.05) 100%);
}

.disclaimer-header svg {
  width: 32px;
  height: 32px;
  color: var(--gold-primary);
}

.disclaimer-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.disclaimer-body {
  padding: var(--space-8);
}

.disclaimer-body h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--space-3);
  margin-top: var(--space-6);
}

.disclaimer-body h3:first-child {
  margin-top: 0;
}

.disclaimer-body p {
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

.disclaimer-body p:last-of-type {
  margin-bottom: 0;
}

.disclaimer-footer {
  margin-top: var(--space-6) !important;
  padding: var(--space-4);
  background: rgba(200, 157, 92, 0.1);
  border-left: 3px solid var(--gold-primary);
  border-radius: 0.5rem;
  font-weight: 600;
  color: var(--navy) !important;
}

.disclaimer-actions {
  padding: var(--space-6) var(--space-8);
  padding-top: var(--space-4);
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.btn-accept {
  flex: 1;
  padding: var(--space-4) var(--space-6);
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-accept svg {
  width: 20px;
  height: 20px;
}

.btn-decline {
  padding: var(--space-4) var(--space-6);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  display: inline-block;
}

.btn-decline:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.disclaimer-links {
  padding: 0 var(--space-8) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-size: 0.875rem;
}

.disclaimer-links a {
  color: var(--gold-dark);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.disclaimer-links a:hover {
  color: var(--gold-primary);
  text-decoration: underline;
}

.disclaimer-links span {
  color: var(--text-muted);
}

/* ============================================
   FOOTER
   ============================================ */

.advisor-footer {
  background: var(--navy);
  color: white;
  padding: var(--space-6) 0;
  margin-top: auto;
}

.footer-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.footer-disclaimer {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: rgba(200, 157, 92, 0.1);
  border-left: 3px solid var(--gold-primary);
  border-radius: 0.5rem;
}

.footer-disclaimer strong {
  color: var(--gold-light);
  font-weight: 700;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--gold-light);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--gold-primary);
  text-decoration: underline;
}

.footer-links span {
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
  .disclaimer-modal {
    padding: var(--space-4);
  }

  .disclaimer-header,
  .disclaimer-body,
  .disclaimer-actions,
  .disclaimer-links {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .disclaimer-actions {
    flex-direction: column;
  }

  .btn-accept,
  .btn-decline {
    width: 100%;
    text-align: center;
  }

  .footer-links {
    flex-direction: column;
    gap: var(--space-2);
  }
}
