/* ==================== HR AGENT FLOATING WIDGET ==================== */
/* Redesenhado para seguir o Design System da Intranet Pireu */

/* Botão flutuante */
.hr-agent-fab {
    position: fixed;
    bottom: var(--space-8, 32px);
    right: var(--space-8, 32px);
    width: 60px;
    height: 60px;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #7c3aed 0%, var(--color-primary) 50%, #5b21b6 100%);
    border: 3px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(var(--color-primary-rgb), 0.4), 0 0 0 0 rgba(var(--color-primary-rgb), 0.3);
    z-index: var(--z-popover, 1060);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    animation: hr-fab-entrance 0.5s cubic-bezier(0.16, 1, 0.3, 1), hr-fab-pulse 3s ease-in-out 2s infinite;
    overflow: hidden;
}

.hr-agent-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(var(--color-primary-rgb), 0.5), 0 0 0 8px rgba(var(--color-primary-rgb), 0.08);
    animation: none;
}

.hr-agent-fab:active {
    transform: scale(0.95);
}

.hr-agent-fab svg {
    width: 32px;
    height: 32px;
    fill: var(--color-white, #fff);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.hr-agent-fab.open svg {
    transform: rotate(90deg);
}

.hr-agent-fab .fab-close-icon {
    display: none;
}

.hr-agent-fab.open .fab-chat-icon {
    display: none;
}

.hr-agent-fab.open .fab-close-icon {
    display: block;
}

/* Tooltip do botão */
.hr-agent-fab::before {
    content: 'Tira-Dúvidas RH';
    position: absolute;
    right: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-gray-900, #111);
    color: var(--color-white, #fff);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    font-size: var(--font-size-xs, 11px);
    font-weight: var(--font-weight-medium, 500);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.hr-agent-fab:hover::before {
    opacity: 1;
}

.hr-agent-fab.open::before {
    display: none;
}

/* Badge de notificação no FAB */
.hr-agent-fab .fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: var(--color-error, #FF3B30);
    border-radius: 50%;
    border: 2px solid var(--color-white, #fff);
    animation: hr-badge-pulse 2s ease-in-out infinite;
}

@keyframes hr-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes hr-fab-entrance {
    from { opacity: 0; transform: scale(0) rotate(-180deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes hr-fab-pulse {
    0%, 100% { box-shadow: 0 6px 24px rgba(var(--color-primary-rgb), 0.4), 0 0 0 0 rgba(var(--color-primary-rgb), 0.3); }
    50% { box-shadow: 0 6px 24px rgba(var(--color-primary-rgb), 0.4), 0 0 0 10px rgba(var(--color-primary-rgb), 0); }
}

/* Widget container */
.hr-agent-widget {
    position: fixed;
    bottom: 100px;
    right: var(--space-8, 32px);
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 140px);
    background: var(--surface-primary, #fff);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(var(--color-primary-rgb), 0.08);
    z-index: var(--z-tooltip, 1070);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hr-agent-widget.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.hr-agent-header {
    padding: var(--space-4, 16px) var(--space-5, 20px);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white, #fff);
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
}

.hr-agent-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.hr-agent-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.hr-agent-header-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--color-white, #fff);
}

.hr-agent-header-info {
    flex: 1;
    min-width: 0;
}

.hr-agent-header-info h3 {
    font-size: var(--font-size-base, 15px);
    font-weight: var(--font-weight-semibold, 600);
    margin: 0;
    letter-spacing: var(--letter-spacing-tight, -0.02em);
}

.hr-agent-header-info p {
    font-size: var(--font-size-xs, 11px);
    opacity: 0.85;
    margin: 0;
}

.hr-agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs, 11px);
    opacity: 0.9;
}

.hr-agent-status-dot {
    width: 7px;
    height: 7px;
    background: var(--color-success, #00C853);
    border-radius: 50%;
    animation: hr-status-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(0, 200, 83, 0.5);
}

@keyframes hr-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Mensagens */
.hr-agent-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4, 16px);
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 12px);
    background: var(--surface-secondary, #fafafa);
    scroll-behavior: smooth;
}

.hr-agent-messages::-webkit-scrollbar {
    width: 4px;
}

.hr-agent-messages::-webkit-scrollbar-track {
    background: transparent;
}

.hr-agent-messages::-webkit-scrollbar-thumb {
    background: var(--color-primary-alpha-20, rgba(var(--color-primary-rgb), 0.2));
}

/* Welcome */
.hr-agent-welcome {
    text-align: center;
    padding: var(--space-8, 32px) var(--space-3, 12px) var(--space-5, 20px);
    color: var(--text-secondary, #6A6A6A);
}

.hr-agent-welcome-icon {
    width: 56px;
    height: 56px;
    background: var(--color-primary-alpha-10, rgba(var(--color-primary-rgb), 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4, 16px);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
}

.hr-agent-welcome-icon svg {
    width: 28px;
    height: 28px;
    fill: var(--color-primary, #6D00FF);
}

.hr-agent-welcome h4 {
    font-size: var(--font-size-md, 17px);
    color: var(--text-primary, #111);
    margin-bottom: var(--space-1, 4px);
    font-weight: var(--font-weight-semibold, 600);
}

.hr-agent-welcome p {
    font-size: var(--font-size-sm, 13px);
    line-height: var(--line-height-relaxed, 1.6);
    color: var(--text-secondary, #6A6A6A);
    margin-bottom: var(--space-4, 16px);
}

.hr-agent-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2, 8px);
    justify-content: center;
}

.hr-agent-suggestion {
    padding: var(--space-2, 8px) var(--space-3, 12px);
    background: var(--surface-primary, #fff);
    border: 1px solid var(--border-color, #E5E5E5);
    border-radius: 20px;
    font-size: var(--font-size-xs, 11px);
    color: var(--color-primary, #6D00FF);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    font-weight: var(--font-weight-medium, 500);
}

.hr-agent-suggestion:hover {
    background: var(--color-primary, #6D00FF);
    border-color: var(--color-primary, #6D00FF);
    color: var(--color-white, #fff);
    transform: translateY(-1px);
    box-shadow: var(--shadow-primary, 0 4px 16px rgba(var(--color-primary-rgb), 0.24));
}

/* Message bubbles */
.hr-agent-msg {
    display: flex;
    gap: var(--space-2, 8px);
    max-width: 88%;
    animation: hr-msg-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes hr-msg-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hr-agent-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.hr-agent-msg.assistant {
    align-self: flex-start;
}

.hr-agent-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm, 13px);
    flex-shrink: 0;
}

.hr-agent-msg.user .hr-agent-msg-avatar {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white, #fff);
    box-shadow: var(--shadow-primary, 0 4px 16px rgba(var(--color-primary-rgb), 0.24));
}

.hr-agent-msg.assistant .hr-agent-msg-avatar {
    background: var(--color-primary-alpha-10, rgba(var(--color-primary-rgb), 0.1));
    color: var(--color-primary, #6D00FF);
}

.hr-agent-msg-content {
    padding: var(--space-3, 12px) var(--space-4, 16px);
    border-radius: 16px;
    line-height: var(--line-height-relaxed, 1.6);
    font-size: var(--font-size-sm, 13px);
}

.hr-agent-msg.user .hr-agent-msg-content {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white, #fff);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
    border-bottom-right-radius: 4px;
}

.hr-agent-msg.assistant .hr-agent-msg-content {
    background: var(--surface-primary, #fff);
    color: var(--text-primary, #111);
    border: 1px solid var(--border-color, #E5E5E5);
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.04));
    border-bottom-left-radius: 4px;
}

.hr-agent-msg-content p {
    margin-bottom: var(--space-2, 8px);
}

.hr-agent-msg-content p:last-child {
    margin-bottom: 0;
}

.hr-agent-msg-content ul,
.hr-agent-msg-content ol {
    margin: 6px 0;
    padding-left: 18px;
}

.hr-agent-msg-content li {
    margin-bottom: 4px;
}

.hr-agent-msg-content strong {
    color: var(--color-primary, #6D00FF);
    font-weight: var(--font-weight-semibold, 600);
}

.hr-agent-msg.user .hr-agent-msg-content strong {
    color: var(--color-primary-lighter, #A366FF);
}

/* Typing indicator */
.hr-agent-typing {
    display: flex;
    gap: var(--space-2, 8px);
    max-width: 88%;
    animation: hr-msg-in 0.3s ease;
}

.hr-agent-typing-dots {
    padding: var(--space-3, 12px) var(--space-4, 16px);
    background: var(--surface-primary, #fff);
    border: 1px solid var(--border-color, #E5E5E5);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.hr-agent-typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--color-primary-light, #8A33FF);
    border-radius: 50%;
    animation: hr-typing 1.4s ease-in-out infinite;
}

.hr-agent-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.hr-agent-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes hr-typing {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

/* Input area */
.hr-agent-input-area {
    padding: var(--space-3, 12px) var(--space-4, 16px) var(--space-4, 16px);
    background: var(--surface-primary, #fff);
    border-top: 1px solid var(--border-color-light, #F5F5F5);
    flex-shrink: 0;
}

.hr-agent-input-wrapper {
    display: flex;
    gap: var(--space-2, 8px);
    align-items: flex-end;
}

.hr-agent-input {
    flex: 1;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    border: 2px solid var(--border-color, #E5E5E5);
    border-radius: 14px;
    font-size: var(--font-size-sm, 13px);
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
    resize: none;
    min-height: 44px;
    max-height: 120px;
    line-height: var(--line-height-normal, 1.5);
    background: var(--surface-secondary, #fafafa);
    color: var(--text-primary, #111);
}

.hr-agent-input:focus {
    border-color: var(--color-primary, #6D00FF);
    box-shadow: 0 0 0 3px var(--color-primary-alpha-10, rgba(var(--color-primary-rgb), 0.1));
    background: var(--surface-primary, #fff);
}

.hr-agent-input::placeholder {
    color: var(--text-tertiary, #9A9A9A);
}

.hr-agent-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: none;
    border-radius: 12px;
    color: var(--color-white, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.hr-agent-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary, 0 4px 16px rgba(var(--color-primary-rgb), 0.24));
}

.hr-agent-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hr-agent-send svg {
    width: 18px;
    height: 18px;
}

.hr-agent-footer {
    text-align: center;
    padding-top: var(--space-2, 8px);
    font-size: var(--font-size-xs, 11px);
    color: var(--text-tertiary, #9A9A9A);
}

.hr-agent-footer span {
    color: var(--color-primary-light, #8A33FF);
}

/* ==================== DARK MODE ==================== */
[data-theme="dark"] .hr-agent-widget {
    background: var(--surface-primary, #1a1a2e);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(var(--color-primary-rgb), 0.15);
}

[data-theme="dark"] .hr-agent-messages {
    background: var(--surface-secondary, #16162a);
}

[data-theme="dark"] .hr-agent-welcome {
    color: var(--text-secondary, #9A9A9A);
}

[data-theme="dark"] .hr-agent-welcome h4 {
    color: var(--text-primary, #e4e7ef);
}

[data-theme="dark"] .hr-agent-welcome-icon {
    background: rgba(var(--color-primary-rgb), 0.15);
}

[data-theme="dark"] .hr-agent-suggestion {
    background: #252545;
    border-color: #3a3a5c;
    color: #b794ff;
}

[data-theme="dark"] .hr-agent-suggestion:hover {
    background: var(--color-primary, #6D00FF);
    color: var(--color-white, #fff);
}

[data-theme="dark"] .hr-agent-msg.assistant .hr-agent-msg-content {
    background: #252545;
    color: #d1d5e0;
    border-color: #3a3a5c;
}

[data-theme="dark"] .hr-agent-msg-content strong {
    color: #b794ff;
}

[data-theme="dark"] .hr-agent-typing-dots {
    background: #252545;
    border-color: #3a3a5c;
}

[data-theme="dark"] .hr-agent-input-area {
    background: var(--surface-primary, #1a1a2e);
    border-top-color: #252545;
}

[data-theme="dark"] .hr-agent-input {
    background: #252545;
    border-color: #3a3a5c;
    color: #e4e7ef;
}

[data-theme="dark"] .hr-agent-input:focus {
    border-color: var(--color-primary, #6D00FF);
    background: #2a2a4a;
}

[data-theme="dark"] .hr-agent-input::placeholder {
    color: #666;
}

[data-theme="dark"] .hr-agent-footer {
    color: #666;
}

[data-theme="dark"] .hr-agent-messages::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.3);
}

/* ==================== RESPONSIVO ==================== */
@media (max-width: 480px) {
    .hr-agent-widget {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        bottom: 76px;
        right: 8px;
    }

    .hr-agent-fab {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    .hr-agent-fab::before {
        display: none;
    }

    .hr-agent-fab svg {
        width: 22px;
        height: 22px;
    }
}
