/* messaging-styles.css - Styles pour la messagerie médicale */
/* Date: 2025-10-25 */
/* Version: 1.0 */

/* ==================== CONTENEUR PRINCIPAL ==================== */

.messaging-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: #ffffff;
    min-height: 100vh;
}

.messaging-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.messaging-header h2 {
    margin: 0;
    color: #111827 !important;
    font-size: 2rem !important;
    font-weight: 700 !important;
}

.stats-badges {
    display: flex;
    gap: 1rem;
}

.stat-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* ==================== NAVIGATION PAR ONGLETS ==================== */

.messaging-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e5e7eb;
}

.tab-button {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    color: #667eea;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.tab-button .badge {
    display: inline-block;
    background: #ef4444;
    color: white;
    border-radius: 12px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* ==================== FORMULAIRE DE RECHERCHE ==================== */

.search-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-form input {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
}

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

/* ==================== GRILLE DE MÉDECINS ==================== */

.doctors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.doctor-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.doctor-card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.doctor-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 1rem;
    border: 3px solid #667eea;
}

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

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 2rem;
}

.doctor-info {
    text-align: center;
    margin-bottom: 1rem;
}

.doctor-info h3 {
    margin: 0 0 0.5rem 0;
    color: #111827 !important;
    font-weight: 700 !important;
}

.doctor-info p {
    margin: 0.25rem 0;
    color: #4b5563 !important;
    font-size: 0.875rem;
    font-weight: 500 !important;
}

.doctor-info .specialty {
    color: #667eea !important;
    font-weight: 700 !important;
}

.doctor-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* ==================== DEMANDES DE CONNEXION ==================== */

.connection-requests {
    max-width: 800px;
    margin: 0 auto;
}

.requests-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.request-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.request-info {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.request-info .doctor-photo {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    margin: 0;
}

.request-info h4 {
    margin: 0 0 0.5rem 0;
    color: #111827 !important;
    font-weight: 700 !important;
}

.request-info p {
    margin: 0.25rem 0;
    color: #374151 !important;
    font-size: 0.875rem;
    font-weight: 500 !important;
}

.request-message {
    font-style: italic;
    background: #f3f4f6;
    padding: 0.5rem;
    border-radius: 6px;
    margin-top: 0.5rem !important;
}

.request-date {
    color: #9ca3af !important;
    font-size: 0.75rem !important;
}

.request-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ==================== LISTE DES CONVERSATIONS ==================== */

.conversations-list {
    max-width: 800px;
    margin: 0 auto;
}

.conversation-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.conversation-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.conversation-item:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.conversation-item.unread {
    background: #eff6ff;
    border-color: #667eea;
}

.conv-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid #667eea;
}

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

.conv-info {
    flex: 1;
}

.conv-info h4 {
    margin: 0 0 0.25rem 0;
    color: #111827 !important;
    font-weight: 700 !important;
}

.conv-info .specialty {
    color: #667eea !important;
    font-size: 0.75rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600 !important;
}

.conv-info .last-message {
    margin: 0;
    color: #374151 !important;
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500 !important;
}

.conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.conv-time {
    color: #9ca3af;
    font-size: 0.75rem;
}

.unread-badge {
    background: #ef4444;
    color: white;
    border-radius: 12px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==================== FENÊTRE DE CHAT ==================== */

.chat-window {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-back {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-header-info h3 {
    margin: 0;
    font-size: 1.125rem;
}

.chat-header-info p {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.9;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f9fafb;
}

.message {
    display: flex;
    margin-bottom: 1rem;
}

.message.mine {
    justify-content: flex-end;
}

.message.theirs {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 60%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.mine .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.theirs .message-bubble {
    background: white;
    color: #111827 !important;
    border: 2px solid #d1d5db;
    border-bottom-left-radius: 4px;
}

.message-bubble p {
    margin: 0 0 0.5rem 0;
    color: inherit !important;
    font-weight: 500 !important;
}

.message-time {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    text-align: right;
}

.chat-input-form {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
}

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

/* ==================== BOUTONS GÉNÉRAUX ==================== */

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

/* ==================== ÉTATS ==================== */

.loading-spinner {
    text-align: center;
    padding: 3rem;
    color: #374151 !important;
    font-size: 1.125rem;
    font-weight: 600 !important;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #4b5563 !important;
    font-size: 1rem;
    font-weight: 600 !important;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .messaging-container {
        padding: 1rem;
    }
    
    .messaging-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stats-badges {
        width: 100%;
        justify-content: space-between;
    }
    
    .stat-badge {
        padding: 0.5rem 1rem;
        flex: 1;
    }
    
    .search-form {
        grid-template-columns: 1fr;
    }
    
    .doctors-grid {
        grid-template-columns: 1fr;
    }
    
    .request-card {
        flex-direction: column;
        gap: 1rem;
    }
    
    .request-actions {
        width: 100%;
    }
    
    .request-actions button {
        flex: 1;
    }
    
    .chat-window {
        height: 500px;
    }
    
    .message-bubble {
        max-width: 80%;
    }
}


/* ==================== MODAL DE SÉCURITÉ ==================== */

.security-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.security-modal {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.security-modal-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    border-radius: 20px 20px 0 0;
}

.security-lock-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.security-modal-header h2 {
    margin: 0;
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    color: white !important;
}

.security-modal-body {
    padding: 2rem;
}

.security-feature {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 12px;
    border-left: 4px solid #10b981;
}

.security-feature:last-child {
    margin-bottom: 0;
}

.security-feature-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.security-feature h3 {
    margin: 0 0 0.5rem 0;
    color: #111827 !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
}

.security-feature p {
    margin: 0;
    color: #4b5563 !important;
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 500 !important;
}

.security-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
    width: 100%;
}

/* Badge sécurisé dans le header */
.security-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5) !important;
}

/* Responsive modal */
@media (max-width: 768px) {
    .security-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .security-modal-header {
        padding: 1.5rem;
    }
    
    .security-lock-icon {
        font-size: 3rem;
    }
    
    .security-modal-header h2 {
        font-size: 1.5rem !important;
    }
    
    .security-modal-body {
        padding: 1.5rem;
    }
    
    .security-feature {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .security-feature-icon {
        font-size: 2.5rem;
    }
}
