/* support.css */

body {
    margin: 0;
}

.main-content-wrapper {
    padding: 20px 10px;
}

.top-info-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.back-button {
    text-decoration: none;
    color: #007bff;
    font-size: 2em;
    padding: 10px;
}

.back-button:hover {
    color: #0056b3;
}

.status-buttons {
    display: flex;
    gap: 10px;
}

.status-button {
    padding: 10px 20px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    border-radius: 20px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    transition: background-color 0.3s;
}

.status-button.active {
    background-color: #e2e8f0;
    color: #333;
    border-color: #e2e8f0;
}

.status-button:hover:not(.active) {
    background-color: #e9ecef;
}

/* 1. Блок ввода сообщения: на всю ширину */
.new-message-form-container {
    padding: 0;
    border: none;
    background-color: transparent;
    border-radius: 0;
    margin-bottom: 20px;
    max-width: 100%; /* <-- ИЗМЕНЕНО */
}

.new-message-form {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    padding: 0;
    border: none;
    background-color: transparent;
    width: 100%;
    box-sizing: border-box;
}

.new-message-form textarea {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    resize: vertical;
    box-sizing: border-box;
}

.send-button {
    padding: 10px 15px;
    border: none;
    background-color: transparent;
    color: #007bff;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.5em;
    line-height: 1;
}

.send-button:hover {
    color: #0056b3;
}

.message-history-block, .note-block, .past-requests-block {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.info-item-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.info-item {
    display: flex;
    gap: 5px;
    align-items: center;
}

.info-label {
    font-weight: bold;
    color: #555;
    white-space: nowrap;
}

.info-value {
    color: #333;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    max-width: 100%;
}

.note-label {
    font-weight: bold;
    color: #555;
    font-size: 1.2em;
}

.note-value textarea {
    width: 100%;
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    resize: vertical;
    box-sizing: border-box;
}

.block-header {
    font-size: 1.5em;
    color: #1a2a40;
    margin-top: 0;
    margin-bottom: 20px;
}

.message-container {
    /* ВОЗВРАЩАЕМ FLEXBOX */
    display: flex;
    flex-direction: column;

    margin-bottom: 20px;
    width: 100%;
    overflow: hidden;
}

/* --- Стили для обтекания медиа-контента (FLOAT) --- */

/* 1. ОБЩИЕ стили для message-bubble (ДЛЯ ЛЕВОГО КРАЯ) */
.message-bubble {
    background-color: #f0f0f0; /* Цвет для клиента (слева) */
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 5px;

    /* --- СТИЛИ ДЛЯ ОГРАНИЧЕНИЯ ВЫСОТЫ --- */
    max-height: 150px; /* Установите желаемую максимальную высоту (например, 150px) */
    cursor: pointer; /* Добавим курсор-указатель, чтобы показать, что элемент кликабельный */
    transition: max-height 0.3s ease-out; /* Плавный переход для более приятного эффекта */
    /* ------------------------------------------- */

    overflow: hidden;

    width: auto;
    max-width: 80%;
    min-width: 180px; /* 150px (картинка) + 15px (слева) + 15px (справа) = 180px */
}

/* --- СТИЛЬ ДЛЯ РАЗВЕРНУТОГО СООБЩЕНИЯ --- */
.message-bubble.expanded {
    max-height: 2000px; /* Увеличьте до очень большого значения для показа всего содержимого */
    transition: max-height 0.5s ease-in; /* Плавный переход при разворачивании */
}
/* ------------------------------------------- */

/* 2. Стили для медиа-контейнера (ОБЩИЕ СТИЛЫ: ВСЕГДА float: left) */
.message-media-container {
    float: left; /* КЛЮЧ: Всегда плавает влево для всех сообщений */
    max-width: 150px;
    margin-right: 10px; /* Отступ справа от картинки до текста */
    margin-bottom: 5px;
}

.message-media-container .media-item {
    display: block;
}

.message-media-container .media-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 5px;
}

/* 3. Стили для бабла АВТОРА (Клиента) - остается слева.
   Переопределяем, чтобы не было никаких margin: auto */
.author-message-bubble {
    background-color: #f0f0f0; /* Цвет клиента */
    float: left;
    margin-left: 0;
    margin-right: 20%;
}

/* Стили для сообщений МОДЕРАТОРА (Выравнивание вправо) */
.moderator-message-bubble {
    background-color: #e2e8f0; /* Цвет для модератора (голубоватый) */
    float: right;
    margin-right: 0;
    margin-left: 20%;
}

/* 4. Обновляем текстовый параграф внутри бабла */
.message-bubble p {
    margin: 0;
    line-height: 1.4;
    /* СБРОС FLEXBOX */
    flex-grow: 0;
    min-width: auto;
}

/* ==================================== */
/* ФУТЕР СООБЩЕНИЯ (message-info-footer) */
/* ==================================== */

.message-info-footer {
    font-size: 0.8em;
    color: #666; /* Цвет, который вы использовали */
    margin-top: 3px;

    /* Делаем содержимое футера строкой (для разделения ID / Дата) */
    display: flex;
    gap: 5px;
    white-space: nowrap;

    /*width: 100%; !* Должен занимать всю ширину, чтобы его float сработал *!*/
}

.message-info-footer .separator {
    color: #aaa;
}

/* Выравнивание футера автора (слева) */
.author-info-footer {
    float: left;
    clear: left; /* Гарантирует, что он будет под пузырем */
    padding-left: 15px;
}

/* Выравнивание футера модератора (справа) */
.moderator-info-footer {
    padding-right: 15px;
    align-self: flex-end;
    /* УДАЛЯЕМ FLOAT СВОЙСТВА */
    float: none;
    clear: none;
    justify-content: flex-end;
}

/* 2. Кнопки прокрутки: на всю ширину и центрирование */
.go-to-bottom-button,
.go-to-top-button {
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: #007bff;
    font-size: 1.2em;
    font-weight: bold;
    padding: 6px 15px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    border-radius: 5px;
    transition: background-color 0.3s, border-color 0.3s;
    margin-left: auto; /* <-- ИЗМЕНЕНО */
    margin-right: auto; /* <-- ИЗМЕНЕНО */
    width: 100%; /* <-- ИЗМЕНЕНО */
    margin-top: 10px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.go-to-bottom-button:hover,
.go-to-top-button:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

html {
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* Stili tabeli dlya reviews.html */
.reviews-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 10px;
}

.reviews-table thead th {
    background-color: #f0f0f0;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: bold;
}

.reviews-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.reviews-table td.message-cell {
    width: auto;
}

.reviews-table thead th:nth-child(2),
.reviews-table td:nth-child(2) {
    width: 150px;
    min-width: 150px;
}

.reviews-table thead th:nth-child(3),
.reviews-table td:nth-child(3) {
    width: 250px;
    min-width: 250px;
}

.reviews-table .message-bubble-container {
    display: block;
}

/* Стили для message-bubble внутри таблицы "Предыдущие обращения" */
.reviews-table .message-bubble-container .message-bubble {
    /* Сбрасываем стили, влияющие на float, и применяем обрезку */
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;

    background-color: #e6e6e6;
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 5px;

    /* Стили для обрезки текста в таблице */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    /* СБРОС СТИЛЕЙ FLOAT для таблиц */
    display: block;
    float: none;
}

.message-timestamp-author {
    font-size: 0.8em;
    color: #888;
    text-align: left;
    white-space: nowrap;
}

.note-container {
    display: flex;
    flex-direction: column;
}

.note-author {
    font-weight: bold;
    margin-bottom: 5px;
    color: #4a5d73;
}

.note-text {
    font-style: italic;
    color: #666;
}

.clickable-row {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.clickable-row:hover {
    background-color: #eef2f5;
}

.reviews-table td a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.send-button i {
    pointer-events: none;
}

.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
    background: white; padding: 25px; border-radius: 8px; width: 450px; max-width: 90%; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.form-control { width: 100%; padding: 8px; margin: 8px 0 16px 0; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }