/* ===== ОСНОВНЫЕ СТИЛИ ===== */
:root {
    --bg-dark: #0a0a0a;
    --bg-darker: #050505;
    --primary: #8a2be2;
    --primary-dark: #6a0dad;
    --primary-glow: rgba(138, 43, 226, 0.3);
    --text-light: #ffffff;
    --text-gray: #cccccc;
    --text-dark: #aaaaaa;
    --border-color: rgba(138, 43, 226, 0.2);
    --card-bg: rgba(20, 20, 20, 0.5);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ===== АНИМИРОВАННЫЙ ФОН (СЕТКА) ===== */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(106, 13, 173, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(106, 13, 173, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -2;
    animation: gridMove 20s linear infinite;
}

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

/* ===== ПЛАВАЮЩИЕ СФЕРЫ ===== */
.floating-sphere {
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle at 30% 30%, var(--primary-glow), transparent 70%);
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    z-index: -1;
    animation: floatSphere 15s ease-in-out infinite;
}

.sphere-1 {
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.sphere-2 {
    bottom: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    animation-delay: -5s;
}

@keyframes floatSphere {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, 30px); }
}

/* ===== ЧАСТИЦЫ (Particles.js) ===== */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== КОНТЕЙНЕР ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

/* ===== НАВИГАЦИЯ ===== */
nav {
    padding: 30px 0;
    animation: fadeInDown 1s ease-out;
    position: relative;
    z-index: 10;
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 50px;
    list-style: none;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    font-size: 18px;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    padding: 5px 10px;
    position: relative;
    background: transparent;
    border: none;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.nav-link:hover::before {
    width: 100%;
}

/* ===== HERO СЕКЦИЯ ===== */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    animation: fadeInUp 1s ease-out 0.3s both;
    position: relative;
    z-index: 2;
}

.hero-content h1 {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: 5px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--text-light) 0%, var(--primary) 50%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { filter: drop-shadow(0 0 20px var(--primary-glow)); }
    50% { filter: drop-shadow(0 0 40px var(--primary)); }
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-gray);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== КНОПКИ И ПОЛЯ ВВОДА (киберпанк стиль) ===== */
.btn {
    display: inline-block;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-light);
    border-radius: 50px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
    font-family: 'Rajdhani', sans-serif;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(138, 43, 226, 0.6);
}

input, textarea, select {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 12px 20px;
    color: var(--text-light);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    transition: all 0.3s;
    width: 100%;
    margin-bottom: 15px;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

button:not(.btn) {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    padding: 12px 30px;
    border-radius: 40px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    font-family: 'Rajdhani', sans-serif;
}

button:not(.btn):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--primary-glow);
}

/* ===== СЕКЦИИ ===== */
.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.services, .about, .contacts {
    padding: 100px 0;
    position: relative;
    z-index: 2;
}

/* ===== 3D КАРТОЧКИ УСЛУГ ===== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 40px 30px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    opacity: 0;
    animation: cardAppear 0.5s ease-out forwards;
    position: relative;
    cursor: pointer;
}

.service-card:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(2deg) translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 20px 40px var(--primary-glow);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.service-card p {
    color: var(--text-dark);
    line-height: 1.8;
}

@keyframes cardAppear {
    to { opacity: 1; transform: translateY(0); }
}

/* ===== ОБО МНЕ ===== */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.about-text p {
    color: var(--text-gray);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    text-align: center;
}

.stat-item {
    padding: 30px;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: 0.3s;
}

.stat-item:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    color: var(--text-dark);
}

/* ===== КОНТАКТЫ ===== */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    text-align: center;
}

.contact-item {
    padding: 40px 20px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-light);
    display: block;
}

.contact-item:hover {
    border-color: var(--primary);
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 10px 30px var(--primary-glow);
}

.contact-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--primary);
}

.contact-label {
    font-size: 1.2rem;
    font-weight: 600;
}

.contact-value {
    color: var(--text-dark);
}

/* ===== СЧЕТЧИК ПОСЕТИТЕЛЕЙ ===== */
.visitor-counter {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid #8a2be2;
    padding: 12px 25px;
    border-radius: 30px;
    font-family: 'Rajdhani', monospace;
    color: #8a2be2;
    backdrop-filter: blur(10px);
    z-index: 100;
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.3);
    font-size: 16px;
    letter-spacing: 1px;
}

.counter-label {
    color: #ffffff;
    opacity: 0.8;
}

.counter-value {
    font-weight: bold;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #8a2be2, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== ЧАТ ВИДЖЕТ (исправлен) ===== */
#chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}
#chat-toggle {
    background: var(--primary);
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 28px;
    box-shadow: 0 0 15px var(--primary);
    transition: 0.2s;
}
#chat-toggle:hover {
    transform: scale(1.05);
}
#chat-window {
    width: 320px;
    height: 450px;
    background: #1e1e2f;
    border: 1px solid var(--primary);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 70px;
    left: 0;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    z-index: 1001;
}
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.msg.user {
    text-align: right;
    color: var(--primary);
    background: rgba(138,43,226,0.2);
    padding: 8px 12px;
    border-radius: 18px;
    align-self: flex-end;
    max-width: 80%;
}
.msg.admin {
    text-align: left;
    color: white;
    background: #333;
    padding: 8px 12px;
    border-radius: 18px;
    align-self: flex-start;
    max-width: 80%;
}
#chat-input {
    width: calc(100% - 70px);
    margin: 8px;
    padding: 10px;
    border-radius: 30px;
    border: none;
    background: #2a2a3a;
    color: white;
}
#chat-send {
    width: 50px;
    margin: 8px 8px 8px 0;
    padding: 10px;
    background: var(--primary);
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
}

/* ===== ФУТЕР ===== */
footer {
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: #666666;
    position: relative;
    z-index: 2;
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== АДАПТАЦИЯ ===== */
@media (max-width: 768px) {
    .hero-content h1 { font-size: 3rem; }
    .nav-links { gap: 20px; }
    .about-content { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr; }
    .section-title { font-size: 2rem; }
}
@media (max-width: 480px) {
    .hero-content h1 { font-size: 2.5rem; }
    .btn { padding: 12px 30px; }
}

/* ===== ДЛЯ УСТРОЙСТВ С ПРЕДПОЧТЕНИЕМ УМЕНЬШЕННОЙ АНИМАЦИИ ===== */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}