:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --dark: #1f2937;
    --light: #f9fafb;
    --gray: #9ca3af;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --radius: 12px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: var(--light);
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Стили для бокового меню */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 250px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-left-color: #6366f1;
}

.sidebar-nav-item i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

.menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: rgba(15, 23, 42, 0.9);
    transform: translateY(-2px);
}

/* ОСНОВНОЙ КОНТЕЙНЕР - ИСПРАВЛЕНИЯ ДЛЯ ПК */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* center content vertically and horizontally so the auth card stays in the middle */
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 20px;
    transition: margin-left 0.3s ease, width 0.3s ease;
    min-height: 100vh;
}

/* Контейнер для центрирования контента */
.content-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.sidebar-open .app-container {
    margin-left: 250px;
    width: calc(100% - 250px);
}

/* На ПК делаем контейнер уже для лучшего читаемого формата */
@media (min-width: 1200px) {
    .content-wrapper {
        max-width: 900px;
    }
}

@media (min-width: 1400px) {
    .content-wrapper {
        max-width: 1000px;
    }
}

.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 32px;
    box-shadow: var(--shadow);
    /* центрируем карточку и ограничиваем её максимальную ширину */
    margin: 0 auto 24px;
    max-width: 900px;
    animation: fadeIn 0.5s ease;
    width: 100%;
}

/* Внутренняя компактная карточка для варианта A (fullscreen фон + центр. карточка) */
.card-inner {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

/* Центрируем заголовки карточек */
.card-header {
    text-align: center;
    margin-bottom: 32px;
    position: relative;
}

.card-header-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: var(--primary);
    opacity: 0.1;
    filter: blur(60px);
    z-index: -1;
}

.card-title {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #6366f1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.card-subtitle {
    font-size: 16px;
    color: var(--gray);
    line-height: 1.5;
}

/* Tabs - центрируем и делаем аккуратнее */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    gap: 10px;
}

.tab {
    padding: 14px 28px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    font-weight: 500;
    color: var(--gray);
    border-radius: var(--radius) var(--radius) 0 0;
}

.tab.active {
    color: var(--light);
    background: rgba(255, 255, 255, 0.05);
}

.tab-indicator {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: var(--transition);
}

.tab.active .tab-indicator {
    width: 70%;
}

/* Forms - улучшаем внешний вид */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    font-size: 15px;
    color: var(--light);
}

.form-label.required::after {
    content: "*";
    color: var(--danger);
    margin-left: 4px;
}

.input-wrapper {
    position: relative;
}

.form-control {
    width: 100%;
    padding: 16px 20px 16px 50px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: var(--light);
    font-size: 16px;
    transition: var(--transition);
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 18px;
}

/* Buttons - улучшаем кнопки */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    margin-top: 15px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn i {
    margin-right: 10px;
    font-size: 18px;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
}

.btn:hover .btn-glow {
    transform: translateX(100%);
    transition: transform 0.6s ease;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    margin-top: 15px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.1);
}

/* File upload */
.file-upload {
    margin-top: 12px;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
}

.file-upload-label:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.file-upload-label i {
    margin-right: 10px;
    color: var(--primary);
    font-size: 18px;
}

.file-upload input[type="file"] {
    display: none;
}

.file-preview {
    margin-top: 15px;
    font-size: 14px;
    color: var(--gray);
    text-align: center;
}

.file-preview img {
    display: block;
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    margin: 12px auto;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Profile */
.avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

.avatar {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.avatar-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--primary);
    opacity: 0.2;
    filter: blur(15px);
    z-index: -1;
}

.skin, .cloak {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.profile-info {
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.profile-info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-info-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.profile-info-label {
    font-weight: 500;
    color: var(--gray);
    font-size: 15px;
}

.profile-info-value {
    font-weight: 600;
    color: var(--light);
}

/* Donate section */
.balance-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
}

.balance-info {
    font-weight: 600;
    font-size: 20px;
    color: var(--light);
}

.refresh-balance {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 22px;
    transition: var(--transition);
    padding: 8px;
    border-radius: 50%;
}

.refresh-balance:hover {
    transform: rotate(180deg);
    background: rgba(255, 255, 255, 0.1);
}

.server-filter {
    margin-bottom: 24px;
}

.server-filter label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--light);
}

.server-filter select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: var(--light);
    font-size: 16px;
    transition: var(--transition);
}

.server-filter select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.donate-product {
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.donate-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(99, 102, 241, 0.2);
}

.product-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--light);
}

.product-description {
    color: var(--gray);
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.product-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.product-price {
    font-weight: 600;
    color: var(--primary);
    font-size: 18px;
}

.product-server {
    font-size: 12px;
    color: var(--gray);
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
}

.buy-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 15px;
}

.buy-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.buy-btn:disabled {
    background: var(--gray);
    cursor: not-allowed;
}

/* News section */
.news-container {
    margin-top: 24px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.news-card {
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    opacity: 0;
    transform: translateY(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.news-card.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.news-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--light);
    line-height: 1.4;
}

.news-description {
    color: var(--gray);
    margin-bottom: 16px;
    line-height: 1.6;
    font-size: 14px;
}

.news-date {
    display: flex;
    align-items: center;
    color: var(--gray);
    font-size: 13px;
}

.news-date i {
    margin-right: 8px;
}

.news-empty, .news-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.news-empty i, .news-error i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.news-error small {
    display: block;
    margin-top: 12px;
    font-size: 13px;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.hidden {
    display: none !important;
}

/* Bottom Navigation - только для мобильных */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(26, 32, 44, 0.95);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: space-around;
    padding: 14px 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray);
    font-size: 12px;
    transition: var(--transition);
    padding: 10px 16px;
    border-radius: var(--radius);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 5px;
}

.nav-item:hover {
    color: var(--light);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar-open .app-container {
        margin-left: 0;
        width: 100%;
    }
    
    .app-container {
        padding: 80px 20px 20px;
    }
    
    .content-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 80px 15px 90px;
    }
    
    .glass-card {
        padding: 24px 20px;
    }
    
    .card-title {
        font-size: 28px;
    }
    
    .tabs {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .tab {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .products-grid, .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Показываем нижнюю навигацию на мобильных */
    .bottom-nav {
        display: flex;
    }
    
    /* Скрываем боковое меню по умолчанию на мобильных */
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        animation: slideIn 0.3s ease;
    }
    
    .menu-toggle {
        display: flex;
    }

    /* Mobile fixes: ensure fullscreen panel behaviour doesn't break layout */
    .glass-card {
        /* вернуть карточку в поток документа */
        position: relative !important;
        left: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        border-radius: var(--radius) !important;
        box-shadow: var(--shadow) !important;
        padding: 20px !important;
        overflow: visible !important;
    }

    /* Внутренняя карточка должна быть обычным блоком на мобильных */
    .glass-card .card-inner {
        position: static !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        background: rgba(255,255,255,0.03) !important;
        padding: 16px !important;
        border-radius: var(--radius) !important;
        box-shadow: var(--shadow) !important;
    }

    /* Вернуть нормальное выравнивание контейнера на мобильных */
    .app-container {
        align-items: stretch !important;
        justify-content: flex-start !important;
    }
}

@media (min-width: 769px) {
    /* На ПК боковое меню всегда открыто */
    .sidebar {
        transform: translateX(0);
        animation: slideIn 0.3s ease;
    }
    
    .app-container {
        margin-left: 250px;
        width: calc(100% - 250px);
        padding: 30px 40px;
    }
    
    /* Скрываем кнопку меню на ПК */
    .menu-toggle {
        display: none;
    }
    
    /* Центрируем контент на ПК */
    .content-wrapper {
        max-width: 800px;
        margin: 0 auto;
    }
    
    /* Улучшаем внешний вид для больших экранов */
    .glass-card {
        padding: 40px;
    }

    /* Делать карточку полноэкранной на десктопе */
    .glass-card {
        position: fixed;
        /* начинаем панель там, где заканчивается сайдбар (ширина сайдбара 250px) */
        left: 250px;
        top: 0;
        right: 0;
        bottom: 0;
        /* занимаем всю оставшуюся ширину и высоту */
        width: calc(100vw - 250px);
        height: 100vh;
        max-width: none;
        /* делаем панель плоской по краю меню */
        border-radius: 0;
        padding: 40px;
        overflow: auto;
        z-index: 900; /* ниже сайдбара (sidebar z-index:1000) */
        box-shadow: none; /* убрать тень, чтобы выглядело как фон */
    }
    /* центрируем внутреннюю компактную карточку по вертикали */
    .glass-card .card-inner {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        max-width: 900px;
    }
    
    .card-title {
        font-size: 36px;
    }
    
    .card-subtitle {
        font-size: 18px;
    }
}

@media (min-width: 1200px) {
    .content-wrapper {
        max-width: 900px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

@media (min-width: 1400px) {
    .content-wrapper {
        max-width: 1000px;
    }
    
    .app-container {
        padding: 40px 60px;
    }
}