/* ===== Chef-IA Widget ===== */

.chef-ia-body-lock {
    overflow: hidden;
}

.chef-ia-fab {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border: none;
    border-radius: 999px;
    background: var(--af-color-primary, #E63946);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(230, 57, 70, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.chef-ia-fab:hover {
    background: #c1121f;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(230, 57, 70, 0.4);
}

.chef-ia-fab i {
    font-size: 1.1rem;
}

.chef-ia-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1045;
    background: rgba(29, 53, 87, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chef-ia-panel {
    position: fixed;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #1D3557;
    box-shadow: -8px 0 32px rgba(29, 53, 87, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}

/* Mobile: tela cheia */
.chef-ia-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* Desktop: sidebar direita */
@media (min-width: 769px) {
    .chef-ia-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(420px, 100vw);
        height: 100%;
        border-radius: 0;
    }
}

.chef-ia-widget--open .chef-ia-backdrop {
    opacity: 1;
    visibility: visible;
}

.chef-ia-widget--open .chef-ia-panel {
    transform: translateX(0);
}

.chef-ia-widget--open .chef-ia-fab {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.chef-ia-header {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--af-color-primary, #E63946) 0%, var(--af-color-quaternary, #457B9D) 100%);
    color: #fff;
}

.chef-ia-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.chef-ia-header p {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    opacity: 0.95;
    color: #fff;
}

.chef-ia-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chef-ia-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.chef-ia-limit {
    flex-shrink: 0;
    padding: 0.65rem 1.25rem;
    font-size: 0.82rem;
    color: var(--af-color-quaternary, #457B9D);
    background: rgba(168, 218, 220, 0.25);
    border-bottom: 1px solid var(--af-color-tertiary, #A8DADC);
}

.chef-ia-limit strong {
    color: var(--af-color-quinternary, #1D3557);
}

.chef-ia-limit--exhausted {
    background: #fee2e2;
    color: #991b1b;
    border-bottom-color: #fecaca;
}

.chef-ia-limit--exhausted strong {
    color: #991b1b;
}

.chef-ia-limit--dev {
    background: #dbeafe;
    color: #1e40af;
    border-bottom-color: #93c5fd;
}

.chef-ia-limit--dev strong {
    color: #1e40af;
}

.chef-ia-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--af-color-secundary, #F1FAEE);
}

.chef-ia-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chef-ia-message--user {
    align-self: flex-end;
    background: var(--af-color-quaternary, #457B9D);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chef-ia-message--assistant {
    align-self: flex-start;
    background: #fff;
    color: var(--af-color-quinternary, #1D3557);
    border: 1px solid var(--af-color-tertiary, #A8DADC);
    border-bottom-left-radius: 4px;
}

.chef-ia-message--assistant a {
    color: var(--af-color-primary, #E63946);
    font-weight: 600;
    word-break: break-all;
    text-decoration: underline;
}

.chef-ia-message--error {
    align-self: center;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    max-width: 100%;
    text-align: center;
    white-space: normal;
}

.chef-ia-message--typing {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--af-color-tertiary, #A8DADC);
    padding: 0.75rem 1.25rem;
    white-space: normal;
    min-width: 0;
}

.chef-ia-typing-text {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--af-color-quaternary, #457B9D);
    white-space: normal;
    word-wrap: break-word;
}

.chef-ia-typing-dots {
    display: flex;
    gap: 4px;
}

.chef-ia-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--af-color-quaternary, #457B9D);
    border-radius: 50%;
    animation: chef-ia-typing 1.4s infinite ease-in-out both;
}

.chef-ia-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chef-ia-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes chef-ia-typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.chef-ia-welcome {
    text-align: center;
    color: var(--af-color-quaternary, #457B9D);
    padding: 2rem 1rem;
    font-size: 0.95rem;
}

.chef-ia-welcome i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    color: var(--af-color-primary, #E63946);
}

.chef-ia-input-area {
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    background: #fff;
    border-top: 1px solid var(--af-color-tertiary, #A8DADC);
}

.chef-ia-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chef-ia-form textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    border-radius: 12px;
    border: 1px solid var(--af-color-tertiary, #A8DADC);
    padding: 0.65rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: #1D3557;
    background: #fff;
}

.chef-ia-form textarea:focus {
    border-color: var(--af-color-quaternary, #457B9D);
    box-shadow: 0 0 0 3px rgba(69, 123, 157, 0.2);
    outline: none;
}

.chef-ia-send {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: var(--af-color-primary, #E63946);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chef-ia-send:hover:not(:disabled) {
    background: #c1121f;
}

.chef-ia-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .chef-ia-fab {
        bottom: 1rem;
        right: 1rem;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}
