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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: calc(100% - 400px) 400px;
    gap: 20px;
}

h1 {
    grid-column: 1 / -1;
    color: white;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2rem;
}

.chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; /* Предотвращаем горизонтальную прокрутку */
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0; /* Позволяет flex-элементам сжиматься */
}

.message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    animation: fadeIn 0.3s;
    box-sizing: border-box;
    min-width: 0; /* Позволяет flex-элементам сжиматься */
}

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

.message.user {
    background: #667eea;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background: #f0f0f0;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.assistant strong {
    font-weight: 600;
    color: #333;
}

.message.assistant ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message.assistant li {
    margin: 4px 0;
    line-height: 1.5;
}

.message.loading {
    background: #f0f0f0;
    align-self: flex-start;
    font-style: italic;
    color: #666;
}

.chat-input-container {
    display: flex;
    padding: 16px;
    border-top: 1px solid #eee;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: #667eea;
}

.send-button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.send-button:hover:not(:disabled) {
    background: #5568d3;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.info-panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    height: fit-content;
}

.info-panel h3 {
    margin-bottom: 12px;
    color: #333;
}

.context-display {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.context-display strong {
    color: #667eea;
}

.edit-btn {
    width: 100%;
    padding: 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.edit-btn:hover {
    background: #5568d3;
}

.context-editor {
    grid-column: 1 / -1;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    margin-top: 20px;
}

.context-editor.hidden {
    display: none;
}

.context-editor label {
    display: block;
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.context-editor input,
.context-editor textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

.context-editor input:focus,
.context-editor textarea:focus {
    border-color: #667eea;
}

.context-editor textarea {
    min-height: 80px;
    resize: vertical;
}

#offers-container {
    margin-top: 20px;
}

.offer-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
}

.offer-item input {
    flex: 1;
}

.offer-item button {
    padding: 8px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.add-btn {
    margin-top: 8px;
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.editor-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.save-btn, .cancel-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.save-btn {
    background: #28a745;
    color: white;
}

.cancel-btn {
    background: #6c757d;
    color: white;
}

.quick-start-panel {
    grid-column: 1 / -1;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    margin-bottom: 20px;
}

.quick-start-panel h3 {
    color: #333;
    margin-bottom: 12px;
}

.quick-start-panel p {
    color: #666;
    margin-bottom: 16px;
}

.quick-start-btn {
    padding: 14px 28px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: background 0.3s;
}

.quick-start-btn:hover {
    background: #218838;
}

.message.welcome {
    background: #e7f3ff;
    border-left: 4px solid #667eea;
}

.message.quick-start {
    background: #f8f9fa;
}

.quick-start-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.quick-option-btn {
    padding: 12px 16px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: all 0.3s;
    color: #667eea;
    font-weight: 500;
}

.quick-option-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateX(4px);
}

.quick-option-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.message ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message li {
    margin: 4px 0;
}

.program-info {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.program-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.program-header h4 {
    margin: 0 0 12px 0;
    color: #667eea;
    font-size: 18px;
}

.program-price {
    margin: 12px 0;
    font-size: 16px;
    color: #28a745;
    font-weight: 600;
    padding: 8px 12px;
    background: #f0f9f4;
    border-radius: 6px;
    border-left: 3px solid #28a745;
}

.location-info {
    margin: 12px 0;
    font-size: 14px;
    color: #555;
}

.location-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid #667eea;
    transition: color 0.3s;
}

.location-link:hover {
    color: #5568d3;
    border-bottom-color: #5568d3;
}

.schedule-info {
    margin: 12px 0;
    font-size: 14px;
    color: #555;
}

.schedule-info ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.schedule-info li {
    margin: 4px 0;
    line-height: 1.5;
}

.program-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.register-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.3s;
    text-align: center;
}

.register-btn:hover {
    background: #218838;
}

/* Markdown таблицы */
.table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
    -webkit-overflow-scrolling: touch;
}

.markdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 500px;
}

.markdown-table th,
.markdown-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid #e0e0e0;
}

.markdown-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
    position: sticky;
    left: 0;
    z-index: 1;
}

.markdown-table tr:nth-child(even) {
    background: #f8f9fa;
}

.markdown-table tr:hover {
    background: #f0f0f0;
}

.markdown-table td strong {
    font-weight: 600;
    color: #333;
}

/* Карусель для программ */
.program-carousel-container {
    margin-top: 16px;
    position: relative;
}

.program-carousel-wrapper {
    overflow: hidden;
    position: relative;
    border-radius: 8px;
}

.program-carousel {
    display: flex;
    gap: 16px;
    scroll-snap-type: x mandatory;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.program-carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.program-carousel-slide {
    min-width: 100%;
    flex-shrink: 0;
    scroll-snap-align: start;
    opacity: 0.5;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    padding: 0 8px;
    box-sizing: border-box;
}

.program-carousel-slide .program-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.program-carousel-slide.active {
    opacity: 1;
    transform: scale(1);
}

.carousel-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.carousel-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-weight: bold;
    line-height: 1;
}

.carousel-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.carousel-indicators {
    display: flex;
    gap: 8px;
}

.carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #667eea;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.carousel-indicator.active {
    background: #667eea;
    transform: scale(1.2);
}

/* Coaching Team Section */
.coaching-team-section {
    grid-column: 1 / -1;
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    margin-top: 20px;
}

.coaching-team-section h2 {
    text-align: center;
    color: #333;
    margin-bottom: 32px;
    font-size: 2rem;
}

.coaches-slider-container {
    width: 100%;
    position: relative;
}

.coaches-slider {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
    scrollbar-width: thin;
    scrollbar-color: #667eea #f0f0f0;
}

.coaches-slider::-webkit-scrollbar {
    height: 8px;
}

.coaches-slider::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.coaches-slider::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.coaches-slider::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.coach-card {
    min-width: 300px;
    max-width: 300px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    scroll-snap-align: start;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.coach-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}

.coach-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 4px solid rgba(255,255,255,0.3);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
    object-fit: cover;
}

.coach-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coach-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: white;
}

.coach-title {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: rgba(255,255,255,0.95);
    opacity: 0.95;
}

.slider-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.slider-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.slider-btn:active {
    transform: scale(0.95);
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0e0e0;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.slider-dot.active {
    background: #667eea;
    transform: scale(1.3);
}

.slider-dot:hover {
    background: #667eea;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .program-card {
        padding: 12px;
    }
    
    .markdown-table {
        font-size: 12px;
    }
    
    .markdown-table th,
    .markdown-table td {
        padding: 8px;
    }
    
    .coaching-team-section {
        padding: 20px;
    }
    
    .coaching-team-section h2 {
        font-size: 1.5rem;
    }
    
    .coach-card {
        min-width: 250px;
        max-width: 250px;
        padding: 20px;
    }
    
    .coach-photo {
        width: 120px;
        height: 120px;
    }
    
    .coach-name {
        font-size: 1.25rem;
    }
    
    .coach-title {
        font-size: 0.9rem;
    }
    
    .slider-btn {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
}

/* Стили для секции about в чате */
.message .about-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    line-height: 1.6;
    color: #333;
}

.message .about-section img {
    max-width: 100%;
    height: auto;
}

.message .about-section p {
    margin: 8px 0;
}

.message .about-section strong {
    font-weight: 600;
}

.message .about-philosophy {
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
}

.message .about-body {
    margin-bottom: 20px;
}

.message .about-goals {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.message .about-goals-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #667eea;
}

.message .about-goals-body {
    line-height: 1.6;
}

/* Стили для слайдера тренеров в чате */
.message .coaches-slider-container {
    width: 100%;
    max-width: 100%;
    margin-top: 20px;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.message .coaches-slider {
    width: 100%;
    max-width: 100%;
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #667eea #f0f0f0;
    padding: 10px 0;
    box-sizing: border-box;
}

.message .coaches-slider::-webkit-scrollbar {
    height: 6px;
}

.message .coaches-slider::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.message .coaches-slider::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.message .coaches-slider::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.message .coach-card {
    min-width: 280px;
    max-width: 280px;
    flex-shrink: 0;
    scroll-snap-align: start;
    box-sizing: border-box;
}

.message .coach-photo {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255,255,255,0.2);
    border: 4px solid rgba(255,255,255,0.3);
}

.message .coach-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message .coach-photo span {
    font-size: 48px;
    color: white;
}

.message .coach-name {
    font-size: 1.2rem;
    margin-bottom: 8px;
    font-weight: 700;
    color: white;
}

.message .coach-title {
    font-size: 0.9rem;
    line-height: 1.4;
    color: rgba(255,255,255,0.95);
}

@media (max-width: 768px) {
    .message .coach-card {
        min-width: 220px;
        max-width: 220px;
    }
    
    .message .coaches-slider {
        padding: 10px 40px;
    }
    
    .message .slider-btn {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

