/**
 * Кастомные стили сайта «Поколение» (дополнение к Tailwind CSS)
 * Tailwind подключается через CDN в HTML
 */

/* ========================================
   CSS ПЕРЕМЕННЫЕ
   ======================================== */
:root {
    --color-primary: #3B82F6;
    --color-primary-dark: #2563EB;
    --color-accent: #ee2f53;
    --color-bg-light: #F5F5F5;
    --color-bg-blue-light: #EFF6FF;
    --color-text-main: #1F2937;
    --color-text-secondary: #6B7280;
    --color-star: #FBBF24;
    --color-success: #10B981;
    --color-error: #EF4444;
    --header-height: 72px;
}

/* ========================================
   БАЗОВЫЕ СТИЛИ
   ======================================== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--color-text-main);
    overflow-x: hidden;
    padding-top: var(--header-height);
}

::selection {
    background-color: var(--color-primary);
    color: #fff;
}

/* Focus visible для accessibility */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ========================================
   ХЕДЕР
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    transition: box-shadow 0.3s ease;
}

.header.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Навигация — подчёркивание */
.nav__link {
    position: relative;
    padding: 4px 0;
}

.nav__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width 0.2s ease;
}

.nav__link:hover::after,
.nav__link.active::after {
    width: 100%;
}

/* Бургер-меню */
.burger__line {
    width: 100%;
    height: 2px;
    background-color: var(--color-text-main);
    transition: all 0.2s ease;
    transform-origin: center;
}

.burger.active .burger__line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.burger.active .burger__line:nth-child(2) {
    opacity: 0;
}

.burger.active .burger__line:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Мобильное меню */
.mobile-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.mobile-menu.active {
    transform: translateX(0);
}

/* ========================================
   HERO СЕКЦИЯ
   ======================================== */
.hero-gradient {
    background: linear-gradient(135deg, #2593FF 0%, #1E40AF 100%);
    position: relative;
    overflow: hidden;
}

/* Декоративные элементы */
.hero-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-gradient::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
}

/* Декоративный блок на hero */
.hero-decoration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;
    overflow: hidden;
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
}

.hero-blob--1 {
    width: 500px;
    height: 500px;
    top: -20%;
    right: -10%;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
}

.hero-blob--2 {
    width: 300px;
    height: 300px;
    bottom: -10%;
    left: 5%;
    background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
}

.hero-code-snippet {
    position: absolute;
    right: 3%;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.07);
    white-space: pre;
    line-height: 1.8;
}

@media (max-width: 1023px) {
    .hero-code-snippet {
        display: none;
    }
}

.hero-highlight {
    display: block;
    background: linear-gradient(90deg, rgba(255,255,255,0.95), rgba(255,255,255,0.75));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Визуальные карточки hero */
.hero-visual {
    position: relative;
    height: 400px;
}

.hero-card {
    position: absolute;
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: heroFloat 6s ease-in-out infinite;
}

.hero-card--1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.hero-card--2 {
    top: 40%;
    right: 5%;
    animation-delay: 1s;
}

.hero-card--3 {
    bottom: 10%;
    left: 25%;
    animation-delay: 2s;
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ========================================
   СТАТИСТИКА
   ======================================== */
.stat-item {
    position: relative;
    font-variant-numeric: tabular-nums;
}

@media (min-width: 1024px) {
    .stat-item:not(:last-child)::after {
        content: '';
        position: absolute;
        right: 0;
        top: 20%;
        height: 60%;
        width: 1px;
        background-color: #E5E7EB;
    }
}

/* ========================================
   КАРТОЧКИ
   ======================================== */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

/* Иконка в кружке */
.icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: var(--color-bg-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    flex-shrink: 0;
}

/* Цветная полоса на карточке курса */
.course-stripe-python {
    background: linear-gradient(135deg, #3B82F6, #FBBF24);
}

.course-stripe-cpp {
    background: linear-gradient(135deg, #3B82F6, #6366F1);
}

/* Кастомный чекмарк */
.custom-check {
    position: relative;
    padding-left: 28px;
}

.custom-check::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--color-bg-blue-light);
}

.custom-check::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 7px;
    width: 8px;
    height: 5px;
    border-left: 2px solid var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    transform: rotate(-45deg);
}

/* ========================================
   КАВЫЧКИ В ОТЗЫВАХ
   ======================================== */
.review-quote {
    position: relative;
}

.review-quote::before {
    content: '\201C';
    position: absolute;
    top: -10px;
    left: 0;
    font-size: 80px;
    font-family: Georgia, serif;
    color: var(--color-primary);
    opacity: 0.15;
    line-height: 1;
    pointer-events: none;
}

/* ========================================
   ПРЕПОДАВАТЕЛЬ — АВАТАР
   ======================================== */
.teacher-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3B82F6, #6366F1);
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    transition: transform 0.3s ease;
}

.card-hover:hover .teacher-avatar {
    transform: scale(1.05);
}

/* ========================================
   ЦЕНОВАЯ КАРТОЧКА — ПОПУЛЯРНАЯ
   ======================================== */
.price-popular {
    border: 2px solid var(--color-primary);
    position: relative;
}

.price-badge {
    position: absolute;
    top: 0;
    right: 24px;
    background-color: var(--color-primary);
    color: #fff;
    padding: 4px 16px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
}

/* ========================================
   CTA СЕКЦИЯ
   ======================================== */
.cta-gradient {
    background: linear-gradient(135deg, #1E40AF 0%, #2593FF 50%, #3B82F6 100%);
    position: relative;
    overflow: hidden;
}

.cta-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    border-radius: 50%;
}

/* ========================================
   ФОРМА
   ======================================== */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input.error,
.form-textarea.error,
.form-select.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-error {
    display: none;
    color: var(--color-error);
    font-size: 14px;
    margin-top: 4px;
}

.form-error.visible {
    display: block;
}

.form-message {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
    font-size: 14px;
}

.form-message.visible {
    display: block;
}

.form-message--success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.form-message--error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* ========================================
   SCROLL TO TOP
   ======================================== */
.scroll-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 100;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* ========================================
   АНИМАЦИИ ПОЯВЛЕНИЯ
   ======================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Задержка для каскадного появления */
.animate-delay-1 { transition-delay: 0.1s; }
.animate-delay-2 { transition-delay: 0.2s; }
.animate-delay-3 { transition-delay: 0.3s; }
.animate-delay-4 { transition-delay: 0.4s; }

/* ========================================
   КНОПКИ — ДОПОЛНИТЕЛЬНЫЕ СТИЛИ
   ======================================== */
/* Спиннер загрузки */
.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   УТИЛИТЫ
   ======================================== */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Scroll margin для якорей */
.scroll-mt-24 {
    scroll-margin-top: calc(var(--header-height) + 24px);
}
