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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #8b5cf6;
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --background: #ffffff;
  --background-alt: #f8fafc;
  --shadow: 0px 0px 0px 7px rgba(0, 0, 0, 0.05);
  --shadow-md: 0px 0px 0px 7px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0px 0px 0px 7px rgba(0, 0, 0, 0.05);
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--background);
  font-size: 16px;
}

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

/* Header */
header {
  padding: 20px 0;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

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

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

.logo img {
  max-width: 140px;
  height: auto;
}

.auth-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.button-outline {
  padding: 8px 16px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 14px;
}

.button-outline:hover {
  background: var(--primary);
  color: white;
}

.button {
  padding: 8px 16px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
}

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

@media (min-width: 640px) {
  .button {
    height: 40px;
    padding: 8px 20px;
    font-size: 16px;
  }
}

/* Hero Section */
.hero {
  padding: 80px 0;
  background: var(--background-alt);
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 60px;
}

.hero-text {
  flex: 1;
}

.hero-image {
  flex: 1;
  display: flex;
  justify-content: center;
}

.hero-image img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 24px;
  color: var(--text);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-light);
  margin-bottom: 32px;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: var(--gradient);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

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

/* Features Grid */
.features {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 60px;
  color: var(--text);
}

.features-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
}

.feature-card {
  flex: 1;
  min-width: 300px;
  max-width: 380px;
  background: var(--background);
  padding: 40px 30px;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  text-align: center;
  transition: all 0.3s ease;
}

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

.feature-icon {
  font-size: 48px;
  margin-bottom: 20px;
  display: block;
}

.feature-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.feature-card p {
  color: var(--text-light);
  line-height: 1.6;
}

/* FAQ Section */
/* FAQ Section - Исправленные стили */
.faq-section {
  padding: 80px 0;
}

.faq-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.faq-item.active {
  box-shadow: var(--shadow-md);
}

.faq-question {
  padding: 24px;
  background: var(--background);
  font-weight: 600;
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s ease;
  user-select: none;
}

.faq-question:hover {
  background: var(--background-alt);
}

.faq-answer {
  padding: 0 24px;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  color: var(--text-light);
  line-height: 1.6;
  opacity: 0;
  /* Убрано display: none */
}

.faq-item.active .faq-answer {
  padding: 0 24px 24px;
  max-height: 500px;
  opacity: 1;
  /* Добавлено display: block */
  display: block;
}

.faq-toggle {
  transition: transform 0.3s ease;
  font-size: 14px;
}

.faq-item.active .faq-toggle {
  transform: rotate(180deg);
}

/* Content Sections */
.content-section {
  padding: 80px 0;
}

.toc {
  background: var(--background);
  padding: 40px;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-bottom: 40px;
}

.toc h2 {
  margin-bottom: 24px;
  font-size: 1.75rem;
  font-weight: 600;
}

.toc-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  flex: 1;
  min-width: 200px;
  background: var(--background-alt);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.toc-item:hover {
  background: var(--primary-light);
  color: white;
  transform: translateY(-2px);
}

.toc-item::before {
  content: '→';
  color: var(--primary);
  transition: color 0.3s ease;
}

.toc-item:hover::before {
  color: white;
}

.article {
  background: var(--background);
  padding: 50px;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.article h2 {
  font-size: 2rem;
  font-weight: 700;
  margin: 60px 0 24px;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.article h2:first-child {
  margin-top: 0;
}

.article h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 40px 0 20px;
  color: var(--text);
}

.article p {
  margin-bottom: 20px;
  color: var(--text-light);
  line-height: 1.7;
}

.article ul {
  margin: 20px 0;
  padding-left: 24px;
}

.article li {
  margin-bottom: 12px;
  color: var(--text-light);
  line-height: 1.6;
}

.article strong {
  color: var(--text);
  font-weight: 600;
}

.article blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-light);
  font-style: italic;
}

/* Footer */
footer {
  background: var(--text);
  color: white;
  padding: 60px 0 30px;
  margin-top: 80px;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-section {
  flex: 1;
  min-width: 250px;
}

.footer-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  padding-top: 30px;
  border-top: 1px solid #374151;
  color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .hero-content {
    flex-direction: column;
    gap: 40px;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 1.75rem;
  }
  
  .feature-card {
    min-width: 100%;
  }
  
  .message {
    max-width: 90%;
  }
  
  .article {
    padding: 30px 24px;
  }
  
  .toc-item {
    min-width: 100%;
  }
  
  .chat-messages {
    height: 400px;
    padding: 16px;
  }
  
  .faq-question {
    padding: 20px;
    font-size: 1rem;
  }
  
  .faq-answer {
    padding: 0 20px;
  }
  
  .faq-item.active .faq-answer {
    padding: 0 20px 20px;
  }
  
  .auth-buttons {
    gap: 8px;
  }
  
  .button-outline {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .button {
    padding: 6px 12px;
    font-size: 12px;
    height: 28px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .feature-card {
    padding: 30px 20px;
  }
  
  .article h2 {
    font-size: 1.75rem;
  }
  
  .chat-header {
    padding: 20px;
  }
  
  .logo img {
    max-width: 120px;
  }
}




.chat-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0px 0px 0px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: #8b5cf6;
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.cost-display {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 16px;
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
    line-height: 1.6;
}

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

.user-message {
    background: #8b5cf6;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

.assistant-message {
    background: white;
    border: 1px solid #e0e0e0;
    margin-right: auto;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Стили для Markdown контента */
.assistant-message h1,
.assistant-message h2,
.assistant-message h3,
.assistant-message h4,
.assistant-message h5,
.assistant-message h6 {
    margin: 12px 0 8px 0;
    color: #333;
}

.assistant-message h1 { font-size: 1.4em; }
.assistant-message h2 { font-size: 1.3em; }
.assistant-message h3 { font-size: 1.2em; }
.assistant-message h4 { font-size: 1.1em; }
.assistant-message h5 { font-size: 1.0em; }
.assistant-message h6 { font-size: 0.9em; color: #666; }

.assistant-message p {
    margin: 8px 0;
}

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

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

.assistant-message blockquote {
    border-left: 4px solid #2196f3;
    padding-left: 16px;
    margin: 12px 0;
    color: #555;
    font-style: italic;
}

.assistant-message code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.assistant-message pre {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
}

.assistant-message pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.assistant-message table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
}

.assistant-message table th,
.assistant-message table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.assistant-message table th {
    background: #f5f5f5;
    font-weight: 600;
}

.assistant-message a {
    color: #2196f3;
    text-decoration: none;
}

.assistant-message a:hover {
    text-decoration: underline;
}

.typing-indicator {
    display: flex !important;
    align-items: center;
    color: #666;
    font-style: italic;
    background: white;
    border: 1px solid #e0e0e0;
    padding: 12px 18px;
    border-radius: 18px;
    margin-bottom: 16px;
    margin-right: auto;
    max-width: 80%;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    animation: fadeIn 0.3s ease-in;
}

.typing-dots {
    display: inline-flex;
    margin-left: 8px;
}

.typing-dots span {
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background-color: #666;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { 
    animation-delay: -0.32s; 
}
.typing-dots span:nth-child(2) { 
    animation-delay: -0.16s; 
}
.typing-dots span:nth-child(3) { 
    animation-delay: 0s; 
}

@keyframes typing {
    0%, 80%, 100% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Убедитесь, что эти стили не переопределяются другими правилами */
.message.typing-indicator {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
}

.message-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    font-size: 16px;
    transition: border-color 0.3s;
}

.message-input:focus {
    border-color: #2196f3;
}

.send-button {
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.send-button:hover {
    background: #1976d2;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

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

.welcome-message {
    text-align: left;
    color: #666;
    padding: 40px 20px;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    padding: 12px 18px;
    border-radius: 12px;
    margin: 10px 0;
}

@media (max-width: 768px) {
    .chat-container {
        height: 95vh;
        border-radius: 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    body {
        padding: 10px;
    }
}
.pro-cta {
  display: flex;
  justify-content: center;
  margin-top: 3rem;
  width: 100%;
}

.pro-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.pro-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}