/* ================================================
   CHATBOT STYLES - MCL CONSTRUCTORA
   ================================================ */

/* Botón flotante del chat */
.chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
    padding: 8px;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

/* Logo en el botón flotante */
.chat-button-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chat-button i {
    color: white;
    font-size: 24px;
}

.chat-button.active {
    transform: scale(0.9);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
}

/* Ventana del chat - COMPACTA */
.chat-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 336px;
    height: 480px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 998;
    overflow: hidden;
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header del chat */
.chat-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: white;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Logo en el header del chat */
.chat-avatar-logo {
    width: 38px;
    height: 38px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.chat-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Avatar antiguo (mantener para compatibilidad) */
.chat-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.chat-header-text h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    opacity: 0.9;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #28a745;
    border-radius: 50%;
    animation: blink 2s infinite;
}

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

.chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Mensajes */
.chat-message {
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 30px;
    height: 30px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    padding: 4px;
}

/* Logo en los mensajes del bot */
.message-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
}

.message-content {
    max-width: 78%;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.message-text {
    background: white;
    padding: 7px 10px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 12px;
}

.user-message .message-text {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: white;
}

.message-text ul {
    margin: 6px 0;
    padding-left: 16px;
}

.message-text li {
    margin: 3px 0;
}

.message-time {
    font-size: 9px;
    color: #999;
    padding: 0 5px;
}

.user-message .message-time {
    text-align: right;
}

/* Indicador de escritura */
.typing-indicator .message-content {
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Preguntas rápidas */
.chat-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #eee;
}

.quick-question-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #333;
}

.quick-question-btn:hover {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
    transform: translateY(-2px);
}

.quick-question-btn i {
    font-size: 11px;
}

/* Área de entrada */
.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    width: 100%;
}

.chat-input {
    flex: 1;
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    resize: vertical;
    max-height: 150px;
    min-height: 50px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
}

.chat-input:focus {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.chat-send-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-size: 20px;
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, #333 0%, #555 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-send-btn:active {
    transform: translateY(0);
}

/* ================================================
   BOTÓN DE GOOGLE MAPS EN MENSAJES
   ================================================ */

/* Botón de link del mapa */
.btn-map-link {
    display: inline-block;
    background: linear-gradient(135deg, #4285F4 0%, #357AE8 100%);
    color: white !important;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 6px;
    box-shadow: 0 2px 4px rgba(66, 133, 244, 0.2);
}

.btn-map-link:hover {
    background: linear-gradient(135deg, #357AE8 0%, #2A63C8 100%);
    box-shadow: 0 3px 6px rgba(66, 133, 244, 0.3);
    transform: translateY(-1px);
}

.btn-map-link:active {
    transform: translateY(0);
}

.btn-map-link i {
    margin-right: 4px;
}

/* ================================================
   RESPONSIVE DESIGN - MEJORADO
   ================================================ */

/* Tablets y pantallas medianas */
@media (max-width: 1024px) {
    .chat-window {
        width: 336px;
        height: 480px;
        bottom: 80px;
        right: 20px;
    }
}

/* Tablets pequeñas */
@media (max-width: 768px) {
    .chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
        max-width: none;
        max-height: none;
    }
    
    .chat-window.active {
        transform: translateY(0) scale(1);
    }
    
    .chat-button {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        z-index: 1000;
    }
    
    .chat-button i {
        font-size: 28px;
    }
    
    .chat-header {
        border-radius: 0;
        padding: 16px 15px;
    }
    
    .chat-avatar-logo {
        width: 40px;
        height: 40px;
    }
    
    .chat-header-text h4 {
        font-size: 15px;
    }
    
    .chat-status {
        font-size: 12px;
    }
    
    .status-dot {
        width: 7px;
        height: 7px;
    }
    
    .chat-close-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 15px 12px;
    }
    
    .chat-input-area {
        border-radius: 0;
        padding: 15px;
    }
    
    .chat-input {
        padding: 14px 15px;
        font-size: 15px;
        border-radius: 14px;
    }
    
    .chat-send-btn {
        width: 54px;
        height: 54px;
        font-size: 22px;
        border-radius: 14px;
    }
    
    .message-content {
        max-width: 80%;
    }
    
    .message-text {
        font-size: 14px;
        padding: 10px 14px;
        border-radius: 14px;
    }
    
    .message-avatar {
        width: 34px;
        height: 34px;
    }
    
    .message-time {
        font-size: 10px;
    }
    
    .chat-quick-questions {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .quick-question-btn {
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 24px;
    }
}

/* Móviles */
@media (max-width: 480px) {
    .chat-button {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
    
    .chat-button i {
        font-size: 26px;
    }
    
    .chat-badge {
        width: 20px;
        height: 20px;
        font-size: 11px;
        top: -4px;
        right: -4px;
    }
    
    .chat-header {
        padding: 14px 12px;
    }
    
    .chat-avatar-logo {
        width: 36px;
        height: 36px;
    }
    
    .chat-header-text h4 {
        font-size: 14px;
    }
    
    .chat-status {
        font-size: 11px;
    }
    
    .status-dot {
        width: 6px;
        height: 6px;
    }
    
    .chat-close-btn {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }
    
    .chat-messages {
        padding: 12px 10px;
        gap: 10px;
    }
    
    .message-content {
        max-width: 82%;
    }
    
    .message-text {
        font-size: 13px;
        padding: 10px 12px;
        border-radius: 12px;
    }
    
    .message-time {
        font-size: 10px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
    }
    
    .chat-input-area {
        padding: 12px;
        gap: 8px;
    }
    
    .chat-input {
        font-size: 14px;
        padding: 12px 14px;
        border-radius: 12px;
        min-height: 48px;
    }
    
    .chat-send-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
        border-radius: 12px;
    }
    
    .chat-quick-questions {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 8px;
    }
    
    .quick-question-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 140px;
        justify-content: center;
        padding: 10px 12px;
        font-size: 12px;
        border-radius: 20px;
    }
    
    .chat-form {
        padding: 12px;
    }
    
    .chat-form h5 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .chat-form input,
    .chat-form select,
    .chat-form textarea {
        font-size: 14px;
        padding: 10px 12px;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    
    .btn-submit-form {
        padding: 12px;
        font-size: 14px;
        border-radius: 10px;
    }
    
    .typing-dots span {
        width: 7px;
        height: 7px;
    }
    
    .btn-map-link {
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 8px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
    .chat-button {
        width: 52px;
        height: 52px;
        bottom: 12px;
        right: 12px;
    }
    
    .chat-button i {
        font-size: 24px;
    }
    
    .chat-badge {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .chat-header {
        padding: 12px 10px;
    }
    
    .chat-avatar-logo {
        width: 32px;
        height: 32px;
    }
    
    .chat-header-text h4 {
        font-size: 13px;
    }
    
    .chat-status {
        font-size: 10px;
    }
    
    .chat-messages {
        padding: 10px 8px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message-text {
        font-size: 12px;
        padding: 9px 11px;
        border-radius: 11px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .chat-input-area {
        padding: 10px 8px;
    }
    
    .chat-input {
        font-size: 13px;
        padding: 10px 12px;
        min-height: 44px;
    }
    
    .chat-send-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .quick-question-btn {
        font-size: 11px;
        padding: 8px 10px;
        flex: 1 1 100%;
    }
    
    .chat-form input,
    .chat-form select,
    .chat-form textarea {
        font-size: 13px;
        padding: 9px 11px;
    }
}

/* Landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-window {
        height: 100vh;
        width: 100%;
        max-width: 400px;
        right: 0;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-messages {
        padding: 10px;
    }
    
    .chat-input-area {
        padding: 10px 12px;
    }
    
    .chat-input {
        min-height: 40px;
        font-size: 13px;
    }
    
    .chat-send-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .chat-quick-questions {
        padding: 8px 10px;
        gap: 6px;
    }
    
    .quick-question-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* Tablets en modo horizontal */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .chat-window {
        width: 336px;
        height: 480px;
    }
}

/* iPads y tablets grandes */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .chat-window {
        width: 336px;
        height: 480px;
        bottom: 80px;
        right: 20px;
    }
}

/* Desktops grandes */
@media (min-width: 1440px) {
    .chat-window {
        width: 336px;
        height: 480px;
        bottom: 80px;
        right: 30px;
    }
    
    .chat-button {
        width: 50px;
        height: 50px;
        bottom: 25px;
        right: 30px;
    }
    
    .chat-button i {
        font-size: 24px;
    }
}

/* Animaciones suaves en todos los dispositivos */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ================================================
   FORMULARIO DE CONTACTO EN CHAT
   ================================================ */

.chat-form {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-form h5 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.chat-form input,
.chat-form select,
.chat-form textarea {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.chat-form input:focus,
.chat-form select:focus,
.chat-form textarea:focus {
    outline: none;
    border-color: #1a1a1a;
}

.chat-form textarea {
    resize: vertical;
    min-height: 60px;
}

.btn-submit-form {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-submit-form:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-submit-form:active {
    transform: translateY(0);
}

/* Estilos para comandos especiales en mensajes */
.command-hint {
    background: #f0f8ff;
    border-left: 3px solid #1a1a1a;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
}

/* Indicador de estado del chatbot */
.chat-mode-indicator {
    position: absolute;
    top: 10px;
    right: 70px;
    background: rgba(40, 167, 69, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    z-index: 1000;
    animation: fadeIn 0.5s;
}

.chat-mode-indicator.ai {
    background: rgba(138, 43, 226, 0.9);
}

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