/* ==================== ПЕРЕМЕННЫЕ ==================== */
:root {
    --primary-purple: #8a2be2;
    --dark-purple: #4b0082;
    --deep-purple: #1a0030;
    --light-purple: #9370db;
    --accent-purple: #ba55d3;
    --neon-purple: #bf40bf;
    --text-light: #e6e6fa;
    --text-muted: #b19cd9;
    --discord-color: #5865F2;
    --discord-hover: #4752C4;
    --gold: #FFD700;
    --silver: #C0C0C0;
    --bronze: #CD7F32;
    --success: #57F287;
    --danger: #ED4245;
    --warning: #FEE75C;
    --cosmic-cyan: #00e5ff;
    --bg-input: rgba(75,0,130,0.4);
    --border-input: rgba(138,43,226,0.3);
    --card-bg: rgba(45,0,54,0.6);
    --card-hover: rgba(75,0,130,0.5);
}

/* ==================== СБРОС И БАЗА ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0a0015 0%, var(--deep-purple) 30%, var(--dark-purple) 60%, #0a0025 100%);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== ПРЕЛОАДЕР ==================== */
#global-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--deep-purple);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#global-preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
}

.preloader-logo {
    font-size: 4rem;
    animation: float 2s ease-in-out infinite;
    margin-bottom: 20px;
}

.preloader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(138,43,226,0.3);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

.preloader-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    animation: preloaderPulse 1.5s ease-in-out infinite;
}

/* ==================== АНИМАЦИИ ==================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes starTwinkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.3); }
}

@keyframes nebulaPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes preloaderPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(60px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px var(--neon-purple); }
    50% { box-shadow: 0 0 40px var(--neon-purple), 0 0 60px rgba(138, 43, 226, 0.5); }
}

/* ==================== ФОН (ЗВЁЗДЫ И ТУМАННОСТИ) ==================== */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: starTwinkle 3s infinite;
    will-change: opacity, transform;
}

.nebula {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    z-index: -2;
    animation: nebulaPulse 8s ease-in-out infinite;
}

.nebula-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(138, 43, 226, 0.3), transparent);
    top: -200px;
    right: -200px;
}

.nebula-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(65, 105, 225, 0.3), transparent);
    bottom: -150px;
    left: -150px;
    animation-delay: 4s;
}

/* ==================== КАРТОЧКИ ==================== */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(138, 43, 226, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-purple);
    box-shadow: 0 10px 25px rgba(138, 43, 226, 0.2);
}

.card-glow {
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.card-glow:hover {
    box-shadow: 0 20px 40px rgba(138,43,226,0.2);
    border-color: var(--neon-purple);
}

/* ==================== КНОПКИ ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Montserrat', sans-serif;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-purple));
    color: white;
    box-shadow: 0 4px 15px rgba(138,43,226,0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(138,43,226,0.6);
}

.btn-success {
    background: var(--success);
    color: #000;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(87,242,135,0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(237,66,69,0.4);
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-discord {
    background: var(--discord-color);
    color: white;
    box-shadow: 0 3px 10px rgba(88, 101, 242, 0.3);
}

.btn-discord:hover {
    background: var(--discord-hover);
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(88, 101, 242, 0.5);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 8px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent-purple);
    color: var(--accent-purple);
}

.btn-outline:hover {
    background: rgba(138,43,226,0.2);
}

.btn-outline-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: rgba(237,66,69,0.2);
}

/* ==================== ФОРМЫ ==================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 2px solid var(--border-input);
    border-radius: 10px;
    color: var(--text-light);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.3s;
    resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--accent-purple);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 15px rgba(138,43,226,0.3);
}

textarea {
    min-height: 70px;
    line-height: 1.6;
}

/* ==================== МОДАЛЬНЫЕ ОКНА ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: rgba(30,0,50,0.95);
    border-radius: 25px;
    padding: 30px;
    border: 1px solid rgba(138,43,226,0.4);
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    max-width: 650px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: fadeInUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-purple);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

/* ==================== ПУСТОЕ СОСТОЯНИЕ ==================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ==================== СКРОЛЛБАР ==================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(75,0,130,0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 3px;
}

/* ==================== ТРАНЗАКЦИИ ==================== */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(75,0,130,0.25);
    border-radius: 10px;
    margin-bottom: 8px;
}

.transaction-amount {
    font-weight: 600;
}

.transaction-amount.positive { color: var(--success); }
.transaction-amount.negative { color: var(--danger); }

/* ==================== СТАТ-КАРТОЧКИ ==================== */
.stat-card {
    background: rgba(75,0,130,0.3);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(138,43,226,0.2);
}

.stat-card-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-purple);
}

.stat-card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card.gold .stat-card-value {
    color: var(--gold);
}

/* ==================== КНОПКА НАВЕРХ ==================== */
#back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(138,43,226,0.4);
    border: 1px solid rgba(138,43,226,0.5);
    border-radius: 50%;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background: rgba(138,43,226,0.7);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(138,43,226,0.4);
}

/* ==================== TOAST ==================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

.toast {
    min-width: 300px;
    max-width: 420px;
    background: rgba(20,5,40,0.95);
    border: 1px solid rgba(138,43,226,0.4);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    backdrop-filter: blur(20px);
    animation: slideUp 0.4s ease;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }

/* ==================== USER-PROFILE-CARD ==================== */
.user-profile-card,
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(75,0,130,0.4);
    padding: 5px 16px 5px 5px;
    border-radius: 50px;
    border: 1px solid var(--border-input);
    backdrop-filter: blur(10px);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-profile-card:hover,
.user-card:hover {
    background: rgba(75,0,130,0.6);
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(138,43,226,0.3);
    transform: translateY(-1px);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple);
    object-fit: cover;
    transition: all 0.3s ease;
}

.user-name {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ==================== BADGE ==================== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge.active {
    background: rgba(138,43,226,0.4);
    color: var(--accent-purple);
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 768px) {
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
    
    .modal {
        padding: 20px;
        border-radius: 20px;
    }
}