/* Estilos para el chat de Navihomes - Diseño tipo WhatsApp con colores ocres */

:root {
    /* Colores ocres */
    --ocre-light: #f5e6d3;
    --ocre: #d4a574;
    --ocre-medium: #b8935f;
    --ocre-dark: #8b6f47;
    --ocre-darker: #6b5435;
    --ocre-header: #a67c52;
    --ocre-send: #b8935f;
    --ocre-bg: #faf8f5;
    --ocre-sidebar: #f5e6d3;
    --ocre-muted: #8b6f47;
    
    /* Colores complementarios */
    --white: #ffffff;
    --text-dark: #2c2c2c;
    --text-muted: #6c757d;
    --border-color: #e0d4c0;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

/* Estilos para móvil - prevenir cortes */
html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body {
    margin: 0;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

/* Sobrescribir colores de Bootstrap para mensajes del usuario - FORZAR OCRE */
.user-message .message-bubble,
.message.user-message .message-bubble,
.chat-messages .user-message .message-bubble,
.message-wrapper .user-message .message-bubble,
#chatMessages .user-message .message-bubble,
.chat-container .user-message .message-bubble {
    background: linear-gradient(135deg, #d4a574 0%, #b8935f 100%) !important;
    background-color: #d4a574 !important;
    background-image: none !important;
    color: #ffffff !important;
}

.user-message .message-avatar,
.message.user-message .message-avatar,
.chat-messages .user-message .message-avatar,
.message-wrapper .user-message .message-avatar,
#chatMessages .user-message .message-avatar {
    background: linear-gradient(135deg, #b8935f 0%, #8b6f47 100%) !important;
    background-color: #b8935f !important;
    background-image: none !important;
}

/* Asegurar que no haya colores azules de Bootstrap */
.user-message .message-bubble.bg-primary,
.user-message .message-bubble[class*="primary"],
.user-message .message-avatar.bg-primary,
.user-message .message-avatar[class*="primary"] {
    background: linear-gradient(135deg, #d4a574 0%, #b8935f 100%) !important;
    background-color: #d4a574 !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--ocre-bg) 0%, var(--ocre-light) 100%);
    height: 100vh;
    height: 100dvh;
    margin: 0;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Sidebar */
.sidebar-ocre {
    background: linear-gradient(180deg, var(--ocre-medium) 0%, var(--ocre) 100%);
    border-right: 1px solid var(--ocre-dark);
    color: var(--white);
}

.sidebar-ocre .text-ocre,
.sidebar-ocre .text-ocre-dark,
.sidebar-ocre .text-ocre-muted {
    color: var(--white) !important;
}

.sidebar-ocre .info-section {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.sidebar-ocre .info-section h5 {
    color: var(--ocre-dark);
}

.sidebar-ocre .info-section .small,
.sidebar-ocre .info-section li {
    color: var(--text-dark);
}

.text-ocre {
    color: var(--ocre-dark) !important;
}

.text-ocre-dark {
    color: var(--ocre-darker) !important;
}

.text-ocre-muted {
    color: var(--ocre-muted) !important;
}

.btn-ocre-light {
    background-color: var(--ocre-light);
    color: var(--ocre-dark);
    border: 1px solid var(--border-color);
}

.btn-ocre-light:hover {
    background-color: var(--ocre);
    color: var(--white);
}

.btn-ocre-dark {
    background-color: var(--ocre-dark);
    color: var(--white);
    border: 1px solid var(--ocre-darker);
}

.btn-ocre-dark:hover {
    background-color: var(--ocre-darker);
    color: var(--white);
    border-color: var(--ocre-darker);
}

.btn-ocre-send {
    background-color: var(--ocre-send);
    color: var(--white);
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.btn-ocre-send:hover:not(:disabled),
.btn-ocre-send:active:not(:disabled) {
    background-color: var(--ocre-dark);
    color: var(--white);
}

.btn-ocre-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.bg-ocre-header {
    background-color: var(--ocre-header) !important;
}

.chat-container {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--ocre-light) 0%, var(--ocre-bg) 100%);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.chat-header {
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--ocre-header);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-header .d-flex.gap-2 {
    gap: 8px;
}

#restartChat {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

#restartChat:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#restartChat:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

#restartChat:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-header .avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--white);
    flex-shrink: 0;
}

.chat-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.online-status {
    opacity: 0.9;
    font-size: 0.8rem;
    font-weight: 400;
}

/* Área de mensajes - Estilo WhatsApp */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: linear-gradient(135deg, var(--ocre-light) 0%, var(--ocre-bg) 100%);
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 35px,
            rgba(212, 165, 116, 0.05) 35px,
            rgba(212, 165, 116, 0.05) 70px
        );
    position: relative;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--ocre-light);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--ocre-medium);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--ocre-dark);
}

.message-wrapper {
    margin-bottom: 8px;
    display: flex;
    animation: slideIn 0.3s ease-out;
}

.message {
    display: flex;
    align-items: flex-end;
    max-width: 75%;
    gap: 8px;
}

/* Mensajes del asistente (izquierda) */
.assistant-message {
    align-self: flex-start;
}

.assistant-message .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--ocre) 0%, var(--ocre-medium) 100%);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.assistant-message .message-bubble {
    background-color: var(--white);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) var(--border-radius-lg) 4px;
    padding: 10px 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
    word-wrap: break-word;
}

.assistant-message .message-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent var(--white) transparent transparent;
}

/* Mensajes del usuario (derecha) */
.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}

.user-message .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--ocre-medium) 0%, var(--ocre-dark) 100%) !important;
    background-color: var(--ocre-medium) !important;
    color: var(--white) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-message .message-bubble {
    background: linear-gradient(135deg, var(--ocre) 0%, var(--ocre-medium) 100%) !important;
    background-color: var(--ocre) !important;
    color: var(--white) !important;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 4px var(--border-radius-lg);
    padding: 10px 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    position: relative;
    word-wrap: break-word;
}

.user-message .message-bubble::after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 8px 8px;
    border-color: transparent transparent var(--ocre-medium) transparent !important;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    word-wrap: break-word;
    line-height: 1.5;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    text-align: right;
    margin-top: 4px;
    font-weight: 400;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.9);
}

.assistant-message .message-time {
    color: var(--text-muted);
}

/* Mensaje de bienvenida */
.welcome-message {
    animation: fadeIn 0.5s ease-in;
}

.welcome-message .message-bubble {
    background: linear-gradient(135deg, var(--ocre-light) 0%, var(--white) 100%);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Área de entrada */
.chat-input-area {
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    background: linear-gradient(180deg, var(--ocre-light) 0%, var(--ocre-bg) 100%);
    flex-shrink: 0;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
    position: relative;
    z-index: 10;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.input-group .form-control {
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    font-size: 0.95rem;
    background-color: var(--white);
    color: var(--text-dark);
    flex: 1;
    min-width: 0; /* Permite que el flex funcione correctamente */
    max-width: 100%;
    box-sizing: border-box;
    resize: none;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 120px;
    line-height: 1.5;
}

.input-group textarea.form-control {
    min-height: 45px;
    height: auto;
}

.input-group .form-control:focus {
    border-color: var(--ocre);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
    outline: none;
}

.input-group .form-control:disabled {
    background-color: var(--ocre-light);
    opacity: 0.6;
}

.input-group .form-control:focus {
    /* Asegurar que el input sea visible cuando tiene foco */
    position: relative;
    z-index: 100;
}

/* Asegurar que el input no se salga del contenedor */
.chat-input-area .input-group {
    overflow: visible;
    align-items: flex-end;
}

.input-group .btn {
    border-radius: var(--border-radius-lg);
    min-width: 80px;
    width: auto;
    min-height: 45px;
    height: auto;
    align-self: flex-end;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    flex-shrink: 0;
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.input-footer {
    text-align: center;
    margin-top: 8px;
}

.input-footer small {
    color: var(--ocre-muted);
    font-size: 0.75rem;
}

.legal-notice {
    color: var(--ocre-muted);
    font-size: 0.72rem;
    line-height: 1.45;
    text-align: left;
    max-width: 100%;
}

.legal-notice strong {
    color: var(--ocre-dark);
    font-weight: 600;
}

/* Indicador grande en el centro de la pantalla */
.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-in;
}

.processing-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

.processing-icon {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.processing-message h4 {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 500;
}

.processing-spinner {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.spinner-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--ocre);
    animation: bounce 1.4s infinite ease-in-out both;
}

.spinner-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.spinner-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Indicador de escritura mejorado */
.typing-indicator {
    padding: 12px 16px;
    background: linear-gradient(180deg, var(--ocre-light) 0%, var(--ocre-bg) 100%);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.typing-indicator-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
}

.typing-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ocre) 0%, var(--ocre-medium) 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.typing-icon {
    color: var(--white);
    font-size: 1.2rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.typing-icon img {
    animation: pulse 1.5s ease-in-out infinite;
}

.typing-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ocre-dark);
    font-size: 0.9rem;
    font-weight: 500;
}

.typing-text {
    color: var(--ocre-dark);
    font-style: italic;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--ocre-medium);
    animation: typing 1.4s infinite ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.typing-dots span:nth-child(1) { 
    animation-delay: -0.32s; 
    background-color: var(--ocre);
}
.typing-dots span:nth-child(2) { 
    animation-delay: -0.16s; 
    background-color: var(--ocre-medium);
}
.typing-dots span:nth-child(3) { 
    background-color: var(--ocre-dark);
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8) translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2) translateY(-4px);
        opacity: 1;
    }
}

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

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

/* Indicador "Escribiendo..." dentro de la burbuja del asistente */
.bubble-typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.bubble-typing-indicator .bubble-typing-text {
    color: var(--ocre-dark);
    font-size: 0.9rem;
    font-style: italic;
    font-weight: 500;
    opacity: 0.85;
}

.bubble-typing-indicator .bubble-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.bubble-typing-indicator .bubble-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--ocre);
    animation: bubbleDotBounce 1.2s infinite ease-in-out;
}

.bubble-typing-indicator .bubble-dots span:nth-child(1) {
    animation-delay: 0s;
}

.bubble-typing-indicator .bubble-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.bubble-typing-indicator .bubble-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bubbleDotBounce {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px) scale(1.15);
        opacity: 1;
    }
}

/* Efecto typewriter: el texto aparece con animación suave */
.typewriter-active .message-text {
    overflow: hidden;
}

.typewriter-char {
    display: inline;
    animation: charFadeIn 0.05s ease-out forwards;
    opacity: 0;
}

@keyframes charFadeIn {
    to {
        opacity: 1;
    }
}

/* Cursor parpadeante mientras se escribe */
.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background-color: var(--ocre-dark);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.6s infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@media (max-width: 575.98px) {
    .typing-indicator {
        padding: 10px 12px;
    }
    
    .typing-avatar {
        width: 35px;
        height: 35px;
    }
    
    .typing-icon {
        font-size: 1rem;
    }
    
    .typing-message {
        font-size: 0.85rem;
    }
    
    .typing-dots span {
        width: 6px;
        height: 6px;
    }
}

/* Sidebar */
.sidebar-content {
    position: sticky;
    top: 2rem;
    height: calc(100vh - 4rem);
    overflow-y: auto;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: var(--ocre-light);
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--ocre-medium);
    border-radius: 3px;
}

.info-section {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.info-section h5 {
    color: var(--ocre-dark);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1rem;
}

.info-section ul {
    margin: 0;
    padding-left: 0;
}

.info-section li {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.info-section .small {
    color: var(--text-dark);
    line-height: 1.6;
}

/* Rating Modal */
.rating-stars {
    font-size: 2rem;
    color: var(--ocre);
    cursor: pointer;
}

.rating-stars .fa-star {
    transition: color 0.2s;
    margin: 0 4px;
}

.rating-stars .fa-star:hover,
.rating-stars .fa-star.active {
    color: var(--ocre-dark);
}

/* Mensajes de error */
.error-message .message-bubble {
    background-color: #dc3545;
    color: var(--white);
}

.error-message .message-avatar {
    background-color: var(--white);
    color: #dc3545;
}

/* Animaciones */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

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

/* Estados de carga */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Tablet - Mantener diseño ocre */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar-ocre {
        background: linear-gradient(180deg, var(--ocre-medium) 0%, var(--ocre) 100%);
    }
    
    .chat-container {
        background: linear-gradient(135deg, var(--ocre-light) 0%, var(--ocre-bg) 100%);
    }
    
    .chat-messages {
        background: linear-gradient(135deg, var(--ocre-light) 0%, var(--ocre-bg) 100%);
    }
    
    .chat-input-area {
        background: linear-gradient(180deg, var(--ocre-light) 0%, var(--ocre-bg) 100%);
    }
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar-content {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        background: linear-gradient(180deg, var(--ocre-medium) 0%, var(--ocre) 100%);
        z-index: 1050;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 2rem;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
        color: var(--white);
    }
    
    .sidebar-content.show .text-ocre,
    .sidebar-content.show .text-ocre-dark,
    .sidebar-content.show .text-ocre-muted {
        color: var(--white) !important;
    }
    
    .sidebar-content.show .info-section {
        background-color: rgba(255, 255, 255, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .sidebar-content.show .info-section h5 {
        color: var(--ocre-dark);
    }
    
    .sidebar-content.show .info-section .small,
    .sidebar-content.show .info-section li {
        color: var(--text-dark);
    }

    .sidebar-content.show {
        left: 0;
    }

    .chat-container {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        min-height: 100vh;
        min-height: 100dvh;
    }

    .message {
        max-width: 85%;
    }
}

@media (max-width: 575.98px) {
    .message {
        max-width: 90%;
    }

    .chat-messages {
        padding: 12px 12px 8px 12px;
        padding-bottom: 8px;
    }

    .chat-input-area {
        padding: 12px;
        padding-top: 8px;
        padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    }
    
    .input-group .btn {
        min-width: 90px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .input-group .btn span {
        display: inline !important;
    }

    .message-bubble {
        padding: 8px 12px;
    }

    .message-text {
        font-size: 0.9rem;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-header .avatar {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .chat-header h5 {
        font-size: 1rem;
    }

    #restartChat {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    #restartChat .ms-1 {
        display: none;
    }

    /* Input más grande para móvil */
    .input-group .form-control {
        font-size: 1.1rem;
        padding: 14px 18px;
        min-height: 52px;
        border-radius: 26px;
    }

    .input-group .btn {
        width: 52px;
        height: 52px;
        font-size: 1.2rem;
    }

    .input-footer {
        margin-top: 6px;
    }

    .input-footer small {
        font-size: 0.7rem;
    }

    .legal-notice {
        font-size: 0.65rem;
        line-height: 1.4;
    }
}

/* Mejoras de accesibilidad */
.message-bubble a {
    color: inherit;
    text-decoration: underline;
}

.user-message .message-bubble a {
    color: rgba(255, 255, 255, 0.95);
}

.assistant-message .message-bubble a {
    color: var(--ocre-dark);
}

/* Estilos para enlaces en mensajes */
.message-text a:hover {
    opacity: 0.8;
}

/* Botones de preguntas sugeridas */
.suggested-questions {
    padding: 8px 16px 16px;
    animation: fadeIn 0.5s ease-in 0.3s both;
}

.suggested-questions-label {
    font-size: 0.8rem;
    color: var(--ocre-dark);
    margin-bottom: 8px;
    font-weight: 500;
    padding-left: 40px;
}

.suggested-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 40px;
}

.btn-suggestion {
    background-color: var(--white);
    border: 1px solid var(--ocre);
    color: var(--ocre-dark);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.btn-suggestion:hover {
    background-color: var(--ocre);
    color: var(--white);
    border-color: var(--ocre-medium);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(139, 111, 71, 0.25);
}

.btn-suggestion:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(139, 111, 71, 0.2);
}

.btn-suggestion i {
    font-size: 0.75rem;
}

/* Enlace de contacto humano */
.contact-human-link {
    text-decoration: none;
    transition: color 0.2s ease;
}

.contact-human-link:hover {
    color: var(--ocre-dark) !important;
    text-decoration: underline;
}

/* Responsive para sugerencias */
@media (max-width: 575.98px) {
    .suggested-questions {
        padding: 6px 12px 12px;
    }

    .suggested-questions-label {
        padding-left: 0;
        text-align: center;
    }

    .suggested-buttons {
        padding-left: 0;
        justify-content: center;
    }

    .btn-suggestion {
        font-size: 0.78rem;
        padding: 5px 10px;
    }
    
    .input-footer .mx-2 {
        display: none;
    }
    
    .contact-human-link {
        display: block;
        margin-top: 4px;
    }
}

/* Pantalla de envío de incidencia final */
.final-incident-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: linear-gradient(135deg, var(--ocre-bg) 0%, var(--ocre-light) 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.final-incident-container {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.final-incident-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--ocre-header);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow);
}

.final-incident-back {
    color: var(--white) !important;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0;
}

.final-incident-body {
    padding: 1.25rem;
    flex: 1;
}

.final-incident-intro {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.photo-upload-zone {
    border: 2px dashed var(--ocre);
    border-radius: var(--border-radius);
    padding: 2rem 1rem;
    text-align: center;
    background: var(--white);
    margin-bottom: 1.25rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.photo-upload-zone:hover {
    border-color: var(--ocre-dark);
    background: var(--ocre-light);
}

.photo-upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.photo-gallery-preview {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0 1rem;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

.photo-preview-item {
    position: relative;
    flex: 0 0 auto;
    width: 140px;
    scroll-snap-align: start;
}

.photo-preview-item img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--border-color);
    display: block;
}

.photo-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
}

.photo-preview-name {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.final-incident-submit {
    padding: 0.75rem;
    font-size: 1rem;
}

/* Galería de fotos en mensajes del chat */
.message-photo-gallery {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    overflow-x: auto;
    margin-top: 0.75rem;
    padding: 0.25rem 0;
    -webkit-overflow-scrolling: touch;
}

.message-photo-item {
    flex: 0 0 auto;
    display: block;
}

.message-photo-item img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.2s;
}

.user-message .message-photo-item img {
    border-color: rgba(255, 255, 255, 0.4);
}

.assistant-message .message-photo-item img {
    border-color: var(--border-color);
}

.message-photo-item:hover img {
    transform: scale(1.05);
}

@media (max-width: 576px) {
    .final-incident-header h5 {
        font-size: 0.95rem;
    }

    .photo-preview-item,
    .photo-preview-item img {
        width: 110px;
        height: 110px;
    }

    .message-photo-item img {
        width: 80px;
        height: 80px;
    }
}
