/* Light universal theme — легкий универсальный светлый стиль */
:root{
    --bg: #f7f9fc;
    --surface: #ffffff;
    --muted: #6b7280;
    --text: #0f172a;
    --primary: #2563eb; /* синий */
    --primary-600: #1e4fd6;
    --accent: #06b6d4; /* бирюзовый */
    --success: #16a34a;
    --danger: #ef4444;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
    --shadow-md: 0 6px 18px rgba(15,23,42,0.08);
    /* Адаптивная ширина: от 320px до 1400px с автоматическим расчетом */
    --max-width: clamp(320px, 95vw, 1400px);
    --container-padding: clamp(16px, 3vw, 24px);
    --gap-sm: clamp(8px, 1.5vw, 12px);
    --gap-md: clamp(12px, 2vw, 18px);
}
 
/* Base reset */
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
    display:flex;
    flex-direction:column;
    min-height:100vh;
    font-family: "Montserrat", "Segoe UI", Roboto, system-ui, -apple-system, "Helvetica Neue", Arial;
    background:var(--bg);
    color:var(--text);
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
    line-height:1.45;
    font-size:16px;
}

.body-body{
    flex:1;
}

.site-footer-wrapper{
    margin-top:auto;
}

a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}

.container{
    max-width:var(--max-width);
    margin:0 auto;
    padding:var(--container-padding);
    width:100%;
}

.header-bar{
    background:linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0.9));
    backdrop-filter: blur(6px);
    box-shadow:var(--shadow-sm);
    padding:12px 24px;
    display:flex;align-items:center;justify-content:space-between;
}
.site-logo a{font-weight:700;color:var(--text);letter-spacing:0.4px}

/* Cards and surfaces */
.card{
    background:var(--surface);
    border-radius:var(--radius);
    box-shadow:var(--shadow-md);
    padding:18px;
}
.card-sm{padding:12px}

/* Buttons */
.btn{
    display:inline-flex;align-items:center;justify-content:center;
    gap:8px;padding:10px 14px;border-radius:10px;border:1px solid transparent;cursor:pointer;
    background:transparent;color:var(--text);font-weight:600
}
.btn:hover{filter:brightness(0.98)}

.btn-primary{
    background:linear-gradient(180deg,var(--primary),var(--primary-600));
    color:white;border-radius:10px;border:none;box-shadow:0 6px 18px rgba(37,99,235,0.18);
}
.btn-ghost{background:transparent;border:1px solid rgba(15,23,42,0.06)}

/* Forms */
.input,textarea,select{
    width:100%;padding:10px 12px;border-radius:8px;border:1px solid rgba(15,23,42,0.08);background:transparent;color:var(--text);
}
.input:focus,textarea:focus,select:focus{outline:none;border-color:var(--accent);box-shadow:0 6px 20px rgba(6,182,212,0.08)}

label{display:block;margin-bottom:6px;color:var(--muted);font-size:14px}

/* Utility */
.row{display:flex;gap:var(--gap-md);flex-wrap:wrap}
.col{
    flex:1 1 280px;
    min-width:280px;
}
.center{text-align:center}
.small{font-size:13px;color:var(--muted)}

/* Notice, alerts */
.alert{padding:12px;border-radius:8px;background:#fff3cd;color:#856404;border:1px solid rgba(0,0,0,0.03)}

/* Footer */
.footer{padding:var(--container-padding);text-align:center;color:var(--muted);font-size:14px}
.site-footer{margin:24px;padding:18px}
.footer-row{display:flex;flex-wrap:wrap;gap:18px;align-items:center;justify-content:space-between}
.footer-links{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:flex-end}
.footer-links a{white-space:nowrap}
.footer-meta{margin-top:12px;text-align:center;color:var(--muted);font-size:13px}

/* Responsive tweaks */
/* Sidebar widths use default flow; no fixed width. */
.sidebar-left, .sidebar-right{
}

/* Docs sidebar styling */
.docs-nav{
    background: #f7f9fb;
    border: none;
    padding: 0;
    margin-top: 30px;
}

.docs-links{
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f7f9fb;
    border: none;
    padding: 0;
}

.docs-link{
    display: block;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e4e8f0;
    border-radius: 10px;
    color: #0f172a;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.docs-link:hover{
    border-color: #cdd5e3;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.main-content{
    flex:1;
    min-width:0;
}

/* Две боковые панели */
.layout-both .main-content{
    margin:0 var(--gap-md);
}
 
/* Только левая */
.layout-left .main-content{
    margin-left:var(--gap-md);
}

/* Только правая */
.layout-right .main-content{
    margin-right:var(--gap-md);
}

@media (max-width:992px){
    .row{flex-direction:column}
    .col{
        flex:1 1 100%;
        min-width:100%;
    }
    
    /* Сайдбары на планшетах становятся полной ширины */
    .sidebar-left, .sidebar-right{
        flex:1 1 100%;
        max-width:100%;
        width:100%;
        margin:0 !important;
    }
    
    /* Карточки внутри сайдбаров тоже на всю ширину */
    .sidebar-left .card, .sidebar-right .card,
    .sidebar-left nav, .sidebar-right nav,
    .sidebar-left aside, .sidebar-right aside{
        width:100%;
        max-width:100%;
    }
    
    .main-content{
        margin:var(--gap-md) 0 !important;
        width:100%;
    }
    
    /* Порядок: левая панель, контент, правая панель */
    .sidebar-left{order:1}
    .main-content{order:2}
    .sidebar-right{order:3}
}

@media (max-width:720px){
    .container{padding:16px}
    .header-bar{padding:10px;flex-wrap:wrap}
    body{font-size:15px}
    
    .col{
        min-width:100%;
    }

    .site-footer{margin:16px;padding:16px}
    .footer-row{justify-content:center;gap:12px}
    .footer-links{justify-content:center}

    .site-header{position:fixed}
    .header-container{height:auto;flex-wrap:wrap;gap:10px;align-items:flex-start;padding:12px}
    .body-body{padding-top:96px}
    .guest-actions{flex-wrap:wrap;justify-content:flex-end;gap:10px}
    .guest-actions .btn{padding:8px 12px;font-size:13px}
    .lang-switcher{gap:4px;font-size:13px}
    .lang-divider{display:none}
}

@media (max-width:480px){
    .btn{padding:8px 12px;font-size:14px}
    .card{padding:14px}
}

/* Small helpers for images and avatars */
.img-responsive{max-width:100%;height:auto;border-radius:8px}
.avatar{width:40px;height:40px;border-radius:999px;overflow:hidden;display:inline-block}

/* Accessibility focus */
:focus{outline:3px solid rgba(37,99,235,0.15);outline-offset:2px}

/* ========================================
   NAVBAR MODERN (для nderhead.php)
   ======================================== */

/* Фиксированная шапка */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--surface);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

/* Контейнер шапки */
.header-container {
    width: 100%;
    padding: 0 clamp(12px, 2vw, 20px);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Отступ для body-body чтобы контент не залазил под шапку */
.body-body {
    padding-top: 70px;
}

.site-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.3rem, 3vw, 1.6rem);
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.site-logo a {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-decoration: none;
}

/* Бургер-кнопка */
.burger-btn {
    display: none;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    z-index: 1002;
    position: relative;
}

.burger-line {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--primary);
    margin: 5px 0;
    transition: all 0.3s ease;
}

/* Основное меню */
.main-nav {
    display: flex;
    flex-grow: 1;
    justify-content: flex-end;
    align-items: center;
    gap: var(--gap-md);
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
    margin: 0 var(--gap-sm);
}

.nav-link {
    color: var(--text);
    padding: 10px 15px;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    display: block;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    text-decoration: none;
}

/* Подменю */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius);
    padding: 8px 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
    box-shadow: var(--shadow-md);
    list-style: none;
    padding-left: 0;
}

.submenu li {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

.submenu li a {
    color: var(--text);
    padding: 8px 20px;
    display: block;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.submenu li a:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
    text-decoration: none;
}

.nav-item:hover .submenu,
.has-submenu.active .submenu {
    opacity: 1;
    visibility: visible;
}

/* Панель пользователя */
.user-panel {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
    margin-left: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.user-status {
    font-size: 0.8rem;
    color: var(--muted);
}

.user-tokens {
    background: rgba(37, 99, 235, 0.08);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.header-user-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.header-tokens {
    background: rgba(37, 99, 235, 0.08);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.token-icon {
    font-style: normal;
    font-size: 1rem;
}

.token-count {
    font-weight: 700;
}

.header-logout {
    color: var(--muted);
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
}

.header-logout:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
    text-decoration: none;
}

/* Навигация для гостей */
.guest-actions {
    display: flex;
    gap: var(--gap-md);
    align-items: center;
    flex-shrink: 0;
}

.guest-actions .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Переключатель языка */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    flex-wrap: wrap;
}

.lang-link {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 4px 6px;
    border-radius: 4px;
}

.lang-link:hover {
    color: var(--text);
    text-decoration: none;
    background: rgba(15, 23, 42, 0.04);
}

.lang-link.active {
    color: var(--primary);
    font-weight: 700;
}

.lang-divider {
    color: var(--muted);
    opacity: 0.5;
}

.has-submenu {
    position: relative;
}

.has-submenu > .nav-link::after {
    content: '\25BC';
    font-size: 0.7em;
    margin-left: 6px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.has-submenu.active > .nav-link::after,
.has-submenu:hover .submenu:hover + .nav-link::after {
    transform: rotate(-180deg);
}

/* Мобильная версия */
@media (max-width: 992px) {
    .burger-btn {
        display: block;
    }

    .header-container{
        height:auto;
        flex-wrap:wrap;
        gap:12px;
        align-items:flex-start;
        padding:12px 16px;
    }
    .body-body{padding-top:90px}
    .guest-actions{flex-wrap:wrap;justify-content:flex-end;gap:10px}
    .guest-actions .btn{padding:8px 12px;font-size:13px}
    .lang-switcher{gap:6px}
    .lang-divider{display:none}
    
    .main-nav {
        position: fixed;
        top: 90px;
        left: 0;
        width: 100%;
        height: calc(100vh - 90px);
        background: var(--surface);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        padding: 20px;
        box-sizing: border-box;
        border-left: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .main-nav.active {
        transform: translateX(0);
    }
    
    .nav-list {
        flex-direction: column;
        width: 100%;
        margin: 0 0 20px 0;
        align-items: flex-start;
    }
    
    .nav-item {
        margin: 0;
        width: 100%;
    }
    
    .nav-link {
        padding: 12px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        width: 100%;
    }
    
    .submenu {
        position: static;
        opacity: 1;
        visibility: visible;
        border: none;
        box-shadow: none;
        background: rgba(37, 99, 235, 0.02);
        padding: 0;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border-radius: var(--radius);
    }
    
    .submenu.active {
        max-height: 500px;
        padding: 8px 0;
    }
    
    .has-submenu.active > .nav-link::after {
        transform: rotate(-180deg);
    }
    
    .submenu li a {
        padding: 10px 15px 10px 25px;
        border-bottom: none;
    }
    
    .user-panel {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        margin: 0;
        padding-top: 20px;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .user-info {
        margin-bottom: 15px;
    }
    
    .user-tokens {
        margin: 10px 0;
        align-self: flex-start;
    }
    
    .logout-link {
        margin-top: 10px;
    }
    
    /* Анимация бургера */
    .burger-btn.active .burger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    
    .burger-btn.active .burger-line:nth-child(2) {
        opacity: 0;
    }
    
    .burger-btn.active .burger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
    
    /* Для гостей кнопки НЕ сворачиваются - остаются в строку всегда */
}

@media (max-width: 768px) {
    .site-logo {
        font-size: 1.3rem;
    }
}

/* ========================================
   COOKIE MODAL (модальное окно куки)
   ======================================== */
.cookie-modal {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 500px;
    background: var(--surface);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius);
    padding: 14px 18px;
    z-index: 9999;
    animation: fadeInUp 0.4s ease;
    box-shadow: var(--shadow-md);
}

.cookie-content {
    color: var(--text);
    text-align: left;
}

.cookie-content h3 {
    font-size: 1rem;
    margin: 0 0 6px 0;
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
}

.cookie-content p {
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0 0 10px 0;
    color: var(--muted);
}

.cookie-content a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.cookie-content a:hover {
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 10px;
}

.cookie-button {
    padding: 6px 14px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    min-width: 90px;
}

.cookie-button.accept {
    background: var(--primary);
    color: white;
}

.cookie-button.accept:hover {
    background: var(--primary-600);
}

.cookie-button.decline {
    background: transparent;
    color: var(--muted);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.cookie-button.decline:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--muted);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@media (max-width: 768px) {
    .cookie-modal {
        width: calc(100% - 40px);
        bottom: 10px;
        padding: 20px;
        margin: 0 20px;
    }
    
    .cookie-content p {
        padding: 0;
    }
    
    .cookie-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cookie-button {
        width: 100%;
    }
}
