/* ============================================================
   INTERLUDE WIKI — Визуальные улучшения
   Плавные анимации, эффекты, фоны
   ============================================================ */

/* ---------- ФОН САЙТА ---------- */
body {
    background: #0f0f17;
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(201, 169, 110, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 180, 212, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(212, 168, 75, 0.02) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Текстурная сетка */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255,255,255,0.01) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.01) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* Контент поверх сетки */
.site-header, .wiki-layout, .site-footer, .search-panel {
    position: relative;
    z-index: 1;
}

/* ---------- ПЛАВНЫЕ ПЕРЕХОДЫ ---------- */
a, button, .btn, .cat-card, .article-card, .search-item, .sidebar-link, .nav-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- КАРТОЧКИ КАТЕГОРИЙ ---------- */
.cat-card {
    background: linear-gradient(145deg, #1a1a24 0%, #1c1c2a 100%);
    border: 1px solid #2a2a38;
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #d4a84b, #8ca8c8, #d4a84b);
    opacity: 0;
    transition: opacity 0.4s;
}

.cat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 60px rgba(212,168,75,0.05);
    border-color: #d4a84b;
}

.cat-card:hover::before {
    opacity: 1;
}

.cat-card-icon {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

/* Разные задержки для иконок */
.cat-card:nth-child(1) .cat-card-icon { animation-delay: 0s; }
.cat-card:nth-child(2) .cat-card-icon { animation-delay: 0.5s; }
.cat-card:nth-child(3) .cat-card-icon { animation-delay: 1s; }
.cat-card:nth-child(4) .cat-card-icon { animation-delay: 1.5s; }

/* ---------- ССЫЛКИ В КАРТОЧКАХ ---------- */
.cat-card li a {
    display: block;
    padding: 6px 0;
    position: relative;
    padding-left: 16px;
}

.cat-card li a::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #d4a84b;
    transition: transform 0.3s;
}

.cat-card li a:hover::before {
    transform: translateX(4px);
}

/* ---------- САЙДБАР ---------- */
.sidebar {
    background: linear-gradient(180deg, #15151d 0%, #1a1a24 100%);
    border-right: 1px solid #2a2a38;
}

.sidebar-link {
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.sidebar-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: #d4a84b;
    transition: width 0.3s;
}

.sidebar-link:hover::after {
    width: 100%;
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(212,168,75,0.1) 0%, transparent 100%);
    border-left: 3px solid #d4a84b;
}

/* ---------- ХИДЕР ---------- */
.site-header {
    background: linear-gradient(180deg, #0d0d15 0%, #12121d 100%);
    border-bottom: 1px solid #2a2a38;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.logo-text {
    background: linear-gradient(135deg, #e0e0e0 0%, #d4a84b 50%, #e0e0e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---------- ГЛАВНАЯ СТРАНИЦА ---------- */
.welcome-hero {
    position: relative;
    padding: 30px 0 40px;
}

.welcome-hero h1 {
    font-size: 36px;
    background: linear-gradient(135deg, #f0f0f0 0%, #d4a84b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-hero p {
    animation: fadeInUp 1s ease-out;
}

/* ---------- СТАТЬИ ---------- */
.article-body h2 {
    position: relative;
    padding-left: 16px;
}

.article-body h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 4px;
    background: linear-gradient(180deg, #d4a84b, #8ca8c8);
    border-radius: 2px;
}

.article-body img {
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    transition: transform 0.3s;
}

.article-body img:hover {
    transform: scale(1.02);
}

/* ---------- ПОИСК ---------- */
.search-input:focus {
    box-shadow: 0 0 20px rgba(212,168,75,0.1);
}

.search-btn {
    background: linear-gradient(135deg, #d4a84b, #c49a3c);
    transition: all 0.3s;
}

.search-btn:hover {
    background: linear-gradient(135deg, #e0b95e, #d4a84b);
    box-shadow: 0 4px 15px rgba(212,168,75,0.3);
}

/* ---------- КНОПКИ ---------- */
.btn-primary {
    background: linear-gradient(135deg, #d4a84b, #c49a3c);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #e0b95e, #d4a84b);
    box-shadow: 0 6px 20px rgba(212,168,75,0.3);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover::after {
    opacity: 1;
}

/* ---------- ТАБЛИЦЫ ---------- */
.admin-table tbody tr {
    transition: background 0.3s;
}

.admin-table tbody tr:hover {
    background: rgba(212,168,75,0.03);
}

/* ---------- АЛЕРТЫ ---------- */
.alert-success {
    animation: slideIn 0.5s ease-out;
    background: linear-gradient(135deg, rgba(60,180,90,0.15), rgba(60,180,90,0.05));
}

.alert-error {
    animation: shake 0.5s ease-out;
    background: linear-gradient(135deg, rgba(200,50,50,0.15), rgba(200,50,50,0.05));
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ---------- СКРОЛЛБАР ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0f0f17;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2a2a38, #3a3a48);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #3a3a48, #4a4a58);
}

/* ---------- ВЫДЕЛЕНИЕ ТЕКСТА ---------- */
::selection {
    background: rgba(212,168,75,0.3);
    color: #fff;
}

/* ---------- ЛОАДЕР (если нужен) ---------- */
.loading {
    width: 40px;
    height: 40px;
    border: 3px solid #2a2a38;
    border-top-color: #d4a84b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- ФУТЕР ---------- */
.site-footer {
    background: linear-gradient(0deg, #0a0a10 0%, #0f0f17 100%);
    border-top: 1px solid #2a2a38;
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d4a84b, transparent);
}

/* ============================================================
   АДАПТИВНОСТЬ ДЛЯ АНИМАЦИЙ
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    .cat-card:hover {
        transform: translateY(-3px);
    }
    .welcome-hero h1 {
        font-size: 26px;
    }
}
/* Растянутый сайдбар */

/* Основной контейнер тоже на всю высоту */
.wiki-layout {
    min-height: calc(100vh - 56px - 60px); /* минус хедер и футер */
}

/* Если контента мало — сайдбар всё равно на всю высоту */
.content {
    min-height: calc(100vh - 56px - 60px - 64px); /* минус хедер, футер, паддинги */
}

/* Флекс-контейнер растягивает сайдбар */
.wiki-layout {
    align-items: stretch;
}

/* Для мобильных */
@media (max-width: 768px) {
    .sidebar {
        height: auto;
        min-height: auto;
        position: static;
    }
    
    .content {
        min-height: auto;
    }
}