/**
 * Chatbot Fluxo - Frontend CSS
 */

/* Variáveis CSS (serão sobrescritas inline) */
:root {
    --cf-primary: #6366f1;
    --cf-secondary: #8b5cf6;
    --cf-bg: #ffffff;
    --cf-text: #1e293b;
}

/* Reset para elementos do chatbot */
.cf-floating-wrapper,
.cf-floating-wrapper *,
.cf-shortcode-wrapper,
.cf-shortcode-wrapper *,
.cf-chat-container,
.cf-chat-container * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== BOTÃO FLUTUANTE ===== */
.cf-floating-wrapper {
    position: fixed;
    bottom: 24px;
    z-index: 999999;
}

.cf-floating-wrapper.cf-position-right {
    right: 24px;
}

.cf-floating-wrapper.cf-position-left {
    left: 24px;
}

.cf-floating-btn {
    width: 60px;
    height: 60px;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--cf-primary), var(--cf-secondary));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
}

.cf-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

.cf-floating-btn svg {
    width: 28px;
    height: 28px;
}

.cf-floating-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== CONTAINER DO CHAT FLUTUANTE ===== */
.cf-floating-chat {
    position: absolute;
    bottom: 80px;
    width: 380px;
    height: 550px;
    min-height: 550px;
    border-radius: 20px !important;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: cf-slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
    background: var(--cf-bg);
}

.cf-position-right .cf-floating-chat {
    right: 0;
}

.cf-position-left .cf-floating-chat {
    left: 0;
}

@keyframes cf-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== SHORTCODE WRAPPER ===== */
.cf-shortcode-wrapper {
    display: inline-block;
}

.cf-shortcode-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--cf-primary), var(--cf-secondary));
    color: white;
    border: none;
    border-radius: 12px !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cf-shortcode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.cf-shortcode-btn svg {
    width: 20px;
    height: 20px;
}

.cf-shortcode-chat {
    margin-top: 16px;
    max-width: 400px;
    border-radius: 20px !important;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* ===== CONTAINER DO CHAT ===== */
.cf-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 550px;
    background: var(--cf-bg);
}

.cf-chat-container[data-mode="inline"] {
    border-radius: 20px !important;
    border: 1px solid #e5e7eb;
}

/* ===== HEADER DO CHAT ===== */
.cf-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--cf-primary), var(--cf-secondary));
    color: white;
    flex-shrink: 0;
}

.cf-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.cf-chat-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cf-chat-avatar svg {
    width: 24px;
    height: 24px;
}

.cf-chat-header-text {
    flex: 1;
    min-width: 0;
}

.cf-chat-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.cf-chat-subtitle {
    margin: 2px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.cf-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
    margin-left: 10px;
    flex-shrink: 0;
}

.cf-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cf-chat-close svg {
    width: 20px;
    height: 20px;
}

/* ===== CORPO DO CHAT ===== */
.cf-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    min-height: 200px;
}

.cf-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== MENSAGENS ===== */
.cf-message {
    max-width: 85%;
    animation: cf-messageIn 0.3s ease;
}

@keyframes cf-messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cf-message-bot {
    align-self: flex-start;
}

.cf-message-user {
    align-self: flex-end;
}

.cf-message-content {
    padding: 12px 16px;
    border-radius: 18px !important;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.cf-message-bot .cf-message-content {
    background: white;
    color: var(--cf-text);
    border-bottom-left-radius: 6px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.cf-message-user .cf-message-content {
    background: linear-gradient(135deg, var(--cf-primary), var(--cf-secondary));
    color: white;
    border-bottom-right-radius: 6px !important;
}

/* ===== TYPING INDICATOR ===== */
.cf-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px !important;
    border-bottom-left-radius: 6px !important;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.cf-typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50% !important;
    animation: cf-typing 1.4s infinite ease-in-out;
}

.cf-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.cf-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes cf-typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* ===== ÁREA DE INPUT ===== */
.cf-chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.cf-chat-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cf-chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 25px !important;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}

.cf-chat-input:focus {
    border-color: var(--cf-primary);
}

.cf-chat-input::placeholder {
    color: #94a3b8;
}

.cf-chat-send {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, var(--cf-primary), var(--cf-secondary));
    border: none;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.cf-chat-send:hover {
    transform: scale(1.05);
}

.cf-chat-send svg {
    width: 20px;
    height: 20px;
}

/* ===== ÁREA DE BOTÕES ===== */
.cf-chat-buttons-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.cf-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cf-option-btn {
    flex: 1;
    min-width: calc(50% - 5px);
    padding: 14px 16px;
    background: white;
    border: 2px solid var(--cf-primary);
    border-radius: 12px !important;
    font-size: 14px;
    font-weight: 600;
    color: var(--cf-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.cf-option-btn:hover {
    background: var(--cf-primary);
    color: white;
}

/* ===== ANIMAÇÃO SHAKE PARA ERROS ===== */
.cf-shake {
    animation: cf-shake 0.5s ease;
}

@keyframes cf-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

/* ===== INPUT COM ERRO ===== */
.cf-chat-input.cf-shake {
    border-color: #ef4444;
}

/* ===== ÁREA DE PAGAMENTO ===== */
.cf-chat-payment-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    max-height: 480px;
    overflow-y: auto;
}

.cf-payment-container {
    text-align: center;
}

.cf-payment-header {
    margin-bottom: 16px;
}

.cf-payment-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: white;
}

.cf-payment-icon svg {
    width: 32px;
    height: 32px;
}

.cf-payment-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--cf-text);
}

.cf-payment-subtitle {
    margin: 4px 0 0;
    font-size: 14px;
    color: #64748b;
}

.cf-payment-value {
    background: #f0fdf4;
    border-radius: 12px !important;
    padding: 16px;
    margin-bottom: 16px;
}

.cf-payment-label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
}

.cf-payment-amount {
    font-size: 28px;
    font-weight: 700;
    color: #16a34a;
}

.cf-payment-qr {
    position: relative;
    margin-bottom: 16px;
}

.cf-qr-image {
    width: 160px;
    height: 160px;
    border-radius: 12px !important;
    border: 2px solid #e5e7eb;
}

.cf-qr-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    background: #f8fafc;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cf-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--cf-primary);
    border-radius: 50% !important;
    animation: cf-spin 0.8s linear infinite;
}

@keyframes cf-spin {
    to {
        transform: rotate(360deg);
    }
}

.cf-payment-code {
    margin-bottom: 16px;
    text-align: left;
}

.cf-payment-code label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.cf-code-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cf-code-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px !important;
    font-size: 11px;
    font-family: monospace;
    background: #f8fafc;
    color: #475569;
    word-break: break-all;
    text-align: left;
}

.cf-code-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--cf-primary);
    color: white;
    border: none;
    border-radius: 10px !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.cf-code-copy:hover {
    opacity: 0.9;
}

.cf-code-copy svg {
    width: 18px;
    height: 18px;
}

.cf-copy-feedback {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
    padding: 10px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 8px !important;
    font-size: 13px;
    font-weight: 600;
}

.cf-copy-feedback.show {
    display: flex;
}

.cf-copy-feedback svg {
    width: 16px;
    height: 16px;
}

.cf-payment-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #64748b;
}

.cf-payment-timer svg {
    width: 16px;
    height: 16px;
}

.cf-timer-countdown {
    color: var(--cf-primary);
}

.cf-payment-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #fef3c7;
    border-radius: 10px !important;
    font-size: 14px;
    color: #92400e;
}

.cf-status-dot {
    width: 10px;
    height: 10px;
    background: #f59e0b;
    border-radius: 50% !important;
    animation: cf-pulse 1.5s infinite;
}

@keyframes cf-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.cf-payment-status.cf-status-success {
    background: #dcfce7;
    color: #166534;
}

.cf-payment-status.cf-status-success .cf-status-dot {
    background: #16a34a;
    animation: none;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 480px) {
    .cf-floating-wrapper {
        bottom: 16px;
    }
    
    .cf-floating-wrapper.cf-position-right {
        right: 16px;
    }
    
    .cf-floating-wrapper.cf-position-left {
        left: 16px;
    }
    
    .cf-floating-chat {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        min-height: 100%;
        border-radius: 0 !important;
    }
    
    .cf-chat-container {
        min-height: 100%;
        height: 100%;
    }
    
    .cf-shortcode-chat {
        max-width: 100%;
    }
    
    .cf-chat-input {
        padding: 12px 14px;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .cf-qr-image {
        width: 140px;
        height: 140px;
    }
    
    .cf-qr-loading {
        width: 140px;
        height: 140px;
    }
}

/* ===== SCROLLBAR CUSTOMIZADA ===== */
.cf-chat-body::-webkit-scrollbar {
    width: 6px;
}

.cf-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.cf-chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px !important;
}

.cf-chat-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
