/* Стили для чата */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.chat-header {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #3498db;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
}

.chat-info {
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.ticket-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ticket-meta-label {
    font-weight: 600;
    color: #6c757d;
}

.ticket-meta-value {
    color: #2c3e50;
}

.messages-area {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background-color: #f5f7fa;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh; /* Ограничим высоту, чтобы форма была видна */
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 10px;
}

.message {
    max-width: 70%;
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user {
    align-self: flex-end;
    background-color: #3498db;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.operator {
    align-self: flex-start;
    background-color: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message.system {
    align-self: center;
    background-color: #f8f9fa;
    color: #6c757d;
    font-style: italic;
    font-size: 0.9rem;
    max-width: 90%;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

.message-sender {
    font-weight: 600;
}

.message-time {
    opacity: 0.7;
}

.message.user .message-meta {
    color: rgba(255, 255, 255, 0.8);
}

.message-attachment-image {
    max-width: 300px; /* Ограничим ширину изображения */
    max-height: 300px; /* Ограничим высоту изображения */
    border-radius: 5px;
    margin-top: 5px;
    display: block;
}

.file-attachment {
    display: block;
    padding: 8px;
    margin-top: 5px;
    background-color: #f0f0f0;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 0.9em;
}

.file-attachment strong {
    color: #333;
}

.message.user .file-attachment {
    background-color: #e1f5fe; /* Светло-голубой для вложений пользователя */
    border-color: #b3e5fc;
}

.message.user .file-attachment strong {
    color: #01579b;
}

.message.operator .file-attachment {
    background-color: #e8f5e9; /* Светло-зеленый для вложений оператора */
    border-color: #c8e6c9;
}

.message.operator .file-attachment strong {
    color: #1b5e20;
}

.message-input-area {
    padding: 1rem;
    background-color: #fff;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.message-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.message-input {
    flex-grow: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #dce0e4;
    border-radius: 6px;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.message-input:focus {
    border-color: #3498db;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-actions .btn {
    min-width: 120px;
}

/* Стили для блока информации о тикете */
.ticket-info {
    margin-bottom: 20px;
}

.operator-assignment {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.operator-assignment strong {
    margin-right: 10px;
}

.operator-assignment form {
    display: flex;
    align-items: center;
    margin: 0;
    flex-wrap: wrap;
}

.operator-assignment select {
    margin-right: 10px;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #dce0e4;
}

.ticket-actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Адаптивный дизайн */
@media (max-width: 992px) {
    .message {
        max-width: 85%;
    }
    
    .message-attachment-image {
        max-width: 250px;
        max-height: 250px;
    }
}

@media (max-width: 768px) {
    .chat-container {
        height: 500px;
        margin-bottom: 1.5rem;
    }
    
    .message {
        max-width: 90%;
    }
    
    .ticket-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .operator-assignment {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }
    
    .operator-assignment form {
        flex-direction: column;
        width: 100%;
    }
    
    .operator-assignment select {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .message-attachment-image {
        max-width: 200px;
        max-height: 200px;
    }
    
    .ticket-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .ticket-actions form {
        width: 100%;
    }
    
    .ticket-actions button {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .message-input-area {
        padding: 0.75rem;
    }
    
    .messages-area {
        padding: 1rem;
        max-height: 50vh;
    }
    
    .message {
        width: 95%;
        padding: 0.7rem 1rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-actions input[type="file"] {
        width: 100%;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .ticket-info {
        margin-bottom: 1rem;
        padding: 0.75rem;
    }
    
    .ticket-info p {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }
    
    .operator-assignment {
        padding: 0.75rem;
    }
    
    /* Улучшение доступности файлового инпута для сенсорных экранов */
    input[type="file"] {
        padding: 10px 0;
    }
    
    /* Более крупные кнопки для сенсорных экранов */
    button {
        padding: 12px;
    }
} 