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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: #2c3e50;
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

nav a {
    color: white;
    text-decoration: none;
    margin-left: 2rem;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary {
    background: #f39c12;
    color: white;
}

.btn-secondary {
    background: white;
    color: #667eea;
}

/* Sections */
section {
    padding: 4rem 0;
}

section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
    color: #2c3e50;
}

/* Prices */
.prices {
    background: white;
}

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

.price-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.price-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.price-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.price {
    font-size: 2rem;
    font-weight: bold;
    color: #27ae60;
    margin-bottom: 1rem;
}

/* Locations */
.locations {
    background: #f8f9fa;
}

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

.location-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.location-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.location-card p {
    margin-bottom: 0.5rem;
}

/* About */
.about {
    background: white;
}

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

.feature {
    text-align: center;
    padding: 2rem;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* Contact */
.contact {
    background: #2c3e50;
    color: white;
    text-align: center;
}

.contact h2 {
    color: white;
}

.contact-info {
    font-size: 1.2rem;
}

.contact-info a {
    color: #f39c12;
    text-decoration: none;
}

/* Footer */
footer {
    background: #1a252f;
    color: white;
    text-align: center;
    padding: 2rem 0;
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.chat-button:hover {
    transform: scale(1.1);
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-auth {
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: calc(100% - 60px); /* Высота минус header */
}

.chat-auth input {
    width: 100%;
    padding: 0.75rem;
    margin: 1rem 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.chat-auth button {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.chat-content {
    display: flex;
    flex-direction: column;
    height: calc(100% - 60px); /* Высота минус header */
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0; /* Важно для корректной работы flex */
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.message {
    padding: 0.75rem;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    white-space: pre-wrap; /* Сохраняет переносы строк */
    overflow-wrap: break-word; /* Переносит длинные слова */
}

.message.user {
    background: #667eea;
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.message.assistant {
    background: #f1f3f4;
    color: #333;
    align-self: flex-start;
}

.message.operator {
    background: #f39c12;
    color: white;
    align-self: flex-start;
}

.history-separator {
    text-align: center;
    color: #999;
    font-size: 0.85rem;
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-top: 1px dashed #ddd;
    border-bottom: 1px dashed #ddd;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0; /* Предотвращает сжатие поля ввода */
    background: white; /* Фон для четкости */
}

.chat-input input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.chat-input button {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-content h2 {
        font-size: 1.8rem;
    }

    .chat-window {
        width: calc(100vw - 40px);
        right: 20px;
    }

    nav a {
        margin-left: 1rem;
        font-size: 0.9rem;
    }
}
