/* ==========================================
   BBCode Styles — Adaptive Grid Theme
   Версия: 1.0
   Поддержка: [b], [i], [u], [url], [img], [quote], [code]
   Адаптивно + Тёмная тема + Безопасность
   ========================================== */

/* [quote] — красивая цитата с кавычкой */
blockquote.bbcode-quote {
    margin: 1.8rem 0;
    padding: 1.4rem 1.8rem;
    background: var(--card-bg);
    border-left: 4px solid var(--accent-color);
    border-radius: 0 12px 12px 0;
    font-style: italic;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

blockquote.bbcode-quote::before {
    content: '“';
    position: absolute;
    top: -10px;
    left: 12px;
    font-size: 3rem;
    color: var(--accent-color);
    font-family: Georgia, serif;
    opacity: 0.15;
    line-height: 1;
}

blockquote.bbcode-quote p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-color);
}

blockquote.bbcode-quote p + p {
    margin-top: 0.8rem;
}

blockquote.bbcode-quote strong {
    display: block;
    margin-bottom: 0.6rem;
    color: var(--accent-color);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* [code] — блок кода */
pre.bbcode-code {
    margin: 1.8rem 0;
    padding: 1.4rem;
    background: #2d2d2d;
    color: #f8f8f2;
    border-radius: 12px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: var(--shadow-md);
    position: relative;
    border: 1px solid #444;
    scrollbar-width: thin;
    scrollbar-color: #666 #2d2d2d;
}

pre.bbcode-code code {
    display: block;
    background: none;
    padding: 0;
    color: inherit;
    font-family: inherit;
}

pre.bbcode-code::before {
    content: '</>';
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 0.7rem;
    color: #666;
    font-weight: bold;
    opacity: 0.6;
}

/* Поддержка Prism.js / Highlight.js */
.hljs {
    background: transparent !important;
    padding: 0 !important;
}

/* [img] — встроенные изображения */
.bbcode-img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bbcode-img:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

/* [url] — ссылки */
.bbcode-link {
    color: var(--accent-color);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.bbcode-link:hover {
    color: #ff6b35;
    text-decoration-color: #ff6b35;
}

/* === ТЁМНАЯ ТЕМА === */
html.dark-mode blockquote.bbcode-quote {
    background: #1a1a1a;
    border-left-color: #ff6b35;
}

html.dark-mode blockquote.bbcode-quote::before {
    color: #ff6b35;
    opacity: 0.2;
}

html.dark-mode pre.bbcode-code {
    background: #1e1e1e;
    border-color: #333;
    scrollbar-color: #555 #1e1e1e;
}

html.dark-mode .bbcode-link {
    color: #ff8c5a;
}

html.dark-mode .bbcode-link:hover {
    color: #ffb399;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    blockquote.bbcode-quote {
        padding: 1.2rem 1.4rem;
        border-radius: 0 10px 10px 0;
    }

    blockquote.bbcode-quote::before {
        font-size: 2.5rem;
        top: -8px;
        left: 10px;
    }

    pre.bbcode-code {
        padding: 1rem;
        font-size: 0.85rem;
    }

    .bbcode-img {
        border-radius: 8px;
        margin: 1.2rem auto;
    }
}

@media (max-width: 480px) {
    blockquote.bbcode-quote {
        padding: 1rem 1.2rem;
    }

    blockquote.bbcode-quote::before {
        font-size: 2rem;
    }

    pre.bbcode-code {
        font-size: 0.8rem;
    }
}

/* === ДОПОЛНИТЕЛЬНО: скроллбар для кода === */
pre.bbcode-code::-webkit-scrollbar {
    height: 6px;
}

pre.bbcode-code::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 3px;
}

pre.bbcode-code::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 3px;
}

pre.bbcode-code::-webkit-scrollbar-thumb:hover {
    background: #888;
}

html.dark-mode pre.bbcode-code::-webkit-scrollbar-track {
    background: #1e1e1e;
}

html.dark-mode pre.bbcode-code::-webkit-scrollbar-thumb {
    background: #555;
}

html.dark-mode pre.bbcode-code::-webkit-scrollbar-thumb:hover {
    background: #777;
}