/* style.css — все стили для сайта «УРОКИ AI» */

/* ═══════════════════════════════════════════════
   ОБЩИЕ ПЕРЕМЕННЫЕ И СБРОС
   ═══════════════════════════════════════════════ */

:root {
    /* Неоновые цвета */
    --cyan: #00e5ff;
    --purple: #b388ff;
    --electric: #2979ff;
    --pink: #ff80ab;

    /* Фоны */
    --bg-dark: #0a0a1a;
    --bg-darker: #050510;
    --bg-panel: rgba(15, 15, 35, 0.6);

    /* Текст */
    --text-main: #e0e0ff;
    --text-dim: #8888aa;
    --text-muted: #555570;

    /* Эффекты */
    --glow-cyan: 0 0 20px rgba(0, 229, 255, 0.5), 0 0 40px rgba(0, 229, 255, 0.2);
    --glow-purple: 0 0 20px rgba(179, 136, 255, 0.5), 0 0 40px rgba(179, 136, 255, 0.2);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(20, 20, 40, 0.5);

    /* Шрифты */
    --font-title: 'Orbitron', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    position: relative;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════
   ФОН — ТЁМНЫЙ ГРАДИЕНТ + SVG-ПАТТЕРН
   ═══════════════════════════════════════════════ */

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(41, 121, 255, 0.08), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(179, 136, 255, 0.06), transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 229, 255, 0.05), transparent 60%);
    z-index: 0;
    pointer-events: none;
}

/* Контейнер для SVG-узоров школьных предметов */
.bg-pattern {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
}

.school-item {
    position: absolute;
    animation: float-pattern 12s ease-in-out infinite;
}

/* Субтильный паттерн для страницы чата */
.bg-pattern-subtle .school-item {
    animation-duration: 20s;
}

/* Лёгкое плавание узоров */
@keyframes float-pattern {
    0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
    50% { transform: translateY(-15px); }
}

/* ═══════════════════════════════════════════════
   КАНВАС С ЧАСТИЦАМИ (цифровая рябь)
   ═══════════════════════════════════════════════ */

#particles-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════
   ГЛАВНАЯ СТРАНИЦА — flex-контейнер
   ═══════════════════════════════════════════════ */

.page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 2;
    gap: 40px;
    padding: 20px;
}

/* Текст-заголовок над кнопкой */
.hero-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    animation: fadeInDown 1s ease 0.3s forwards;
}

.hero-title {
    font-family: var(--font-title);
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    letter-spacing: 6px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--cyan), var(--purple), var(--electric));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 60px rgba(0, 229, 255, 0.3);
}

.title-accent {
    background: linear-gradient(135deg, var(--purple), var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(0.9rem, 3vw, 1.3rem);
    color: var(--text-dim);
    font-weight: 300;
    letter-spacing: 3px;
}

/* ──────────────────────────────────────
   Декоративные вращающиеся кольца
   ────────────────────────────────────── */

.ring-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
}

.ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(0, 229, 255, 0.15);
    transform: translate(-50%, -50%);
}

.ring-1 {
    width: 340px;
    height: 340px;
    animation: spin 15s linear infinite;
    border-color: rgba(0, 229, 255, 0.12);
}

.ring-2 {
    width: 420px;
    height: 420px;
    animation: spin 25s linear infinite reverse;
    border-color: rgba(179, 136, 255, 0.1);
}

.ring-3 {
    width: 520px;
    height: 520px;
    animation: spin 40s linear infinite;
    border-color: rgba(41, 121, 255, 0.08);
}

/* Пунктирные сегменты на кольцах */
.ring-1 { border-style: dashed; }
.ring-3 { border-style: dotted; }

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ──────────────────────────────────────
   ГЛАВНАЯ КНОПКА
   ────────────────────────────────────── */

.enter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 22px 60px;
    font-family: var(--font-title);
    font-size: clamp(1rem, 3vw, 1.4rem);
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-decoration: none;
    color: #ffffff;
    border-radius: 16px;
    background: linear-gradient(135deg, #00e5ff 0%, #2979ff 40%, #6c4dff 70%, #b388ff 100%);
    background-size: 200% 200%;
    box-shadow:
        0 0 30px rgba(0, 229, 255, 0.4),
        0 0 60px rgba(179, 136, 255, 0.25),
        0 8px 32px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: hidden;
    z-index: 2;
    opacity: 0;
    animation: fadeInUp 1s ease 0.6s forwards, pulse-glow 3s ease-in-out 1.6s infinite;
}

.enter-btn:hover {
    transform: scale(1.06) translateY(-3px);
    background-position: 100% 100%;
    box-shadow:
        0 0 50px rgba(0, 229, 255, 0.7),
        0 0 100px rgba(179, 136, 255, 0.4),
        0 12px 40px rgba(0, 0, 0, 0.6);
}

.enter-btn:active {
    transform: scale(1.02);
}

.btn-text {
    position: relative;
    z-index: 2;
}

/* Внутреннее свечение кнопки */
.btn-glow {
    position: absolute;
    top: 0; left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.enter-btn:hover .btn-glow {
    left: 100%;
}

/* Пульсация свечения кнопки */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow:
            0 0 30px rgba(0, 229, 255, 0.4),
            0 0 60px rgba(179, 136, 255, 0.25),
            0 8px 32px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow:
            0 0 45px rgba(0, 229, 255, 0.6),
            0 0 90px rgba(179, 136, 255, 0.35),
            0 8px 32px rgba(0, 0, 0, 0.5);
    }
}

/* Голографический блик под кнопкой */
.holo-glow {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 80px;
    background: radial-gradient(ellipse, rgba(0, 229, 255, 0.2), transparent 70%);
    filter: blur(20px);
    z-index: 1;
    animation: holo-pulse 4s ease-in-out infinite;
}

@keyframes holo-pulse {
    0%, 100% { opacity: 0.5; width: 300px; }
    50% { opacity: 0.8; width: 360px; }
}

/* ═══════════════════════════════════════════════
   ФУТЕР
   ═══════════════════════════════════════════════ */

.footer {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    padding: 12px 16px;
    z-index: 10;
    pointer-events: none;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1.6;
    opacity: 0.7;
}

.footer-content span {
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   СТРАНИЦА АГЕНТА (ЧАТ)
   ═══════════════════════════════════════════════ */

.agent-body {
    overflow: hidden;
}

.agent-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Шапка чата */
.agent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: var(--glass-border);
    flex-shrink: 0;
    opacity: 0;
    animation: fadeInDown 0.6s ease forwards;
}

.header-titles {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agent-title {
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.agent-subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 300;
    letter-spacing: 1px;
}

.back-btn {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--cyan);
    text-decoration: none;
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 10px;
    background: rgba(0, 229, 255, 0.05);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.back-btn:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

/* Лента сообщений */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    scroll-behavior: smooth;
}

/* Кастомный скроллбар */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--cyan), var(--purple));
    border-radius: 10px;
}

/* Пузырь сообщения */
.message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    padding: 14px 20px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
    animation: messageAppear 0.4s ease forwards;
    opacity: 0;
}

/* Сообщение пользователя — справа */
.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(41, 121, 255, 0.2), rgba(108, 77, 255, 0.15));
    border: 1px solid rgba(0, 229, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
    border-bottom-right-radius: 4px;
}

/* Сообщение агента — слева */
.message.agent {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(20, 20, 50, 0.6), rgba(30, 20, 60, 0.5));
    border: 1px solid rgba(179, 136, 255, 0.25);
    box-shadow: 0 0 15px rgba(179, 136, 255, 0.08);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Метка автора сообщения */
.message .msg-author {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    font-weight: 600;
}

.message.user .msg-author {
    color: var(--cyan);
}

.message.agent .msg-author {
    color: var(--purple);
}

/* Текст сообщения */
.message .msg-text {
    color: var(--text-main);
    white-space: pre-wrap;
}

/* Анимация появления сообщения */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Статус «печатает…» */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    align-self: flex-start;
    margin-left: 24px;
    background: rgba(20, 20, 50, 0.5);
    border: 1px solid rgba(179, 136, 255, 0.2);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    margin-bottom: 8px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--purple);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* Зона ввода */
.input-area {
    display: flex;
    gap: 12px;
    padding: 16px 24px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: var(--glass-border);
    flex-shrink: 0;
    opacity: 0;
    animation: fadeInUp 0.6s ease 0.2s forwards;
}

.message-input {
    flex: 1;
    padding: 14px 20px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-main);
    background: rgba(10, 10, 25, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
}

.message-input::placeholder {
    color: var(--text-muted);
}

.message-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
    background: rgba(10, 10, 25, 0.9);
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--cyan), var(--electric));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
    white-space: nowrap;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.5);
}

.send-btn:active {
    transform: translateY(0);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Сообщение об ошибке */
.message.error {
    align-self: center;
    background: rgba(255, 50, 50, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.3);
    color: #ff8888;
    font-size: 0.85rem;
    max-width: 90%;
}

/* ═══════════════════════════════════════════════
   АНИМАЦИИ ПОЯВЛЕНИЯ
   ═══════════════════════════════════════════════ */

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════
   АДАПТИВНОСТЬ
   ═══════════════════════════════════════════════ */

/* Планшеты */
@media (max-width: 768px) {
    .ring-1 { width: 260px; height: 260px; }
    .ring-2 { width: 320px; height: 320px; }
    .ring-3 { width: 400px; height: 400px; }

    .message {
        max-width: 85%;
    }

    .agent-title {
        font-size: 1.3rem;
    }

    .input-area {
        padding: 12px 16px 16px;
    }

    .chat-container {
        padding: 16px;
    }
}

/* Телефоны */
@media (max-width: 480px) {
    .enter-btn {
        padding: 18px 40px;
        letter-spacing: 2px;
    }

    .hero-title {
        letter-spacing: 3px;
    }

    .ring-container {
        display: none;
    }

    .message {
        max-width: 92%;
        font-size: 0.9rem;
    }

    .agent-header {
        padding: 14px 16px;
    }

    .back-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .footer-content {
        font-size: 9px;
    }
}
