/**
 * Estilos para el Sistema de Chat de Citas
 * 
 * Diseño moderno y responsive para el chat modal
 */

/* Contenedor principal del chat */
.chat-cita-container {
    margin: 20px 0;
}

/* Botón para abrir chat */
.btn-chat-cita {
    background: linear-gradient(135deg, #0033A0 0%, #0053c7 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 51, 160, 0.2);
    position: relative;
}

.btn-chat-cita:hover {
    background: linear-gradient(135deg, #0053c7 0%, #0033A0 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 51, 160, 0.3);
}

.btn-chat-cita i {
    font-size: 16px;
}

/* Badge de mensajes no leídos */
.unread-badge {
    background: #D52B1E;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    position: absolute;
    top: -8px;
    right: -8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Modal del chat */
.modal-chat-cita {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Contenido del modal */
.modal-chat-content {
    background: white;
    border-radius: 20px;
    width: 90vw;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Header del modal */
.modal-chat-header {
    background: linear-gradient(135deg, #0033A0 0%, #0053c7 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-chat-close {
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-chat-close:hover {
    color: #D52B1E;
}

/* Información de la cita */
.chat-info {
    background: #f8f9fa;
    padding: 15px 25px;
    border-bottom: 1px solid #e9ecef;
}

.chat-info p {
    margin: 5px 0;
    font-size: 13px;
    color: #6c757d;
}

.chat-info strong {
    color: #495057;
}

/* Contenedor de mensajes */
.chat-messages {
    flex: 1;
    padding: 20px 25px;
    overflow-y: auto;
    max-height: 300px;
    background: #f8f9fa;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mensaje individual */
.chat-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message-own {
    align-items: flex-end;
}

.message-other {
    align-items: flex-start;
}

/* Contenido del mensaje */
.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.message-own .message-content {
    background: linear-gradient(135deg, #0033A0 0%, #0053c7 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-other .message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Texto del mensaje */
.message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Tiempo del mensaje */
.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.message-own .message-time {
    text-align: right;
}

/* Remitente del mensaje */
.message-sender {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    font-weight: 500;
}

.message-own .message-sender {
    text-align: right;
}

/* Mensaje sin contenido */
.no-messages {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
}

/* Contenedor de input */
.chat-input-container {
    padding: 20px 25px;
    background: white;
    border-radius: 0 0 20px 20px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* Input de texto */
.chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    resize: none;
    min-height: 45px;
    max-height: 100px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: #0033A0;
    box-shadow: 0 0 0 3px rgba(0, 51, 160, 0.1);
}

.chat-input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

/* Botón de enviar */
.chat-send-btn {
    background: linear-gradient(135deg, #D52B1E 0%, #e74c3c 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(213, 43, 30, 0.3);
}

.chat-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #e74c3c 0%, #D52B1E 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(213, 43, 30, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chat-send-btn i {
    font-size: 16px;
}

/* Indicadores de estado */
.chat-sending {
    opacity: 0.7;
}

.chat-error {
    border-color: #D52B1E !important;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Responsive */
@media (max-width: 768px) {
    .modal-chat-content {
        width: 95vw;
        max-height: 90vh;
    }
    
    .modal-chat-header {
        padding: 15px 20px;
    }
    
    .modal-chat-header h3 {
        font-size: 16px;
    }
    
    .chat-info {
        padding: 12px 20px;
    }
    
    .chat-messages {
        padding: 15px 20px;
        max-height: 250px;
    }
    
    .chat-input-container {
        padding: 15px 20px;
    }
    
    .message-content {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .btn-chat-cita {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .modal-chat-content {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        max-height: none;
    }
    
    .modal-chat-header {
        border-radius: 0;
    }
    
    .chat-input-container {
        border-radius: 0;
    }
    
    .chat-messages {
        max-height: 200px;
    }
}

/* Estados de carga */
.chat-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.chat-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-radius: 50%;
    border-top-color: #0033A0;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notificaciones */
.chat-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Temas alternativos */
.chat-theme-dark {
    background: #2c3e50;
    color: white;
}

.chat-theme-dark .modal-chat-content {
    background: #34495e;
    color: white;
}

.chat-theme-dark .chat-messages {
    background: #2c3e50;
}

.chat-theme-dark .message-other .message-content {
    background: #34495e;
    border-color: #4a5f7a;
}

.chat-theme-dark .chat-input {
    background: #34495e;
    border-color: #4a5f7a;
    color: white;
}

.chat-theme-dark .chat-input:focus {
    border-color: #3498db;
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .modal-chat-cita,
    .modal-chat-content,
    .btn-chat-cita,
    .chat-send-btn,
    .chat-notification {
        animation: none;
        transition: none;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .btn-chat-cita {
        border: 2px solid white;
    }
    
    .modal-chat-content {
        border: 2px solid #333;
    }
    
    .message-content {
        border: 2px solid currentColor;
    }
} 