/* ============================================
   SegurosGLA Chat Widget - Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Reset & Base --- */
#gla-chat-widget * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --- FAB Button --- */
#gla-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #0369a1;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(3, 105, 161, 0.35);
    z-index: 9998;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
#gla-chat-fab:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 28px rgba(3, 105, 161, 0.45);
    background: #0284c7;
}
#gla-chat-fab svg {
    width: 26px;
    height: 26px;
    transition: transform 0.25s;
}
#gla-chat-fab.open svg {
    transform: rotate(90deg);
}

/* Notification dot */
#gla-chat-fab .notif-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: gla-pulse 2s infinite;
}
@keyframes gla-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
}

/* --- Chat Window --- */
#gla-chat-window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    max-height: 580px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    transform: translateY(12px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}
#gla-chat-window.visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* --- Header --- */
#gla-chat-header {
    background: linear-gradient(135deg, #0c1929, #0f2440);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
#gla-chat-header .avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#gla-chat-header .avatar svg {
    width: 20px;
    height: 20px;
    color: #7dd3fc;
}
#gla-chat-header .info h3 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
#gla-chat-header .info p {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 1px;
}
#gla-chat-header .close-btn {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
#gla-chat-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* --- Messages Area --- */
#gla-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
    min-height: 300px;
    max-height: 380px;
}
#gla-chat-messages::-webkit-scrollbar {
    width: 4px;
}
#gla-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* --- Message Bubbles --- */
.gla-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}
.gla-msg.bot {
    align-self: flex-start;
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.gla-msg.bot a {
    color: #0369a1;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.15s;
}
.gla-msg.bot a:hover {
    color: #0284c7;
}
.gla-msg.user {
    align-self: flex-end;
    background: #0369a1;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* --- Typing indicator --- */
.gla-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.gla-typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: gla-bounce 1.4s infinite both;
}
.gla-typing span:nth-child(2) { animation-delay: 0.16s; }
.gla-typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes gla-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- Quick Reply Chips --- */
.gla-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    align-self: flex-start;
    max-width: 100%;
}
.gla-chip {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #0ea5e9;
    background: rgba(14, 165, 233, 0.06);
    color: #0369a1;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.gla-chip:hover {
    background: #0369a1;
    color: #fff;
    border-color: #0369a1;
}
.gla-chips + .gla-chips {
    margin-top: 2px;
}

/* --- Data Card --- */
.gla-data-card {
    align-self: flex-start;
    width: 100%;
    max-width: 300px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}
.gla-data-card .card-header {
    background: linear-gradient(135deg, #0c1929, #0f2440);
    color: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
}
.gla-data-card .card-header svg {
    width: 16px;
    height: 16px;
    color: #7dd3fc;
}
.gla-data-card .card-body {
    padding: 10px 14px;
}
.gla-data-card .card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
}
.gla-data-card .card-row:last-child {
    border-bottom: none;
}
.gla-data-card .card-row .label {
    color: #64748b;
}
.gla-data-card .card-row .value {
    color: #0f172a;
    font-weight: 600;
    text-align: right;
    max-width: 55%;
}
.gla-data-card .card-row .value.highlight {
    color: #0369a1;
    font-size: 15px;
}

/* --- Patente selector --- */
.gla-patente-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    align-self: flex-start;
    width: 100%;
    max-width: 280px;
}
.gla-patente-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    color: #1e293b;
    font-weight: 500;
}
.gla-patente-btn:hover {
    border-color: #0ea5e9;
    background: rgba(14, 165, 233, 0.04);
}
.gla-patente-btn .patente-code {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* --- Ticket Form --- */
.gla-ticket-form {
    align-self: flex-start;
    width: 100%;
    max-width: 300px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.gla-ticket-form label {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}
.gla-ticket-form select,
.gla-ticket-form textarea {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    font-family: inherit;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.15s;
    resize: vertical;
}
.gla-ticket-form select:focus,
.gla-ticket-form textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}
.gla-ticket-form .submit-btn {
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    background: #0369a1;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.gla-ticket-form .submit-btn:hover {
    background: #0284c7;
}
.gla-ticket-form .submit-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

/* --- Success message --- */
.gla-success {
    align-self: flex-start;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 300px;
}
.gla-success .icon {
    width: 20px;
    height: 20px;
    background: #22c55e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.gla-success .icon svg {
    width: 12px;
    height: 12px;
    color: #fff;
}
.gla-success .text {
    font-size: 13px;
    color: #166534;
    line-height: 1.5;
}
.gla-success .text strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

/* --- Error message --- */
.gla-error-msg {
    align-self: flex-start;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: #991b1b;
    max-width: 280px;
}

/* --- Input Area --- */
#gla-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
#gla-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    font-family: inherit;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.15s;
}
#gla-chat-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}
#gla-chat-input::placeholder {
    color: #94a3b8;
}
#gla-chat-input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
}
#gla-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #0369a1;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
#gla-chat-send:hover {
    background: #0284c7;
}
#gla-chat-send:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}
#gla-chat-send svg {
    width: 18px;
    height: 18px;
}

/* --- Mobile --- */
@media (max-width: 480px) {
    #gla-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    #gla-chat-messages {
        max-height: none;
        min-height: 0;
        flex: 1;
    }
    #gla-chat-fab {
        bottom: 16px;
        right: 16px;
    }
}
