/* public/css/chat-style.css - VERSIÓN SIN MÁRGENES EXTRAS */
.gap-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Botón flotante */
.gap-chat-button {
    width: 60px;
    height: 60px;
    background: var(--gap-chat-primary, #0066cc);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0,102,204,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    border: 3px solid white;
    margin-left: auto;
}

.gap-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 25px rgba(0,102,204,0.4);
}

.gap-chat-button .chat-icon {
    font-size: 28px;
    color: white;
}

.gap-chat-button .unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid white;
}

/* Ventana de chat - ALTURA FIJA */
.gap-chat-window {
    position: fixed;
    top: 30px; /* Espacio desde arriba */
    left: 50%;
    transform: translateX(-50%); /* Solo centrado horizontal */
    width: 380px;
    max-height: calc(100vh - 60px); /* 30px arriba + 30px abajo = 60px */
    height: 500px; /* Altura preferida, pero no más que max-height */
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    z-index: 1000000;
}

/* Cuando la pantalla es más chica que 610px (550px + 60px) */
@media (max-height: 610px) {
    .gap-chat-window {
        top: 15px;
        bottom: 15px;
        height: auto;
        max-height: calc(100vh - 30px);
        transform: translateX(-50%);
    }
}

/* Para móviles muy pequeños */
@media (max-width: 480px) {
    .gap-chat-window {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

.gap-chat-window.open {
    display: flex;
}

/* Header - FIJO ARRIBA (SIN MÁRGENES) */
.gap-chat-header {
    background: var(--gap-chat-primary, #0066cc);
    color: white;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    flex-shrink: 0;
    height: 60px;
    min-height: 60px;
    max-height: 60px;
    box-sizing: border-box;
    margin: 0;
}

.gap-chat-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 60px;
}

.gap-chat-header .close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.gap-chat-header .close-chat:hover {
    opacity: 1;
}

/* Contenedor de mensajes - OCUPA EL ESPACIO RESTANTE */
.gap-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8fafc;
    height: calc(550px - 60px - 75px); /* 550px - header - input */
    min-height: 0;
    margin: 0;
    padding: 0;
}

.gap-chat-messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    margin: 0;
    padding: 0;
}

.gap-chat-messages {
    flex: 1;
    padding: 15px 15px 5px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    margin: 0;
    min-height: 0;
}

/* Input area - FIJO ABAJO (SIN MÁRGENES) */
.gap-chat-input-area {
    padding: 0 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    height: 75px;
    min-height: 75px;
    max-height: 75px;
    box-sizing: border-box;
    margin: 0;
}

.gap-chat-input-area input {
    flex: 1;
    padding: 10px 18px;
    border: 1px solid #d1d5db;
    border-radius: 30px;
    font-size: 0.95rem;
    transition: all 0.2s;
    outline: none;
    height: 45px;
    background: #ffffff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    box-sizing: border-box;
    margin: 0;
}

.gap-chat-input-area input:focus {
    border-color: var(--gap-chat-primary, #0066cc);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.15), inset 0 1px 3px rgba(0,0,0,0.05);
}

.gap-chat-input-area button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--gap-chat-primary, #0066cc);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin: 0;
    padding: 0;
}

.gap-chat-input-area button:hover {
    transform: scale(1.05);
    background: var(--gap-chat-secondary, #004999);
}

/* Mensajes */
.message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 85%;
    animation: fadeIn 0.2s ease;
    margin: 0;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
    font-size: 0.9rem;
    margin: 0;
}

.message.vendor .message-avatar {
    background: var(--gap-chat-primary, #0066cc);
    color: white;
}

.message-content {
    background: white;
    padding: 8px 12px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    word-break: break-word;
    margin: 0;
}

.message.vendor .message-content {
    background: var(--gap-chat-primary, #0066cc);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message-text {
    margin: 0 0 2px 0;
    line-height: 1.4;
    font-size: 0.9rem;
}

.message-time {
    font-size: 0.6rem;
    color: #94a3b8;
    text-align: right;
    margin: 0;
}

.message.vendor .message-time {
    color: rgba(255,255,255,0.8);
}

/* Formulario de inicio - CENTRADO */
.gap-chat-start {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: white;
    box-sizing: border-box;
    margin: 0;
    padding: 20px;
}

.gap-chat-start h3 {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-size: 1.3rem;
    width: 100%;
    text-align: center;
}

.gap-chat-start p {
    color: #64748b;
    margin: 0 0 25px 0;
    font-size: 0.95rem;
    width: 100%;
    text-align: center;
}

.gap-chat-start input {
    width: 100%;
    padding: 12px 15px;
    margin: 0 0 15px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.gap-chat-start input:last-of-type {
    margin-bottom: 20px;
}

.gap-chat-start input:focus {
    outline: none;
    border-color: var(--gap-chat-primary, #0066cc);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.gap-chat-start button {
    width: 100%;
    padding: 12px;
    background: var(--gap-chat-primary, #0066cc);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    box-sizing: border-box;
    margin: 0;
}

.gap-chat-start button:hover {
    background: var(--gap-chat-secondary, #004999);
}

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

/* Responsive */
@media (max-width: 480px) {
    .gap-chat-window {
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        transform: none;
        border-radius: 0;
    }
    
    .gap-chat-content {
        height: calc(100vh - 60px - 75px);
    }
    
    .gap-chat-button {
        width: 55px;
        height: 55px;
        bottom: 15px;
        right: 15px;
    }
    
    .gap-chat-button .chat-icon {
        font-size: 24px;
    }
}