/* ========================================
   AI Demo Showcase - Styles
   Design System based on stock_info
   ======================================== */

/* ========== CSS Variables ========== */
:root {
  --primary: #f5b300;
  --primary-hover: #e5a500;
  --primary-weak: #fde68a;
  --secondary: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --text-primary: #0f172a;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  
  --card: #ffffff;
  --background: #fafafa;
  --border: #e5e7eb;
  --tab-bg: #f3f4f6;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.12);
  
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  
  --transition: all 0.3s ease;
}

/* ========== Reset & Base ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== Header ========== */
.header {
  background: linear-gradient(135deg, #f5b300 0%, #e5a500 100%);
  color: white;
  padding: 48px 0 40px;
  box-shadow: var(--shadow-lg);
}

.header-content {
  text-align: center;
  margin-bottom: 24px;
}

.header-title {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 12px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-subtitle {
  font-size: 18px;
  opacity: 0.95;
  font-weight: 400;
}

.breadcrumb {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  opacity: 0.9;
}

.breadcrumb .separator {
  opacity: 0.6;
}

.breadcrumb .current {
  font-weight: 600;
}

/* ========== Main Content ========== */
.main-content {
  padding: 48px 0 80px;
}

/* ========== Section ========== */
.section {
  margin-bottom: 80px;
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-title {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.section-description {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto;
}

/* ========== Industry Cards Grid ========== */
.industry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 24px;
}

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

/* ========== Industry Card ========== */
.industry-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
  border: 2px solid transparent;
}

.industry-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.card-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.card-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.card-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-description {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.btn-expand {
  width: 100%;
  padding: 16px 24px;
  background: var(--background);
  border: none;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-expand:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
}

.btn-expand .icon-chevron {
  transition: transform 0.3s ease;
}

.industry-card.expanded .btn-expand .icon-chevron {
  transform: rotate(180deg);
}

.card-expanded {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
}

.industry-card.expanded .card-expanded {
  max-height: 2000px;
}

.expanded-content {
  padding: 32px 24px;
  background: linear-gradient(to bottom, #f8fafc 0%, #ffffff 100%);
}

.expanded-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* ========== Benefit List ========== */
.benefit-list {
  list-style: none;
  margin-bottom: 24px;
}

.benefit-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.benefit-list li:last-child {
  border-bottom: none;
}

.benefit-list strong {
  color: var(--primary);
  font-weight: 600;
}

/* ========== Metrics Row ========== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.metric-item {
  text-align: center;
  padding: 20px;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 8px;
}

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

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

/* ========== Demo Area ========== */
.demo-area {
  background: white;
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 2px dashed var(--border);
}

.demo-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.demo-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.demo-form {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.demo-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: var(--transition);
}

.demo-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 179, 0, 0.15);
}

.btn-demo {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

.btn-demo:active {
  transform: translateY(0);
}

.demo-output {
  min-height: 60px;
  padding: 16px;
  background: var(--background);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.demo-output:empty {
  display: none;
}

/* ========== Financial Analysis Modules ========== */
.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 32px;
}

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

.finance-module {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  border: 2px solid transparent;
}

.finance-module:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.module-header {
  padding: 32px;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.module-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.module-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.module-description {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ========== Module Form ========== */
.module-form {
  padding: 32px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: var(--transition);
  background: white;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 179, 0, 0.15);
}

.form-group select[multiple] {
  height: 120px;
}

.form-group small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.btn-analyze {
  width: 100%;
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-analyze:active {
  transform: translateY(0);
}

/* ========== Module Output ========== */
.module-output {
  padding: 32px;
  background: var(--background);
  min-height: 150px;
  border-top: 1px solid var(--border);
}

.module-output:empty {
  display: none;
}

/* ========== General AI Capabilities ========== */
.general-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.general-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  transition: var(--transition);
  border: 2px solid transparent;
}

.general-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.general-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.general-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.general-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.general-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.general-input {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
}

.general-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 179, 0, 0.15);
}

.btn-general {
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

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

.general-output {
  text-align: left;
  padding: 16px;
  background: var(--background);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  border: 1px solid var(--border);
  min-height: 80px;
}

.general-output:empty {
  display: none;
}

/* ========== Loading States ========== */
.loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 12px 0;
}

.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-style: italic;
}

.thinking::after {
  content: '...';
  display: inline-block;
  animation: thinking-dots 1.5s infinite;
}

@keyframes thinking-dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

/* ========== Typewriter Effect ========== */
.typing::after {
  content: '|';
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* ========== Markdown Rendering ========== */
.demo-output h1,
.demo-output h2,
.demo-output h3,
.module-output h1,
.module-output h2,
.module-output h3,
.general-output h1,
.general-output h2,
.general-output h3 {
  color: var(--text-primary);
  margin-top: 20px;
  margin-bottom: 12px;
  font-weight: 700;
}

.demo-output h1,
.module-output h1,
.general-output h1 {
  font-size: 24px;
}

.demo-output h2,
.module-output h2,
.general-output h2 {
  font-size: 20px;
}

.demo-output h3,
.module-output h3,
.general-output h3 {
  font-size: 18px;
}

.demo-output ul,
.demo-output ol,
.module-output ul,
.module-output ol,
.general-output ul,
.general-output ol {
  margin: 12px 0;
  padding-left: 24px;
}

.demo-output li,
.module-output li,
.general-output li {
  margin: 6px 0;
}

.demo-output p,
.module-output p,
.general-output p {
  margin: 12px 0;
}

.demo-output strong,
.module-output strong,
.general-output strong {
  font-weight: 700;
  color: var(--text-primary);
}

.demo-output code,
.module-output code,
.general-output code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--danger);
}

.demo-output pre,
.module-output pre,
.general-output pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 16px 0;
}

.demo-output pre code,
.module-output pre code,
.general-output pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.demo-output blockquote,
.module-output blockquote,
.general-output blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.demo-output table,
.module-output table,
.general-output table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.demo-output th,
.demo-output td,
.module-output th,
.module-output td,
.general-output th,
.general-output td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

.demo-output th,
.module-output th,
.general-output th {
  background: var(--background);
  font-weight: 700;
}

/* ========== Error Messages ========== */
.error {
  background: #fef2f2;
  color: var(--danger);
  padding: 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--danger);
  font-size: 14px;
  margin: 12px 0;
}

.success {
  background: #f0fdf4;
  color: var(--success);
  padding: 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--success);
  font-size: 14px;
  margin: 12px 0;
}

/* ========== Footer ========== */
.footer {
  background: var(--text-primary);
  color: white;
  padding: 40px 0;
  text-align: center;
}

.footer p {
  margin: 8px 0;
  opacity: 0.9;
}

.footer-note {
  font-size: 14px;
  opacity: 0.7;
  font-style: italic;
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
  .header-title {
    font-size: 36px;
  }
  
  .section-title {
    font-size: 30px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .header {
    padding: 32px 0 24px;
  }
  
  .header-title {
    font-size: 28px;
  }
  
  .header-subtitle {
    font-size: 16px;
  }
  
  .main-content {
    padding: 32px 0 48px;
  }
  
  .section {
    margin-bottom: 48px;
  }
  
  .section-title {
    font-size: 24px;
  }
  
  .section-description {
    font-size: 16px;
  }
  
  .demo-form {
    flex-direction: column;
  }
  
  .btn-demo {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .header-title {
    font-size: 24px;
  }
  
  .card-icon,
  .module-icon,
  .general-icon {
    font-size: 40px;
  }
  
  .card-title,
  .module-title {
    font-size: 20px;
  }
}

/* ========== Print Styles ========== */
@media print {
  .header,
  .footer,
  .btn-expand,
  .btn-demo,
  .btn-analyze,
  .btn-general,
  .demo-form,
  .module-form,
  .general-form {
    display: none;
  }
  
  .industry-card,
  .finance-module,
  .general-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ========== Accessibility ========== */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

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

.fade-in {
  animation: fadeIn 0.5s ease;
}

/* ========== Utility Classes ========== */
.text-center {
  text-align: center;
}

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

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

.hidden {
  display: none !important;
}

