/* ========================================
   ОСНОВНЫЕ СТИЛИ ДЛЯ ОБРАТНОЙ СВЯЗИ
   ======================================== */

/* Контейнер */
.feedback-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   ШАПКА СТРАНИЦЫ
   ======================================== */
.feedback-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 20px 25px;
    margin-bottom: 25px;
    color: white;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-left h1 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-back {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    color: white;
}

.feedback-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

/* ========================================
   БЛОК ОБЪЯВЛЕНИЙ (СВЕРХУ)
   ======================================== */
.mass-messages-section {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
}

.section-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mass-messages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
}

.mass-message-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    position: relative;
}

.mass-message-card.new {
    border-left-color: #28a745;
    background: #f0fff4;
}

.mass-message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mass-message-header i {
    font-size: 1.2rem;
}

.mass-message-subject {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a2e;
    flex: 1;
}

.mass-message-date {
    font-size: 0.7rem;
    color: #6c757d;
}

.mass-message-content {
    font-size: 0.8rem;
    color: #495057;
    line-height: 1.5;
    margin-bottom: 10px;
}

.mass-message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.mass-message-recipient {
    font-size: 0.7rem;
    color: #6c757d;
}

.mass-message-actions {
    display: flex;
    gap: 8px;
}

/* Анимация для новых сообщений */
@keyframes pulse-new {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.mass-message-card.new {
    animation: pulse-new 2s infinite;
}

/* ========================================
   ИКОНКИ ОБЪЯВЛЕНИЙ
   ======================================== */
.mass-icon-bullhorn {
    color: #dc3545 !important;
}
.mass-icon-exclamation-circle {
    color: #ffc107 !important;
}
.mass-icon-info-circle {
    color: #17a2b8 !important;
}
.mass-icon-bell {
    color: #6f42c1 !important;
}
.mass-icon-star {
    color: #fd7e14 !important;
}

/* ========================================
   ОСНОВНОЕ СОДЕРЖИМОЕ (ДВЕ КОЛОНКИ)
   ======================================== */
.feedback-layout {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
}

/* Левая колонка - информация о пользователе */
.user-info-sidebar {
    flex: 0 0 25%;
    background: #f8f9fa;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #e9ecef;
    height: fit-content;
}

.user-avatar-large {
    text-align: center;
    margin-bottom: 20px;
}

.user-avatar-large img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.default-avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto;
}

.user-stats {
    text-align: center;
    padding: 15px 0;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
}

/* Правая колонка - обращения */
.threads-main {
    flex: 0 0 73%;
    background: #f8f9fa;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    height: 500px;
}

/* Список обращений */
.scroll-container {
    flex: 1;
    overflow-y: auto;
}

.thread-item {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.thread-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.thread-item.unread {
    background: #e8f4fd;
    border-left: 4px solid #667eea;
}

.thread-content {
    flex: 1;
}

.thread-subject {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.thread-preview {
    font-size: 0.75rem;
    color: #6c757d;
}

.thread-meta {
    text-align: right;
    min-width: 90px;
}

.thread-date {
    font-size: 0.7rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.thread-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-open {
    background: #d4edda;
    color: #155724;
}

.status-in_progress {
    background: #fff3cd;
    color: #856404;
}

.status-closed {
    background: #f8d7da;
    color: #721c24;
}

.unread-count {
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: bold;
}

/* Пустые состояния */
.no-messages,
.no-threads {
    text-align: center;
    padding: 30px;
    color: #adb5bd;
}

/* ========================================
   ИНФОБЛОК (ВНИЗУ)
   ======================================== */
.info-block {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 20px;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-block h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.info-block .alert {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    color: white;
    padding: 10px 15px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.info-block .alert-success {
    border-left: 4px solid #28a745;
}
.info-block .alert-info {
    border-left: 4px solid #17a2b8;
}
.info-block .alert-warning {
    border-left: 4px solid #ffc107;
}
.info-block .alert-danger {
    border-left: 4px solid #dc3545;
}

.system-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */
@media (max-width: 992px) {
    .feedback-layout {
        flex-direction: column;
    }
    
    .user-info-sidebar,
    .threads-main {
        flex: 0 0 auto;
    }
    
    .threads-main {
        height: 450px;
    }
}

@media (max-width: 768px) {
    .feedback-container {
        padding: 15px;
    }
    
    .feedback-header {
        padding: 15px;
    }
    
    .header-left {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mass-messages-grid {
        grid-template-columns: 1fr;
    }
    
    .thread-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .thread-meta {
        text-align: left;
        width: 100%;
    }
    
    .feedback-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .feedback-actions .btn-primary {
        text-align: center;
        justify-content: center;
    }
    
    .info-block {
        padding: 15px;
    }
}


/* ========================================
   ФОРМЫ
   ======================================== */
.feedback-form {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 25px;
    border: 1px solid #e9ecef;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1a1a2e;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.error-message {
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 5px;
}

/* ========================================
   ДЕТАЛЬНАЯ СТРАНИЦА ОБРАЩЕНИЯ
   ======================================== */
.thread-detail {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.thread-info {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.thread-info h2 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    color: #1a1a2e;
}

.thread-meta-detail {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

/* Сообщения */
.messages-container {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 25px;
    padding: 10px;
}

.message {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
}

.message-avatar {
    flex-shrink: 0;
}

.message-avatar-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.message-avatar-default {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.message-avatar-group {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.message-avatar-admin {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.message-content {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.message-user {
    background: #f0fdf4;
    border-left: 4px solid #28a745;
}

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

.message-broadcast {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.message-sender {
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-sender i {
    font-size: 0.8rem;
}

.admin-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
}

.broadcast-badge {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
}

.message-time {
    font-size: 0.7rem;
    color: #6c757d;
}

.message-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #495057;
}

.message-text p {
    margin: 0 0 10px 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

/* Форма ответа */
.reply-form {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e9ecef;
}

.reply-form h4 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: #1a1a2e;
}

.status-form {
    display: inline-block;
    margin-left: 10px;
}

.status-select {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    font-size: 0.8rem;
    background: white;
}


/* Аватары в сообщениях */
.message-avatar-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.message-avatar-default {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.message-avatar-group {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.message-avatar-admin {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}