* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-bg: #0A0A12;
    --secondary-bg: #151525;
    --card-bg: rgba(255, 255, 255, 0.06);
    --accent-primary: #6366F1;
    --accent-secondary: #8B5CF6;
    --accent-success: #10B981;
    --accent-warning: #F59E0B;
    --accent-danger: #EF4444;
    --accent-info: #3B82F6;
    --text-primary: #FFFFFF;
    --text-secondary: #E4E4E7;
    --text-muted: #71717A;
    --border-color: rgba(255, 255, 255, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --gradient-primary: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    
    /* Неоновые цвета для мобильной аналитики */
    --neon-blue: #28D7FF;
    --neon-green: #21FFAD;
    --neon-orange: #FF8C42;
    --neon-blue-soft: #1197D6;
    --analytics-bg-main: #10111A;
    --analytics-card-bg: #191A23;
    --text-main: #fff;
    --text-muted-neon: #a1a4b3;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(59, 130, 246, 0.03) 0%, transparent 50%);
    animation: marketingPulse 20s ease-in-out infinite;
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(90deg, rgba(255,255,255,0.01) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255,255,255,0.01) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 25s linear infinite;
    z-index: -1;
}

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

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

/* Header */
.header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    font-size: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 3s infinite;
}

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

.status-badge {
    background: linear-gradient(135deg, var(--accent-success), var(--accent-info));
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    animation: statusGlow 4s infinite;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

@keyframes statusGlow {
    0%, 100% { opacity: 1; box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
    50% { opacity: 0.9; box-shadow: 0 0 30px rgba(16, 185, 129, 0.5); }
}

/* Navigation */
.nav-tabs {
    display: flex;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0.5rem;
    margin: 1.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.nav-tab {
    flex: 1;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.nav-tab.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Common utility classes */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner.large {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* Auth Loading Screen */
.auth-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0A0A12 0%, #1A1A2E 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.auth-loading-content {
    text-align: center;
    color: var(--text-primary);
    max-width: 400px;
    padding: 2rem;
}

.auth-loading-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

.auth-loading-content h1 {
    margin: 0 0 2rem 0;
    font-size: 1.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(122, 104, 250, 0.2);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

.auth-loading-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
    animation: fadeInOut 2s ease-in-out infinite;
}

/* Main App Interface - СКРЫТ ПО УМОЛЧАНИЮ */
.main-app-interface {
    width: 100%;
    height: 100%;
    display: none !important; /* Скрыт до тех пор пока JavaScript не проверит права */
}

/* Показываем интерфейс только когда JS добавит класс authorized */
.main-app-interface.authorized {
    display: block !important;
}

/* Дополнительная защита: если JS отключен, интерфейс остается скрытым */
.no-js .main-app-interface {
    display: none !important;
}

/* Загрузочный экран скрыт только если JS отключен (показываем сообщение об ошибке) */
.no-js .auth-loading-screen {
    display: flex !important;
}

.no-js .auth-loading-screen .auth-loading-content p {
    color: #EF4444;
}

.no-js .auth-loading-screen .auth-loading-content p::after {
    content: "Требуется включить JavaScript";
}

/* Auth Loading Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
