/* ========================================
   БАЗОВЫЕ СТИЛИ И ПРЕДОТВРАЩЕНИЕ СКРОЛЛА
   ======================================== */

/* Предотвращение горизонтального скролла */


body {
    margin: 0;
    padding: 0;
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

/* Защита от переполнения контента */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Предотвращение переполнения текста */
h1, h2, h3, h4, h5, h6, p, span, a, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Защита длинных ссылок и URL */
a {
    word-break: break-word;
}

/* ========================================
   ALPINE.JS И ПЕРЕХОДЫ
   ======================================== */

/* Скрытие элементов Alpine.js до загрузки */
[x-cloak] {
    display: none !important;
}

/* Плавные переходы для важных свойств */
* {
    transition-property: color, background-color, border-color, box-shadow;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   КОНТЕЙНЕР С АДАПТИВНЫМИ ПАДДИНГАМИ
   ======================================== */

.container {
    max-width: 1280px;
    padding-left: 48px;
    padding-right: 48px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Большие экраны (от 1400px) */
@media (min-width: 1400px) {
    .container {
        padding-left: 64px;
        padding-right: 64px;
    }
}

/* Средние десктопы (1280px - 1399px) */
@media (min-width: 1280px) and (max-width: 1399px) {
    .container {
        padding-left: 48px;
        padding-right: 48px;
    }
}

/* Небольшие десктопы (1025px - 1279px) */
@media (min-width: 1025px) and (max-width: 1279px) {
    .container {
        padding-left: 40px;
        padding-right: 40px;
    }
}

/* Планшеты (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        padding-left: 32px;
        padding-right: 32px;
    }
}

/* Мобильные устройства (до 768px) */
@media (max-width: 768px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ========================================
   ЗАГОЛОВКИ - АДАПТИВНЫЕ РАЗМЕРЫ
   ======================================== */

/* Заголовок H1 */
h1 {
    font-size: 2.25rem; /* 36px */
    line-height: 2.5rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.875rem !important; /* 30px */
        line-height: 2.25rem !important;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem !important; /* 24px */
        line-height: 2rem !important;
    }
}

/* Заголовок H2 */
h2 {
    font-size: 1.875rem; /* 30px */
    line-height: 2.25rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    h2 {
        font-size: 1.5rem !important; /* 24px */
        line-height: 2rem !important;
    }
}

/* Заголовок H3 */
h3 {
    font-size: 1.5rem; /* 24px */
    line-height: 2rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    h3 {
        font-size: 1.25rem !important; /* 20px */
        line-height: 1.75rem !important;
    }
}

/* Заголовок H4 */
h4 {
    font-size: 1.25rem; /* 20px */
    line-height: 1.75rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    h4 {
        font-size: 1.125rem !important; /* 18px */
        line-height: 1.625rem !important;
    }
}

/* ========================================
   КОМПОНЕНТЫ ОФФЕРОВ
   ======================================== */

/* Значки-бейджи офферов */
.offer-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    white-space: nowrap;
}

/* Рейтинг бейдж */
.rating-badge {
    border: 2px solid var(--color-primary);
    background: rgba(146, 51, 234, 0.12);
    color: var(--color-primary);
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 14px;
}

/* Круглые номера */
.round-number {
    display: inline-flex;
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    line-height: 28px;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Галочки преимуществ */
.advantage-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(146, 51, 234, 0.12);
    color: #5146e6;
    margin-top: 2px;
    flex-shrink: 0;
}

.svg-primary {
    color: var(--color-primary);
}

/* ========================================
   NAVIGATION И HEADER
   ======================================== */

/* Header стили */
.group:hover .group-hover\:opacity-100 {
    opacity: 1;
    visibility: visible;
}

nav a, nav button {
    transition: color 0.2s ease;
}

nav a.active {
    color: #4f46e5;
    font-weight: 600;
}

nav.flex.text-sm a {
    font-size: 15px;
    padding-top: 8px;
    padding-bottom: 8px;
}

/* Мобильное меню */
#mobile-menu {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Тень под header при скролле */
header.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ========================================
   FOOTER
   ======================================== */

footer a {
    transition: color 0.2s ease;
}

footer svg {
    flex-shrink: 0;
}

/* ========================================
   УТИЛИТЫ И ЭФФЕКТЫ
   ======================================== */

/* Ограничение текста (line clamp) */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Эффект блика на кнопке CTA */
@keyframes shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shine 3s infinite;
    pointer-events: none;
}

/* Placeholder изображений */
img[src*="placeholder"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ========================================
   КОНТЕНТ СТИЛИ
   ======================================== */

/* Intro-контент (компактный) */
.intro-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #4b5563;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(81, 70, 230, 0.03), rgba(146, 51, 234, 0.03));
    border-left: 3px solid var(--color-primary);
    border-radius: 0.5rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .intro-content {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
}

/* ========================================
   AI-СГЕНЕРИРОВАННЫЙ КОНТЕНТ СТАТЬИ
   ======================================== */

.ai-article-content {
    color: #374151;
    line-height: 1.6;
    max-width: 720px;
    margin: 0 auto;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ai-article-content h2,
.ai-article-content h3,
.ai-article-content h4,
.ai-article-content h5,
.ai-article-content h6 {
    font-weight: 600;
    color: #111827;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.25;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-article-content h2 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 0.3rem;
}

@media (max-width: 768px) {
    .ai-article-content h2 {
        font-size: 1.375rem;
    }
}

.ai-article-content h3 {
    font-size: 1.375rem;
}

@media (max-width: 768px) {
    .ai-article-content h3 {
        font-size: 1.25rem;
    }
}

.ai-article-content h4 {
    font-size: 1.125rem;
    color: #4b5563;
}

@media (max-width: 768px) {
    .ai-article-content h4 {
        font-size: 1.0625rem;
    }
}

.ai-article-content p {
    margin-bottom: 1rem;
    text-align: justify;
    hyphens: auto;
    font-size: 1rem;
    color: #4b5563;
}

.ai-article-content ul,
.ai-article-content ol {
    margin: 1rem 0 1rem 1.5rem;
    padding-left: 1rem;
    color: #4b5563;
    font-size: 1rem;
    line-height: 1.5;
}

.ai-article-content ul {
    list-style-type: disc;
}

.ai-article-content ol {
    list-style-type: decimal;
}

.ai-article-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.ai-article-content li::marker {
    color: var(--color-primary);
    font-weight: 600;
}

.ai-article-content strong,
.ai-article-content b {
    font-weight: 700;
    color: var(--color-primary);
}

.ai-article-content em,
.ai-article-content i {
    font-style: italic;
}

.ai-article-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding-left: 1rem;
    color: #6b7280;
    font-style: italic;
    margin: 1rem 0;
    background: rgba(81, 70, 230, 0.05);
    border-radius: 0.25rem;
    padding: 0.75rem 1rem;
}

.ai-article-content a {
    color: var(--color-primary);
    text-decoration: underline;
    transition: color 0.2s ease-in-out;
    word-break: break-word;
}

.ai-article-content a:hover,
.ai-article-content a:focus {
    color: var(--color-secondary);
}

.ai-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    overflow-x: auto;
    display: block;
}

@media (max-width: 768px) {
    .ai-article-content table {
        font-size: 0.875rem;
    }
}

.ai-article-content th,
.ai-article-content td {
    border: 1px solid #d1d5db;
    padding: 0.5rem 1rem;
    text-align: left;
    vertical-align: top;
}

@media (max-width: 768px) {
    .ai-article-content th,
    .ai-article-content td {
        padding: 0.375rem 0.75rem;
    }
}

.ai-article-content th {
    background-color: #f9fafb;
    font-weight: 700;
}

.ai-article-content pre,
.ai-article-content code {
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    font-family: monospace;
    font-size: 0.9rem;
    border-radius: 0.25rem;
    overflow-x: auto;
    word-wrap: break-word;
}

.ai-article-content > *:first-child {
    margin-top: 0 !important;
}

.ai-article-content > *:last-child {
    margin-bottom: 0 !important;
}

/* ========================================
   PROSE КОНТЕНТ (СЛУЖЕБНЫЕ СТРАНИЦЫ)
   ======================================== */

.prose {
    max-width: 100%;
    overflow-wrap: break-word;
}

.prose h2 {
    margin-top: 2em;
    margin-bottom: 0.75em;
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--color-primary);
}

@media (max-width: 768px) {
    .prose h2 {
        font-size: 1.5rem;
    }
}

.prose h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
}

@media (max-width: 768px) {
    .prose h3 {
        font-size: 1.25rem;
    }
}

.prose p {
    margin-bottom: 1.25em;
    line-height: 1.75;
}

.prose ul, .prose ol {
    margin-top: 1em;
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.prose li {
    margin-bottom: 0.5em;
}

.prose a {
    color: var(--color-primary);
    text-decoration: underline;
    transition: color 0.2s;
    word-break: break-word;
}

.prose a:hover {
    color: var(--color-accent);
}

.prose strong {
    font-weight: 600;
    color: var(--color-text);
}

.prose code {
    background: #f3f4f6;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    word-wrap: break-word;
}

/* ========================================
   ДОПОЛНИТЕЛЬНАЯ ЗАЩИТА ОТ ПЕРЕПОЛНЕНИЯ
   ======================================== */

/* Для всех текстовых контейнеров */
article, section, div {
    max-width: 100%;
}

/* Таблицы на мобильных */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* Длинные слова в карточках */
.bg-white, .rounded-lg, .shadow {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Защита iframe и embed */
iframe, embed {
    max-width: 100%;
    border: none;
}

/* ========================================
   УЛУЧШЕНИЯ ДЛЯ ПЕЧАТИ
   ======================================== */

@media print {
    .no-print, header, footer, nav {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}


/* Кастомный scrollbar для Chrome/Safari */
.overflow-x-auto::-webkit-scrollbar {
    height: 6px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 10px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Переопределение стилей ссылок в кнопках внутри статей блога */
.ai-article-content .not-prose a,
.prose .not-prose a {
    text-decoration: none !important;
}

/* Белый цвет для кнопок "Оформить" */
.ai-article-content .not-prose a[target="_blank"],
.prose .not-prose a[target="_blank"] {
    text-decoration: none !important;
    color: white !important;
}

/* Дополнительно для всех кнопок в блоке офферов с градиентом */
.not-prose a.text-white,
.not-prose .text-white {
    color: white !important;
    text-decoration: none !important;
}

/* Специфичный селектор для кнопок внутри блока офферов в статье */
.ai-article-content .not-prose div[class*="gradient"] a,
.prose .not-prose div a.rounded-lg {
    color: white !important;
    text-decoration: none !important;
}


