/**
 * Baruh - Assistente Virtual IA
 * Modal centralizado conforme Figma Design System
 */

/* Backdrop */
.baruh-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    background: rgba(16, 20, 29, 0.7);
}

.baruh-backdrop.active {
    display: block;
}

[data-theme="light"] .baruh-backdrop {
    background: rgba(18, 21, 31, 0.2);
}

/* Modal */
.baruh-modal {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 720px;
    height: 520px;
    z-index: 9999;
    background: #1D2333;
    border: 1px solid rgba(224, 226, 235, 0.16);
    border-radius: 6px;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.baruh-modal.active {
    display: flex;
}

[data-theme="light"] .baruh-modal {
    background: #F6F6F9;
    border: 1px solid #CED3E2;
}

/* Header */
.baruh-header {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    gap: 8px;
    width: 100%;
    height: 64px;
    position: relative;
    flex-shrink: 0;
}

/* Logo */
.baruh-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.baruh-logo-symbol {
    width: 18px;
    height: 18px;
}

.baruh-logo-red {
    fill: #CC2727;
}

[data-theme="light"] .baruh-logo-red {
    fill: #C90A0A;
}

.baruh-logo-corner {
    fill: #E0E2EB;
}

[data-theme="light"] .baruh-logo-corner {
    fill: #12151F;
}

.baruh-logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 14px;
    line-height: 24px;
    color: #E0E2EB;
}

[data-theme="light"] .baruh-logo-text {
    color: #12151F;
}

/* Botao fechar */
.baruh-close {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 12px;
    height: 12px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #A2A8B9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.baruh-close:hover {
    color: #E0E2EB;
}

[data-theme="light"] .baruh-close {
    color: #7A839F;
}

[data-theme="light"] .baruh-close:hover {
    color: #394360;
}

/* Container */
.baruh-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 56px;
    gap: 56px;
    width: 100%;
    flex-grow: 1;
}

/* Text Container */
.baruh-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* Title */
.baruh-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 40px;
    text-align: center;
    color: #E0E2EB;
    margin: 0;
}

[data-theme="light"] .baruh-title {
    color: #12151F;
}

/* Subtitle */
.baruh-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    color: #BFC3CF;
    margin: 0;
}

[data-theme="light"] .baruh-subtitle {
    color: #394360;
}

/* Sugestoes */
.baruh-suggestions {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

/* Item de sugestao */
.baruh-suggestion-item {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
    gap: 20px;
    flex: 1;
    min-width: 0;
    height: 110px;
    background: #1D2333;
    border: 1px solid rgba(224, 226, 235, 0.16);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.baruh-suggestion-item:hover {
    background: #252B3D;
    border-color: rgba(224, 226, 235, 0.24);
}

[data-theme="light"] .baruh-suggestion-item {
    background: #F6F6F9;
    border: 1px solid #CED3E2;
}

[data-theme="light"] .baruh-suggestion-item:hover {
    background: #ECEDF2;
}

.baruh-suggestion-icon {
    width: 18px;
    height: 18px;
    color: #CC2727;
    flex-shrink: 0;
}

[data-theme="light"] .baruh-suggestion-icon {
    color: #C90A0A;
}

.baruh-suggestion-item span {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 24px;
    color: #E0E2EB;
    text-align: left;
}

[data-theme="light"] .baruh-suggestion-item span {
    color: #12151F;
}

/* Input Container */
.baruh-input-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 56px 40px;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Input Field */
.baruh-input-field {
    flex: 1;
}

.baruh-input-field textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    max-height: 120px;
    padding: 8px 12px;
    background: #1D2333;
    border: 1px solid rgba(224, 226, 235, 0.16);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 24px;
    color: #E0E2EB;
    resize: none;
    overflow-y: auto;
}

.baruh-input-field textarea::placeholder {
    color: #A2A8B9;
}

.baruh-input-field textarea:focus {
    outline: none;
    border-color: rgba(224, 226, 235, 0.32);
}

[data-theme="light"] .baruh-input-field textarea {
    background: #F6F6F9;
    border: 1px solid #CED3E2;
    color: #12151F;
}

[data-theme="light"] .baruh-input-field textarea::placeholder {
    color: #7A839F;
}

[data-theme="light"] .baruh-input-field textarea:focus {
    border-color: #7A839F;
}

/* Send Button */
.baruh-send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1D2333;
    border: none;
    border-radius: 6px;
    cursor: not-allowed;
    transition: background-color 0.2s;
}

.baruh-send-btn:disabled .baruh-send-circle {
    fill: transparent;
}

.baruh-send-btn:disabled .baruh-send-arrow {
    stroke: #A2A8B9;
}

.baruh-send-btn:not(:disabled) {
    background: #CC2727;
    cursor: pointer;
}

.baruh-send-btn:not(:disabled):hover {
    background: #970707;
}

.baruh-send-btn:not(:disabled) .baruh-send-circle {
    fill: transparent;
}

.baruh-send-btn:not(:disabled) .baruh-send-arrow {
    stroke: #FDEBEB;
}

[data-theme="light"] .baruh-send-btn {
    background: #E6E8EF;
}

[data-theme="light"] .baruh-send-btn:disabled .baruh-send-arrow {
    stroke: #7A839F;
}

[data-theme="light"] .baruh-send-btn:not(:disabled) {
    background: #C90A0A;
}

[data-theme="light"] .baruh-send-btn:not(:disabled):hover {
    background: #970707;
}

[data-theme="light"] .baruh-send-btn:not(:disabled) .baruh-send-arrow {
    stroke: #F9E1E1;
}

/* Chat Container */
.baruh-chat {
    padding: 0 56px 0;
    gap: 12px;
    justify-content: flex-end;
    overflow: hidden;
    min-height: 0;
}

/* Messages */
.baruh-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    overflow-y: auto;
    flex-grow: 1;
    padding-bottom: 12px;
}

/* Scrollbar */
.baruh-messages::-webkit-scrollbar {
    width: 4px;
}

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

.baruh-messages::-webkit-scrollbar-thumb {
    background: rgba(224, 226, 235, 0.3);
    border-radius: 10px;
}

[data-theme="light"] .baruh-messages::-webkit-scrollbar-thumb {
    background: #CED3E2;
}

/* User Message */
.baruh-message-user {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.baruh-message-user .baruh-message-content {
    padding: 6px 8px;
    background: rgba(224, 226, 235, 0.1);
    border-radius: 6px;
    max-width: 80%;
}

[data-theme="light"] .baruh-message-user .baruh-message-content {
    background: #ECEDF2;
}

.baruh-message-user .baruh-message-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 12px;
    line-height: 22px;
    color: #E0E2EB;
}

[data-theme="light"] .baruh-message-user .baruh-message-text {
    color: #12151F;
}

/* Assistant Message */
.baruh-message-assistant {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.baruh-message-assistant .baruh-message-content {
    padding: 0 20px;
    border-left: 1px solid rgba(224, 226, 235, 0.16);
}

[data-theme="light"] .baruh-message-assistant .baruh-message-content {
    border-left-color: #CED3E2;
}

.baruh-message-assistant .baruh-message-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 12px;
    line-height: 22px;
    color: #E0E2EB;
}

[data-theme="light"] .baruh-message-assistant .baruh-message-text {
    color: #12151F;
}

/* Markdown dentro das mensagens do assistente */
.baruh-message-text h1,
.baruh-message-text h2,
.baruh-message-text h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    margin: 8px 0 4px;
}

.baruh-message-text h1 { font-size: 15px; }
.baruh-message-text h2 { font-size: 14px; }
.baruh-message-text h3 { font-size: 13px; }

.baruh-message-text p {
    margin: 4px 0;
}

.baruh-message-text ul,
.baruh-message-text ol {
    margin: 4px 0;
    padding-left: 20px;
}

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

.baruh-message-text strong {
    font-weight: 600;
}

.baruh-message-text code {
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
    background: rgba(224, 226, 235, 0.12);
}

[data-theme="light"] .baruh-message-text code {
    background: #E6E8EF;
}

/* Message Actions */
.baruh-message-actions {
    display: flex;
    gap: 8px;
    padding-left: 20px;
}

.baruh-action-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #A2A8B9;
}

.baruh-action-btn:hover {
    color: #E0E2EB;
}

[data-theme="light"] .baruh-action-btn {
    color: #394360;
}

[data-theme="light"] .baruh-action-btn:hover {
    color: #12151F;
}

/* Error Message */
.baruh-message-error .baruh-message-content {
    border-left-color: #F17777;
}

.baruh-message-error .baruh-message-text {
    font-weight: 500;
    color: #F17777;
}

[data-theme="light"] .baruh-message-error .baruh-message-text {
    color: #970707;
}

/* Loading Animation */
.baruh-loading {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
}

.baruh-loading-dot {
    width: 6px;
    height: 6px;
    background: #A2A8B9;
    border-radius: 50%;
    animation: baruhLoadingBounce 1.4s infinite ease-in-out both;
}

.baruh-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.baruh-loading-dot:nth-child(2) { animation-delay: -0.16s; }
.baruh-loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes baruhLoadingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .baruh-modal {
        width: calc(100% - 32px);
        height: calc(100% - 32px);
        max-width: 720px;
        max-height: 520px;
    }

    .baruh-container,
    .baruh-input-container {
        padding-left: 24px;
        padding-right: 24px;
    }

    .baruh-suggestions {
        flex-direction: column;
    }

    .baruh-suggestion-item {
        height: auto;
        min-height: 80px;
    }
}
