/* Styles spécifiques pour les tickets côté utilisateur */

/* Compteur de messages */
.message-count-badge {
    background-color: #65B741;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(101, 183, 65, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(101, 183, 65, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(101, 183, 65, 0);
    }
}

/* Amélioration de l'en-tête des tickets */
.ticket-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticket-item {
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.ticket-item:hover {
    border-left-color: #65B741;
    transform: translateX(5px);
}

/* Styles pour le modal de détails du ticket */
.modal-content.large {
    max-width: 900px;
    width: 95%;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: visible;
    margin: 20px auto;
}

/* Modifier le modal parent pour permettre le scroll */
#ticket-detail-modal {
    align-items: flex-start !important;
    justify-content: center !important;
    overflow-y: auto !important;
    padding: 20px 0;
}

#ticket-detail-modal .modal-content {
    margin: 0 auto;
    position: relative;
    transform: none !important;
}

.ticket-detail-loading {
    padding: 60px;
    text-align: center;
    color: #666;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-spinner i {
    font-size: 32px;
    color: #65B741;
}

.ticket-detail-main {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    flex-shrink: 0;
}

.ticket-info {
    flex: 1;
}

.ticket-reference-large {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #65B741;
    margin-bottom: 6px;
}

.ticket-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.ticket-meta i {
    margin-right: 5px;
}

.ticket-subject {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.ticket-badges {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Badges spécifiques aux tickets */
.ticket-badges .status-badge, 
.ticket-badges .priority-badge, 
.ticket-badges .category-badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    display: inline-block;
    width: auto;
    height: auto;
    margin-right: 0;
}

.ticket-badges .status-badge.open {
    background-color: #e3f2fd;
    color: #1976d2;
}

.ticket-badges .status-badge.in_progress {
    background-color: #fff3e0;
    color: #f57c00;
}

.ticket-badges .status-badge.resolved {
    background-color: #e8f5e8;
    color: #388e3c;
}

.ticket-badges .status-badge.closed {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.ticket-badges .priority-badge.low {
    background-color: #e8f5e8;
    color: #388e3c;
}

.ticket-badges .priority-badge.medium, 
.ticket-badges .priority-badge.normal {
    background-color: #fff3e0;
    color: #f57c00;
}

.ticket-badges .priority-badge.high {
    background-color: #ffebee;
    color: #d32f2f;
}

.ticket-badges .priority-badge.critical {
    background-color: #ffebee;
    color: #c62828;
    animation: pulse-critical 2s infinite;
}

@keyframes pulse-critical {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ticket-badges .category-badge {
    background-color: #f5f5f5;
    color: #666;
}

/* Message original */
.ticket-original-message {
    padding: 25px;
    border-bottom: 1px solid #e0e0e0;
}

.message-header {
    margin-bottom: 15px;
}

.message-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-header i {
    color: #65B741;
}

.message-content {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #65B741;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
}

/* Réponses */
.ticket-responses {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.responses-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.responses-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.response-count-display {
    font-size: 14px;
    color: #666;
    background-color: #f0f0f0;
    padding: 4px 8px;
    border-radius: 12px;
}

.responses-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.response-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.response-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.response-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #333;
}

.response-author.admin {
    color: #65B741;
}

.response-author i {
    font-size: 14px;
}

.admin-badge {
    font-size: 10px;
    background-color: #65B741;
    color: white;
    padding: 2px 5px;
    border-radius: 8px;
    margin-left: 5px;
    font-weight: 600;
    text-transform: uppercase;
}

.response-date {
    font-size: 12px;
    color: #999;
}

.response-content {
    padding: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.no-responses {
    text-align: center;
    padding: 40px;
    color: #999;
}

.no-responses i {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Formulaire de réponse */
.ticket-response-form {
    padding: 20px;
    background-color: white;
    border-top: 2px solid #e0e0e0;
    flex-shrink: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.response-form-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.response-form-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.response-form-header h4 i {
    color: #65B741;
}

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

.ticket-response-form .form-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 14px;
}

.ticket-response-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
    background-color: #fafafa;
    box-sizing: border-box;
}

.ticket-response-form textarea:focus {
    outline: none;
    border-color: #65B741;
    box-shadow: 0 0 0 3px rgba(101, 183, 65, 0.1);
    background-color: white;
    transform: scale(1.01);
}

.ticket-response-form textarea::placeholder {
    color: #999;
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.form-actions .btn-cancel,
.form-actions .btn-create {
    padding: 12px 25px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-actions .btn-cancel {
    background: none;
    border: 1px solid #e0e0e0;
    color: #666;
}

.form-actions .btn-cancel:hover {
    background-color: #f5f5f5;
    transform: translateY(-1px);
}

.form-actions .btn-create {
    background-color: #65B741;
    color: white;
    border: none;
}

.form-actions .btn-create:hover {
    background-color: #4e9231;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(101, 183, 65, 0.3);
}

.form-actions .btn-create:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Erreur */
.ticket-detail-error {
    padding: 60px;
    text-align: center;
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.error-content i {
    font-size: 48px;
    color: #f44336;
}

.error-content h3 {
    margin: 0;
    color: #333;
}

.error-content p {
    margin: 0;
    color: #666;
    max-width: 400px;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content.large {
        width: 98%;
        margin: 10px auto;
    }
    
    #ticket-detail-modal {
        padding: 10px 0;
    }
    
    .ticket-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .ticket-badges {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
    }
    
    .ticket-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .responses-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .response-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .ticket-response-form {
        padding: 20px 15px;
    }
    
    .ticket-response-form textarea {
        min-height: 100px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    .form-actions .btn-cancel,
    .form-actions .btn-create {
        width: 100%;
        justify-content: center;
        padding: 15px;
    }
    
    .message-count-badge {
        font-size: 10px;
        padding: 2px 6px;
        min-width: 18px;
        height: 18px;
    }
}

/* Styles pour les messages dans les tickets */
.message-item {
    position: relative;
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ddd;
}

.message-item.message-user-initial {
    background-color: #f8f9fa;
    border-left-color: #007bff;
}

.message-item.message-admin {
    background-color: #fff3cd;
    border-left-color: #ffc107;
}

.message-item.message-user {
    background-color: #e7f3ff;
    border-left-color: #17a2b8;
}

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

.message-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.message-author i {
    width: 16px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-date {
    font-size: 0.85em;
    color: #666;
}

.message-number {
    background: rgba(0,0,0,0.1);
    color: #666;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.relative-time {
    font-style: italic;
    color: #999;
    margin-left: 5px;
}

.message-content {
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Badges pour les messages */
.initial-badge, .admin-badge, .user-badge {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 8px;
}

.initial-badge {
    background-color: #007bff;
    color: white;
}

.admin-badge {
    background-color: #ffc107;
    color: #212529;
}

.user-badge {
    background-color: #17a2b8;
    color: white;
}

/* Zone de contenu - plus de scroll interne */
.ticket-content-scrollable {
    flex: none;
    overflow: visible;
    max-height: none;
}

/* Styles spécifiques pour le bouton de fermeture des modals de tickets */
#ticket-detail-modal .close-modal,
#ticket-success-modal .close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    margin: 0;
}

#ticket-detail-modal .close-modal:hover,
#ticket-success-modal .close-modal:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
    transform: scale(1.1);
}

/* S'assurer que le header du modal a le bon alignement */
#ticket-detail-modal .modal-header,
#ticket-success-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

#ticket-detail-modal .modal-header h3,
#ticket-success-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    flex: 1;
} 