:root {
    --bg-dark: #090B0E;
    --card-bg: rgba(25, 29, 36, 0.65);
    --card-bg-hover: rgba(35, 40, 50, 0.85);
    --accent: #00A95A;
    --accent-glow: rgba(0, 169, 90, 0.25);
    --accent-dim: rgba(0, 169, 90, 0.08);
    --text-main: #FFFFFF;
    --text-muted: #8E9297;
    --border-color: rgba(255, 255, 255, 0.08);
    --surface-strong: #111418;
    --surface-soft: rgba(255, 255, 255, 0.03);
    --shadow-color: rgba(0, 0, 0, 0.28);
    --sidebar-width: 90px;
    --transition-speed: 0.3s;
}

a {
    text-decoration: none !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    background-image: 
        radial-gradient(circle at 15% 15%, var(--accent-dim) 0%, transparent 50%),
        radial-gradient(circle at 85% 85%, var(--accent-dim) 0%, transparent 50%);
    background-attachment: fixed;
    transition: padding 0.3s;
}

body[data-resolved-theme="day"] {
    color-scheme: light;
}

body[data-resolved-theme="night"] {
    color-scheme: dark;
}

/* --- Классы для анимации переходов --- */
.fade-content {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.fade-content.page-active {
    opacity: 1;
    transform: translateY(0);
}

.fade-content.page-leave {
    opacity: 0;
    transform: translateY(-12px);
}

/* --- Боковое меню (Sidebar / Desktop) --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 0;
    position: fixed;
    left: 0;
    top: 0;
    backdrop-filter: blur(24px);
    z-index: 1000;
}

.sidebar-logo {
    margin-bottom: 48px;
    width: 36px;
    height: 36px;
    opacity: 0.9;
    color: var(--text-main);
}

.sidebar-logo img,
.sidebar-logo svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.theme-logo {
    display: block;
    width: 100%;
    height: auto;
}

.theme-logo-wordmark,
.theme-logo-mark {
    filter: none;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
}

.sidebar-item {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.sidebar-item:hover {
    color: var(--text-main);
    background: var(--surface-soft);
}

.sidebar-item.active {
    color: var(--accent);
    background: var(--accent-dim);
    border-color: var(--accent-glow);
}

.sidebar-logout {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
}

.sidebar-logout:hover {
    color: #FF4D4D;
    background: rgba(255, 77, 77, 0.1);
}

/* --- Основная область контента --- */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 600px; /* Сузили контейнер для большего соответствия мобильному интерфейсу */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Общие элементы UI --- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 24px;
    backdrop-filter: blur(16px);
    width: 100%;
    margin-bottom: 16px;
}

/* Кнопка Оплатить (Primary) */
.btn-primary {
    background: var(--accent);
    color: #090B0E; /* Контрастный темный текст, как на скрине */
    border: none;
    border-radius: 100px; /* Пилюльный стиль */
    padding: 16px 28px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--accent-glow);
    opacity: 0.95;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Кнопка Настроить (Secondary) */
.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
    border-radius: 100px; /* Пилюльный стиль */
    padding: 16px 28px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--accent-dim);
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* Белая контрастная кнопка */
.btn-white {
    background: #FFFFFF;
    color: #090B0E;
    border: none;
    border-radius: 100px;
    padding: 15px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    width: 100%;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-white:hover {
    opacity: 0.9;
}
.btn-white:active {
    transform: scale(0.98);
}

body[data-resolved-theme="day"] .btn-white {
    border: 1px solid var(--border-color);
}

.btn-disabled {
    opacity: 0.55 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

/* Круглая кнопка */
.btn-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-soft);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.2s;
}

.btn-circle:hover {
    background: var(--surface-soft);
}

/* Элементы списков */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.2s ease;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--surface-soft);
}

.list-item-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.list-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* --- Стили для шагов настройки VPN (vpn-setup.html) --- */
.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.step-num {
    background: rgba(0, 169, 90, 0.15);
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-title {
    font-size: 16px;
    font-weight: 700;
}

.step-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
    line-height: 1.45;
}

/* --- Стили для выбора тарифов (pricing.html) --- */
.tariff-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(25, 29, 36, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px 24px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    user-select: none;
}

.tariff-card:hover {
    background: rgba(25, 29, 36, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
}

.tariff-card.active {
    border-color: var(--accent);
    background: rgba(0, 169, 90, 0.05);
    box-shadow: 0 0 15px rgba(0, 169, 90, 0.04);
}

.tariff-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.tariff-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.tariff-card.active .tariff-icon-wrap {
    color: var(--accent);
    border-color: rgba(0, 169, 90, 0.4);
    background: rgba(0, 169, 90, 0.1);
}

.tariff-name-block {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tariff-title {
    font-size: 15px;
    font-weight: 600;
}

.tariff-price-block {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.tariff-main-price {
    font-size: 18px;
    font-weight: 700;
}

.tariff-sub-price {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
}

.badge-green {
    background: rgba(0, 169, 90, 0.15);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Интерактивный счетчик устройств */
.counter-widget {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px;
}

.counter-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.counter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.counter-number {
    font-weight: 700;
    font-size: 15px;
    min-width: 18px;
    text-align: center;
}

.toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2400;
    pointer-events: none;
    align-items: flex-end;
}

/* --- ВСПЛЫВАЮЩИЕ УВЕДОМЛЕНИЯ (ТОСТЫ) --- */
.global-toast {
    position: relative;
    transform: translate3d(32px, -8px, 0) scale(0.98);
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 18px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 20px 44px var(--shadow-color), 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
    backdrop-filter: blur(16px);
    opacity: 0;
    pointer-events: auto;
    min-width: 260px;
    max-width: min(380px, calc(100vw - 32px));
    transition: opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1), transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.global-toast.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

/* --- МОДАЛЬНОЕ ОКНО --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 18, 28, 0.42);
    backdrop-filter: blur(8px);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 480px;
    padding: 28px;
    box-shadow: 0 24px 50px var(--shadow-color);
    transform: scale(0.93);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

body[data-resolved-theme="day"] .sidebar {
    background: rgba(255, 255, 255, 0.88);
}

body[data-resolved-theme="day"] .theme-logo-wordmark,
body[data-resolved-theme="day"] .theme-logo-mark {
    filter: brightness(0) saturate(100%);
}

body[data-resolved-theme="day"] .global-toast {
    color: var(--text-main);
}

body[data-resolved-theme="day"] .modal-card {
    color: var(--text-main);
}

.modal-backdrop.visible .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
}

.modal-body {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* --- 📱 МОБИЛЬНАЯ АДАПТИВНОСТЬ (ЗДЕСЬ МАГИЯ ИЗ СКРИНШОТА) --- */
@media (max-width: 768px) {
    body {
        padding-bottom: 96px; /* Отступ снизу для мобильного меню */
        background-attachment: scroll;
    }

    .main-wrapper {
        margin-left: 0 !important;
        padding: 24px 16px 40px 16px;
    }

    .container {
        max-width: 100%;
    }

    /* Превращаем боковой сайдбар в нижний навигационный таб-бар */
    .sidebar {
        width: calc(100% - 32px) !important;
        max-width: 480px;
        height: 72px !important;
        position: fixed !important;
        bottom: 16px;
        left: 50% !important;
        transform: translateX(-50%);
        top: auto !important;
        border-right: none !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 24px;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 16px !important;
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 169, 90, 0.05);
        background: rgba(10, 12, 16, 0.95);
        backdrop-filter: blur(24px);
    }

    .sidebar-logo, 
    .sidebar-logout {
        display: none !important; /* Скрываем лого и выход в мобильном меню */
    }

    .sidebar-menu {
        flex-direction: row !important;
        width: 100%;
        justify-content: space-around !important;
        align-items: center;
        gap: 0 !important;
        flex-grow: 1;
    }

    .sidebar-item {
        width: 56px !important;
        height: 44px !important;
        border-radius: 20px !important;
        border: none !important;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-item:hover {
        background: rgba(255, 255, 255, 0.03) !important;
    }

    /* Пилюльный активный фон на кнопке меню, как на скриншоте */
    .sidebar-item.active {
        color: #090B0E !important;
        background: var(--accent) !important;
        box-shadow: 0 4px 16px rgba(0, 169, 90, 0.4);
        transform: scale(1.05);
    }

    /* Сетка карточек на мобильном: строго в 2 колонки */
    .grid-cards {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        margin-top: 32px !important;
    }

    .action-card {
        border-radius: 24px !important;
        padding: 16px !important;
        min-height: 140px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .action-card-title {
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.3;
    }

    .action-card-arrow {
        margin-top: 12px !important;
        width: 36px !important;
        height: 36px !important;
    }

    .action-card-arrow svg {
        width: 14px;
        height: 14px;
    }

    /* Другие адаптивные элементы */
    .referral-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .promo-cards {
        grid-template-columns: 1fr !important;
    }

    .fade-content,
    .fade-content.page-active,
    .fade-content.page-leave {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .card,
    .sidebar,
    .modal-card,
    .global-toast {
        backdrop-filter: none;
    }

    .toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
        align-items: stretch;
    }

    .global-toast {
        max-width: 100%;
        min-width: 0;
    }
}
