/* Base styles */
:root {
    --primary-color: #ff2a6d;
    --secondary-color: #ff4d8a;
    --dark-bg: #0a0a0a;
    --light-bg: #1a1a1a;
    --border-color: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #9ca3af;
    --ds-color-first: #323d46;
    --ds-color-second: #2f3435;
    --ds-color-third: #ffffff;
    --ds-color-fourth: #007bfb;
    --ds-color-fifth: #1b1e1f;
    --ds-color-gray: #6c757d;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-primary);
}

.container {
    max-width: 1250px;
    margin: 0 auto;
}

.main-content-wrapper {
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--light-bg) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Card styles */
.card {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.5);
    border-color: var(--primary-color);
}

.first-card {
    padding: 2rem;
}

/* Header styles */
.c-head-h1 h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.head-desc {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    text-align: center;
}

/* Step selection styles */
.step-1 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.select-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-item:hover {
    border-color: var(--primary-color);
    background: var(--light-bg);
}

.select-item.active {
    border-color: var(--primary-color);
    background: var(--light-bg);
    box-shadow: 0 0 10px rgba(255, 42, 109, 0.3);
}

.select-item img {
    width: 40px;
    height: 40px;
    margin-right: 1rem;
}

.s-i-title {
    font-weight: 600;
    font-size: 1rem;
}

/* Button styles */
.btn-container {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 1rem;
}

.btn, .btn-step-1 {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.5;
    pointer-events: none;
    background-color: var(--border-color);
    color: var(--text-muted);
}

.btn:enabled, .btn-step-1:enabled {
    opacity: 1;
    pointer-events: auto;
    background-color: var(--primary-color);
    color: var(--text-primary);
}

.btn:enabled:hover, .btn-step-1:enabled:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.5);
}

.btn-back {
    background-color: var(--primary-color);
    color: var(--text-primary);
    opacity: 1;
    pointer-events: auto;
}

.btn-back:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.5);
}

/* Chat styles */
.chat-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: 2px solid var(--light-bg);
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(255, 42, 109, 0.3);
    transition: all 0.3s ease;
}

/* Убираем изменение размера при наведении */
.chat-button:hover {
    box-shadow: 0 6px 25px rgba(255, 42, 109, 0.5);
    filter: brightness(1.1);
}

/* Улучшаем стиль для уведомлений */
.chat-button[data-unread]:not([data-unread=""])::before {
    content: attr(data-unread);
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 1.2rem;
    height: 1.2rem;
    background-color: #ff0000;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--dark-bg);
    animation: pulse 2s infinite;
}

/* Упрощаем анимацию для улучшения производительности */
@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.chat {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 380px;
    height: 520px;
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.chat.hiddenchat {
    width: 0;
    height: 0;
    border-width: 0;
    opacity: 0;
    visibility: hidden;
}

.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-bottom: 1px solid var(--border-color);
}

.chat-support-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid var(--text-primary);
    position: relative;
    overflow: hidden;
}

.chat-support-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0.75rem;
    height: 0.75rem;
    background-color: #00ff88;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.chat-support-name h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--dark-bg);
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.message-list li {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    max-width: 75%;
    word-wrap: break-word;
    position: relative;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-primary);
    margin-left: auto;
    border-bottom-right-radius: 0.3rem;
    box-shadow: 0 2px 10px rgba(255, 42, 109, 0.3);
}

.support-message {
    background: var(--light-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    margin-right: auto;
    border-bottom-left-radius: 0.3rem;
}

.message-sender {
    font-weight: 700;
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.message-timestamp {
    font-size: 0.65rem;
    margin-top: 0.3rem;
    opacity: 0.7;
}

.chat-input-section {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--light-bg);
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--dark-bg);
    border-radius: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
}

.chat-input {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-input-error {
    display: none;
    color: #ff4444;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.send-btn {
    width: 2.2rem;
    height: 2.2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 42, 109, 0.4);
}

.chat-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

/* Footer styles */
footer {
    margin-top: auto;
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .chat {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        transform: none !important;
        backface-visibility: visible !important;
    }

    .chat.hiddenchat {
        opacity: 0;
        visibility: hidden;
    }

    .chat-button {
        bottom: 1rem;
        right: 1rem;
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.3rem;
        transform: none !important;
        backface-visibility: visible !important;
    }

    .first-card {
        padding: 1rem;
    }

    .c-head-h1 h1 {
        font-size: 1.5rem;
    }

    .step-1 {
        gap: 0.75rem;
    }

    .select-item {
        padding: 0.75rem;
    }

    .select-item img {
        width: 32px;
        height: 32px;
        margin-right: 0.75rem;
    }

    .s-i-title {
        font-size: 0.875rem;
    }
    
    .chat-button[data-unread]:not([data-unread=""])::before {
        top: -3px;
        right: -3px;
        min-width: 1rem;
        height: 1rem;
        font-size: 0.6rem;
        transform: none !important;
    }
    
    .message-list li {
        max-width: 85%;
        animation: none;
    }
    
    /* Улучшаем анимацию открытия чата на мобильных */
    .chat:not(.hiddenchat) {
        animation: mobileChatOpen 0.3s ease forwards;
    }
    
    @keyframes mobileChatOpen {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

@keyframes ping {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Scrollbar styling */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

.chat-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Оптимизация для десктопов - добавляем только для больших экранов */
@media (min-width: 641px) {
    .chat-button {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
    
    .chat-button[data-unread]:not([data-unread=""])::before {
        transform: translateZ(0);
    }
    
    .chat {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
}