/* ============================================
   FLOWIE ROI CALCULATOR - STYLES
   ============================================ */

:root {
  /* Brand Colors */
  --primary: #7B61FF;
  --primary-dark: #5B41DF;
  --primary-light: #9B81FF;
  --secondary: #10B981;
  --secondary-dark: #059669;
  --accent: #EC4899;

  /* Neutrals */
  --dark: #1F2937;
  --gray-700: #374151;
  --gray-600: #4B5563;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-300: #D1D5DB;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --white: #FFFFFF;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Spacing */
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-100);
  color: var(--dark);
  line-height: 1.5;
}

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

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-toggle {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
}

.lang-toggle button {
  padding: 6px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-600);
  transition: all 0.2s;
}

.lang-toggle button.active {
  background: var(--primary);
  color: var(--white);
}

/* PPT Button */
.ppt-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ppt-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.ppt-button .badge {
  background: var(--white);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 24px;
  padding: 24px 0;
  min-height: calc(100vh - 60px);
}

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

/* Left Panel - ROI Summary + Modules */
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ============================================
   LEFT PANEL - MODULES
   ============================================ */

.modules-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.module-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.2s;
}

.module-card:hover {
  box-shadow: var(--shadow-md);
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.module-header:hover {
  background: var(--gray-50);
}

.module-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.module-icon {
  font-size: 24px;
}

.module-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
}

.module-description {
  font-size: 13px;
  color: var(--gray-500);
}

.module-savings {
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-savings-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--secondary);
}

.module-toggle {
  color: var(--gray-400);
  transition: transform 0.2s;
}

.module-card.expanded .module-toggle {
  transform: rotate(180deg);
}

.module-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--gray-200);
}

.module-card.expanded .module-body {
  display: block;
}

/* Form Fields */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

.form-input {
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.1);
}

.form-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--gray-200);
  outline: none;
}

.form-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.slider-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-align: right;
}

/* ============================================
   CALCULATION INFO (Foldable)
   ============================================ */

.calc-info-container {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.calc-info-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.2s;
}

.calc-info-toggle:hover {
  background: var(--gray-100);
  border-color: var(--primary);
}

.calc-info-arrow {
  margin-left: auto;
  transition: transform 0.2s;
}

.calc-info-toggle.expanded .calc-info-arrow {
  transform: rotate(180deg);
}

.calc-info-body {
  display: none;
  margin-top: 12px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: 13px;
}

.calc-info-section {
  margin-bottom: 16px;
}

.calc-info-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.calc-info-item {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.calc-info-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.calc-info-item-label {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.calc-info-item-formula {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: var(--gray-600);
  background: var(--white);
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  border-left: 3px solid var(--primary);
}

.calc-info-item-explanation {
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.5;
}

.calc-info-benchmarks {
  padding: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.6;
}

.calc-info-benchmarks strong {
  display: block;
  margin-bottom: 4px;
}

/* ============================================
   RIGHT PANEL - AI ASSISTANT
   ============================================ */

.right-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 80px;
  height: calc(100vh - 100px);
}

.roi-summary {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}

.roi-summary-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 12px;
}

.roi-total {
  text-align: center;
  padding: 14px 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  color: var(--white);
  margin-bottom: 12px;
}

.roi-total-label {
  font-size: 12px;
  opacity: 0.9;
}

.roi-total-value {
  font-size: 26px;
  font-weight: 700;
  margin: 4px 0;
}

.roi-total-sublabel {
  font-size: 11px;
  opacity: 0.8;
}

.roi-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.roi-breakdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.roi-breakdown-icon {
  font-size: 16px;
}

.roi-breakdown-info {
  flex: 1;
}

.roi-breakdown-name {
  font-size: 11px;
  color: var(--gray-600);
}

.roi-breakdown-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.roi-breakdown-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.roi-breakdown-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--dark);
  min-width: 70px;
  text-align: right;
}

.roi-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-200);
}

.roi-metric {
  text-align: center;
  padding: 8px;
  background: var(--gray-50);
  border-radius: var(--radius);
}

.roi-metric-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary);
}

.roi-metric-label {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* Book Demo Button */
.demo-button {
  width: 100%;
  padding: 10px;
  background: var(--secondary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
}

.demo-button:hover {
  background: var(--secondary-dark);
}

/* ============================================
   AI AGENT CHAT
   ============================================ */

.agent-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
}

.agent-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}

.agent-body {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.agent-panel.expanded .agent-body {
  display: flex;
}

.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
}

.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--white);
}

.message.assistant {
  align-self: flex-start;
  background: var(--gray-100);
  color: var(--dark);
}

/* Markdown formatting in assistant messages */
.message.assistant p {
  margin: 0 0 8px 0;
}

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

.message.assistant strong {
  font-weight: 600;
  color: var(--dark);
}

.message.assistant em {
  font-style: italic;
}

.message.assistant h1,
.message.assistant h2,
.message.assistant h3 {
  margin: 12px 0 8px 0;
  font-weight: 600;
  color: var(--dark);
}

.message.assistant h1 {
  font-size: 18px;
}

.message.assistant h2 {
  font-size: 16px;
}

.message.assistant h3 {
  font-size: 14px;
}

.message.assistant ul,
.message.assistant ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message.assistant li {
  margin: 4px 0;
}

.message.assistant code {
  background: var(--white);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: var(--primary);
}

.agent-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--gray-200);
}

.agent-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
}

.agent-input:focus {
  border-color: var(--primary);
}

.agent-send {
  padding: 10px 16px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.agent-send:hover {
  background: var(--primary-dark);
}

.agent-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--gray-100);
  border-radius: var(--radius);
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--gray-400);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

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

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

/* ============================================
   ANIMATIONS
   ============================================ */

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

.animate-in {
  animation: fadeIn 0.3s ease;
}

/* Number counter animation */
.counter {
  transition: all 0.3s ease;
}

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

@media (max-width: 1024px) {
  .right-panel {
    position: static;
    height: auto;
  }

  .agent-body {
    height: 400px;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
    gap: 12px;
  }

  .ppt-button span {
    display: none;
  }

  .roi-total-value {
    font-size: 22px;
  }

  .roi-summary {
    padding: 12px;
  }

  .agent-body {
    height: 350px;
  }
}

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

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.text-primary {
  color: var(--primary);
}

.text-secondary {
  color: var(--secondary);
}

.text-gray {
  color: var(--gray-500);
}

.mt-4 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 16px;
}
