:root {
    --bg-dark: #0a0a12;
    --text-main: #f0f0f5;
    --text-muted: #a0a0b5;
    --accent-purple: #9d4edd;
    --accent-cyan: #00f5d4;
    --glass-bg: rgba(25, 25, 35, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

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

h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Above blobs, below content */
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 20s infinite alternate;
}

.purple-blob {
    width: 400px; height: 400px;
    background: var(--accent-purple);
    top: -100px; left: -100px;
}

.cyan-blob {
    width: 300px; height: 300px;
    background: var(--accent-cyan);
    bottom: -50px; right: -50px;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 150px) scale(1.2); }
}

/* Glass Card Utility */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Header & Nav */
header {
    position: fixed;
    top: 0; width: 100%;
    padding: 0.8rem 5%;
    display: flex;
    justify-content: center;
    background: rgba(10, 10, 18, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    max-width: 1200px;
}

.logo {
    justify-self: start;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: 2px;
}

.logo span {
    color: var(--accent-cyan);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    font-weight: 400;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-cyan);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-primary-small {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-family: 'Outfit', sans-serif;
}

.btn-primary {
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-cyan));
    color: #fff;
    box-shadow: 0 4px 15px rgba(157, 78, 221, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 245, 212, 0.6);
    transform: scale(1.05);
}

.btn-primary-small {
    padding: 0.5rem 1.5rem;
    background: var(--accent-purple);
    color: #fff;
}

.btn-primary-small:hover {
    background: var(--accent-cyan);
    color: #000;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-secondary:hover {
    background: rgba(0, 245, 212, 0.1);
}

/* Sections */
section {
    padding: 6rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 100px;
}

.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    max-width: 1200px;
    margin: 0 auto;
    text-align: left;
    position: relative;
}

.hero-content {
    flex: 1;
    z-index: 1;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    z-index: -2;
}

@keyframes float-avatar {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

.hero-image img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 0;
    box-shadow: none;
    border: none;
    mix-blend-mode: lighten;
    object-fit: cover;
    transition: transform 0.1s ease-out;
}

.hero-content h1 {
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.glitch-text {
    position: relative;
    color: #fff;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 0 1.5rem;
}

.bio-text {
    margin-top: 1rem;
    font-size: 1.1rem !important;
    color: var(--text-muted);
    border-left: 3px solid var(--accent-purple);
    padding-left: 1rem;
    margin-bottom: 2.5rem !important;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

/* Audience */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.tag {
    padding: 0.6rem 1.2rem;
    background: rgba(157, 78, 221, 0.1);
    border: 1px solid rgba(157, 78, 221, 0.3);
    border-radius: 20px;
    color: var(--accent-cyan);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}

/* Services */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.service-card .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.service-card h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.service-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Portfolio */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-image {
    height: 180px;
    width: 100%;
}

.project-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-type {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--accent-purple);
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.project-info h3 {
    margin-bottom: 0.8rem;
    font-size: 1.4rem;
}

.project-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.tech-stack {
    display: flex;
    gap: 0.5rem;
}

.tech-stack span {
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: var(--accent-cyan);
}

/* Contact */
.contact-box {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-box h2 {
    font-size: 2rem;
}

.contact-box p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

#contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#contact-form input, #contact-form textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: #fff;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

#contact-form input:focus, #contact-form textarea:focus {
    border-color: var(--accent-cyan);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.legal-links a {
    color: var(--text-muted);
    transition: color 0.3s ease;
    margin: 0 0.5rem;
}

.legal-links a:hover {
    color: var(--accent-cyan);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-container {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
        margin-top: 2rem;
    }

    .bio-text {
        text-align: left;
    }

    .hero-content h1 {
        font-size: 3rem;
    }
    
    .nav-links {
        display: none; /* In real app, add a hamburger menu */
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* Add this to the end of style.css */

.lang-switcher {
    justify-self: end;
    display: flex;
    gap: 0.5rem;
}

#lang-select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    backdrop-filter: blur(10px);
    appearance: none;
    -webkit-appearance: none;
}

#lang-select option {
    background: var(--bg-dark);
    color: #fff;
}

#lang-select:hover {
    border-color: var(--accent-cyan);
}

/* Update responsive styles */
@media (max-width: 900px) {
    .nav-links {
        display: none;
    }
    .lang-switcher {
        margin-left: auto;
    }
}

/* --- AI Chat Widget Styles --- */
#ai-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-toggle-btn {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
}

.chat-avatar-container {
    width: 65px; /* Увеличен размер по просьбе */
    height: 65px;
    position: relative;
    border-radius: 50%;
}

.chat-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: drop-shadow(0 0 15px rgba(0, 245, 212, 0.6));
}

.pulse-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50 2, 91 25, 91 75, 50 98, 9 75, 9 25' fill='none' stroke='%2300f5d4' stroke-width='3'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: pulse 2s infinite;
    pointer-events: none;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.chat-tooltip {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(10, 10, 12, 0.9);
    border: 1px solid var(--accent-cyan);
    color: var(--text-main);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.chat-toggle-btn:hover .chat-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.chat-window {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 450px;
    height: 650px;
    display: flex;
    flex-direction: column;
    border-radius: 15px;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 245, 212, 0.3);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 20px rgba(0, 245, 212, 0.1);
}

.chat-window.open {
    transform: scale(1);
}

.chat-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Убрана черная подложка и нижняя граница */
}

.header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-info img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    filter: drop-shadow(0 0 5px rgba(0, 245, 212, 0.4));
}

.header-info h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--accent-cyan);
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #00f5d4;
    border-radius: 50%;
    box-shadow: 0 0 5px #00f5d4;
    margin-right: 5px;
}

.header-info div {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.close-chat {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 10px;
    margin: -10px;
    z-index: 10;
    touch-action: manipulation;
}

.close-chat:hover, .close-chat:active {
    color: var(--accent-purple);
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(18, 18, 20, 0.6);
}

.message {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

.ai-message {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 2px;
}

.user-message {
    align-self: flex-end;
    background: rgba(0, 245, 212, 0.1);
    border: 1px solid rgba(0, 245, 212, 0.3);
    border-bottom-right-radius: 2px;
    color: #fff;
}

.chat-input-area {
    padding: 15px;
    background: rgba(10, 10, 12, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 10px 15px;
    border-radius: 20px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input-area input:focus {
    border-color: var(--accent-cyan);
}

.chat-input-area button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    background: var(--accent-purple);
    color: #fff;
    cursor: pointer;
    transition: background 0.3s ease;
}

.chat-input-area button:hover {
    background: var(--accent-cyan);
    color: #000;
}

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

@media (max-width: 768px) {
    #ai-chat-widget {
        bottom: 20px;
        right: 20px;
    }
    .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        max-width: 100%;
        z-index: 99999;
    }
    
    .chat-input-area {
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 20px));
}
