/* ==========================================================================
   HR Informatica — Chat Widget Styles
   Simplified single-agent version. Green accent: var(--color-green, #7CB830)
   ========================================================================== */

/* Chat Bubble Wrapper */
.chat-bubble-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row;
    transition: opacity 0.25s ease;
}

/* Chat Widget Bubble — floating button */
.chat-widget-bubble {
    width: 56px;
    height: 56px;
    background: #1a1a1a;
    border: 2px solid var(--color-green, #7CB830);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
    animation: chatBubblePulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

.chat-widget-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    animation: none;
}

.chat-widget-bubble svg {
    width: 28px;
    height: 28px;
    fill: var(--color-green, #7CB830);
}

@keyframes chatBubblePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }
}

/* Notification Badge */
.chat-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 12px;
    height: 12px;
    background-color: #ef4444;
    font-size: 0;
    line-height: 0;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

.chat-badge.visible {
    display: flex;
    animation: badgeWobble 0.6s ease-out, badgeJiggle 3s ease-in-out 1.5s infinite;
}

@keyframes badgeWobble {
    0%   { transform: scale(0) rotate(0deg); }
    30%  { transform: scale(1.4) rotate(-12deg); }
    50%  { transform: scale(0.9) rotate(8deg); }
    70%  { transform: scale(1.15) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes badgeJiggle {
    0%, 85%, 100% { transform: rotate(0deg); }
    88% { transform: rotate(-8deg) scale(1.1); }
    91% { transform: rotate(8deg) scale(1.1); }
    94% { transform: rotate(-5deg); }
    97% { transform: rotate(3deg); }
}

/* Chat Widget Popup */
.chat-widget-popup {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 400px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 250ms;
}

.chat-widget-popup.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0s;
}

/* Chat View */
.chat-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Chat Header */
.chat-widget-header {
    position: relative;
    background: #1a1a1a;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--color-green, #7CB830);
}

.chat-header-left {
    flex: 1;
    min-width: 0;
}

.chat-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.chat-header-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--color-green, #7CB830);
    border-radius: 50%;
    animation: statusDotPulse 2s ease-in-out infinite;
}

@keyframes statusDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, opacity 0.15s ease;
    color: #fff;
}

.chat-header-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.chat-header-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.chat-widget-close svg {
    width: 24px;
    height: 24px;
}

/* Chat Messages */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #fff;
}

.chat-widget-messages .message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: messageFadeIn 0.3s ease;
}

@keyframes messageFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-widget-messages .message.bot {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #111827;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-widget-messages .message.user {
    background: var(--color-green, #7CB830);
    color: #1a1a1a;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

.chat-widget-messages .message p {
    margin: 0 0 8px 0;
}

.chat-widget-messages .message p:last-child {
    margin-bottom: 0;
}

/* Typing Indicator */
.chat-widget-messages .message.typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #6b7280;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Chat Input Area */
.chat-widget-input {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

/* Suggestion Chips */
.chat-widget-suggestions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-bottom: 12px;
    padding: 0 2px 8px 2px;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
    -webkit-overflow-scrolling: touch;
}

.chat-widget-suggestions::-webkit-scrollbar { height: 4px; }
.chat-widget-suggestions::-webkit-scrollbar-track { background: transparent; }
.chat-widget-suggestions::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 2px; }
.chat-widget-suggestions::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

.suggestion-chip {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    color: #111827;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
}

.suggestion-chip:hover {
    background: var(--color-green, #7CB830);
    border-color: var(--color-green, #7CB830);
    color: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(124, 184, 48, 0.3);
}

.suggestion-chip:active {
    transform: translateY(0);
}

/* Input + Send */
.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-widget-input input {
    flex: 1;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #111827;
    outline: none;
    transition: all 0.15s ease;
}

.chat-widget-input input::placeholder {
    color: #6b7280;
}

.chat-widget-input input:focus {
    border-color: var(--color-green, #7CB830);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(124, 184, 48, 0.2);
}

.send-button {
    width: 45px;
    height: 45px;
    background: var(--color-green, #7CB830);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.send-button:hover {
    background: #6aa028;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 184, 48, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.send-button svg {
    width: 20px;
    height: 20px;
    fill: #1a1a1a;
}

/* Focus States */
.send-button:focus-visible,
.suggestion-chip:focus-visible,
.chat-widget-bubble:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .chat-widget-popup {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 85vh;
        max-height: calc(100vh - 100px);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 250ms;
    }

    .chat-widget-popup.open {
        transform: translateY(0);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .chat-bubble-wrapper {
        bottom: 16px;
        right: 16px;
    }

    .chat-widget-bubble {
        width: 48px;
        height: 48px;
    }

    .chat-widget-bubble svg {
        width: 22px;
        height: 22px;
    }

    .chat-widget-input input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
    }

    .send-button {
        width: 42px;
        height: 42px;
        min-width: 42px;
    }

    .send-button svg {
        width: 18px;
        height: 18px;
    }
}
