/* Vendas Chat IA — Frontend Styles */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --vcia-primary: #16a34a;
    --vcia-primary-dark: #15803d;
    --vcia-primary-light: #dcfce7;
    --vcia-bg: #f0fdf4;
    --vcia-surface: #ffffff;
    --vcia-border: #e2e8f0;
    --vcia-text: #1e293b;
    --vcia-muted: #64748b;
    --vcia-radius: 16px;
    --vcia-shadow: 0 4px 24px rgba(0,0,0,.10);
}

/* ── Chat Container ── */
.vcia-chat-wrapper {
    max-width: 800px; margin: 0 auto; padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--vcia-text);
}

/* ── Promo Banner ── */
.vcia-promo-banner {
    border-radius: 12px; padding: 10px 20px; text-align: center;
    font-weight: 600; font-size: 14px; margin-bottom: 16px;
    animation: vcia-pulse 2s infinite;
}
@keyframes vcia-pulse { 0%,100%{opacity:1} 50%{opacity:.85} }

/* ── Chat Header ── */
.vcia-chat-header {
    background: var(--vcia-primary); color: #fff;
    border-radius: var(--vcia-radius) var(--vcia-radius) 0 0;
    padding: 16px 20px; display: flex; align-items: center; gap: 12px;
}
.vcia-chat-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.vcia-chat-header-info h2 { margin: 0; font-size: 18px; font-weight: 700; }
.vcia-chat-header-info p  { margin: 0; font-size: 13px; opacity: .85; }
.vcia-store-status { margin-left: auto; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; }
.vcia-store-status.open   { background: rgba(255,255,255,.2); }
.vcia-store-status.closed { background: rgba(220,38,38,.4); }

/* ── Messages Area ── */
.vcia-messages {
    background: #f8fffe; border-left: 1px solid var(--vcia-border); border-right: 1px solid var(--vcia-border);
    height: 440px; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px;
    scroll-behavior: smooth;
}

/* ── Message Bubbles ── */
.vcia-msg { display: flex; gap: 8px; max-width: 85%; animation: vcia-fade-in .2s ease; }
@keyframes vcia-fade-in { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
.vcia-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.vcia-msg.assistant { align-self: flex-start; }
.vcia-msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--vcia-primary); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.vcia-msg-bubble { padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.5; }
.vcia-msg.user .vcia-msg-bubble { background: var(--vcia-primary); color: #fff; border-bottom-right-radius: 4px; }
.vcia-msg.assistant .vcia-msg-bubble { background: #fff; border: 1px solid var(--vcia-border); border-bottom-left-radius: 4px; }
.vcia-msg-time { font-size: 11px; color: var(--vcia-muted); margin-top: 3px; }

/* ── Typing indicator ── */
.vcia-typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.vcia-typing-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--vcia-muted); animation: vcia-dot .9s infinite; }
.vcia-typing-dots span:nth-child(2) { animation-delay: .2s; }
.vcia-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes vcia-dot { 0%,100%{opacity:.3;transform:scale(1)} 50%{opacity:1;transform:scale(1.2)} }

/* ── Chat Input ── */
.vcia-chat-input-area {
    background: var(--vcia-surface); border: 1px solid var(--vcia-border);
    border-radius: 0 0 var(--vcia-radius) var(--vcia-radius); padding: 16px;
}
.vcia-input-row { display: flex; gap: 8px; }
.vcia-chat-input {
    flex: 1; border: 1px solid var(--vcia-border); border-radius: 24px;
    padding: 10px 18px; font-size: 15px; outline: none;
    transition: border-color .15s;
}
.vcia-chat-input:focus { border-color: var(--vcia-primary); }
.vcia-send-btn {
    background: var(--vcia-primary); color: #fff; border: none; border-radius: 50%;
    width: 44px; height: 44px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center;
    transition: background .15s; flex-shrink: 0;
}
.vcia-send-btn:hover { background: var(--vcia-primary-dark); }

/* ── Action chips ── */
.vcia-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.vcia-chip {
    padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--vcia-primary);
    color: var(--vcia-primary); background: #fff; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all .15s;
}
.vcia-chip:hover { background: var(--vcia-primary); color: #fff; }

/* ── Cart Panel ── */
.vcia-cart-panel {
    background: var(--vcia-surface); border: 1px solid var(--vcia-border); border-radius: var(--vcia-radius);
    margin-top: 16px; overflow: hidden; display: none;
}
.vcia-cart-panel.has-items { display: block; }
.vcia-cart-header { background: var(--vcia-primary-light); padding: 12px 16px; font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.vcia-cart-body { padding: 0; }
.vcia-cart-item { display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--vcia-border); gap: 12px; }
.vcia-cart-item:last-child { border-bottom: none; }
.vcia-cart-item-name { flex: 1; font-size: 14px; font-weight: 600; }
.vcia-cart-qty { display: flex; align-items: center; gap: 6px; }
.vcia-qty-btn { width: 28px; height: 28px; border: 1px solid var(--vcia-border); border-radius: 6px; background: #fff; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.vcia-cart-price { font-size: 14px; font-weight: 700; color: var(--vcia-primary); min-width: 70px; text-align: right; }
.vcia-cart-footer { padding: 12px 16px; background: #f8fafc; }
.vcia-cart-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; margin-bottom: 12px; }

/* ── Order Form Modal ── */
.vcia-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 9999;
    align-items: center; justify-content: center; padding: 16px;
}
.vcia-overlay.open { display: flex; }
.vcia-modal-box {
    background: #fff; border-radius: 20px; width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--vcia-shadow);
}
.vcia-modal-head { background: var(--vcia-primary); color: #fff; padding: 16px 20px; border-radius: 20px 20px 0 0; display: flex; justify-content: space-between; align-items: center; }
.vcia-modal-head h3 { margin: 0; font-size: 18px; }
.vcia-close-btn { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; line-height: 1; padding: 0; }
.vcia-modal-body { padding: 20px; }
.vcia-form-field { margin-bottom: 14px; }
.vcia-form-field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--vcia-text); }
.vcia-form-field input,
.vcia-form-field select,
.vcia-form-field textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--vcia-border); border-radius: 10px;
    font-size: 14px; color: var(--vcia-text); outline: none; transition: border-color .15s;
}
.vcia-form-field input:focus,
.vcia-form-field select:focus { border-color: var(--vcia-primary); }
.vcia-field-hint { font-size: 12px; color: var(--vcia-muted); margin-top: 3px; }

/* ── Pix box ── */
.vcia-pix-box {
    background: var(--vcia-primary-light); border: 2px solid var(--vcia-primary);
    border-radius: 12px; padding: 16px; text-align: center; margin: 12px 0;
}
.vcia-pix-box .pix-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--vcia-primary); }
.vcia-pix-box .pix-key  { font-size: 20px; font-weight: 800; color: var(--vcia-text); margin: 4px 0; }
.vcia-pix-box .pix-name { font-size: 13px; color: var(--vcia-muted); }
.vcia-copy-btn { background: var(--vcia-primary); color: #fff; border: none; border-radius: 8px; padding: 8px 18px; cursor: pointer; font-size: 13px; font-weight: 600; margin-top: 10px; }

/* ── Coupon input ── */
.vcia-coupon-row { display: flex; gap: 8px; }
.vcia-coupon-row input { flex: 1; }
.vcia-coupon-apply { background: var(--vcia-primary); color: #fff; border: none; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; }
.vcia-coupon-success { color: var(--vcia-primary); font-weight: 600; font-size: 13px; margin-top: 4px; }
.vcia-coupon-error   { color: #dc2626; font-size: 13px; margin-top: 4px; }

/* ── Submit btn ── */
.vcia-submit-btn {
    width: 100%; background: var(--vcia-primary); color: #fff; border: none; border-radius: 12px;
    padding: 14px; font-size: 16px; font-weight: 700; cursor: pointer; transition: background .15s;
    margin-top: 8px;
}
.vcia-submit-btn:hover { background: var(--vcia-primary-dark); }
.vcia-submit-btn:disabled { background: #94a3b8; cursor: not-allowed; }

/* ── Order Success ── */
.vcia-order-success { text-align: center; padding: 24px 20px; }
.vcia-order-success .success-icon { font-size: 56px; margin-bottom: 12px; }
.vcia-order-success h3 { font-size: 22px; font-weight: 800; color: var(--vcia-text); margin: 0 0 8px; }
.vcia-order-success p  { color: var(--vcia-muted); font-size: 14px; margin: 0 0 16px; }
.vcia-wa-btn { display: inline-flex; align-items: center; gap: 8px; background: #25d366; color: #fff; padding: 12px 24px; border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 15px; }

/* ── Public Store ── */
.vcia-store-wrapper { max-width: 1100px; margin: 0 auto; padding: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.vcia-store-hero { border-radius: 16px; padding: 32px; color: #fff; margin-bottom: 24px; text-align: center; }
.vcia-store-hero h1 { margin: 0 0 8px; font-size: 32px; font-weight: 800; }
.vcia-store-hero p  { margin: 0; font-size: 16px; opacity: .9; }
.vcia-categories { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.vcia-cat-btn { padding: 8px 18px; border-radius: 20px; border: 2px solid var(--vcia-primary); background: #fff; color: var(--vcia-primary); font-weight: 600; cursor: pointer; font-size: 13px; transition: all .15s; }
.vcia-cat-btn.active { background: var(--vcia-primary); color: #fff; }
.vcia-products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.vcia-product-card { background: #fff; border: 1px solid var(--vcia-border); border-radius: 14px; overflow: hidden; transition: box-shadow .2s; }
.vcia-product-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.10); }
.vcia-product-img { width: 100%; height: 180px; object-fit: cover; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 48px; }
.vcia-product-img img { width: 100%; height: 100%; object-fit: cover; }
.vcia-product-info { padding: 14px; }
.vcia-product-name { font-weight: 700; font-size: 15px; margin: 0 0 4px; }
.vcia-product-desc { font-size: 13px; color: var(--vcia-muted); margin: 0 0 10px; }
.vcia-product-price { font-size: 18px; font-weight: 800; color: var(--vcia-primary); }
.vcia-product-stock { font-size: 12px; color: var(--vcia-muted); }
.vcia-add-to-cart-btn { width: 100%; margin-top: 10px; padding: 10px; background: var(--vcia-primary); color: #fff; border: none; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 14px; transition: background .15s; }
.vcia-add-to-cart-btn:hover { background: var(--vcia-primary-dark); }

/* ── Customer Account ── */
.vcia-account-wrapper { max-width: 700px; margin: 0 auto; padding: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.vcia-account-header { background: var(--vcia-primary); color: #fff; border-radius: 16px; padding: 24px; margin-bottom: 20px; }
.vcia-account-header h2 { margin: 0 0 4px; font-size: 22px; }
.vcia-account-header p  { margin: 0; opacity: .85; font-size: 14px; }
.vcia-login-card { background: #fff; border: 1px solid var(--vcia-border); border-radius: 16px; padding: 28px; max-width: 420px; margin: 0 auto; box-shadow: var(--vcia-shadow); }
.vcia-login-card h3 { margin: 0 0 20px; text-align: center; font-size: 20px; }
.vcia-auth-toggle { text-align: center; margin-top: 12px; font-size: 13px; }
.vcia-auth-toggle a { color: var(--vcia-primary); cursor: pointer; font-weight: 600; text-decoration: none; }
.vcia-order-item { background: #fff; border: 1px solid var(--vcia-border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.vcia-order-item-info h4 { margin: 0 0 3px; font-size: 15px; }
.vcia-order-item-info p  { margin: 0; font-size: 13px; color: var(--vcia-muted); }
.vcia-status-badge { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.vcia-status-badge.pending    { background: #fef3c7; color: #92400e; }
.vcia-status-badge.confirmed  { background: #dbeafe; color: #1e40af; }
.vcia-status-badge.preparing  { background: #ede9fe; color: #5b21b6; }
.vcia-status-badge.delivering { background: #fce7f3; color: #9d174d; }
.vcia-status-badge.delivered  { background: var(--vcia-primary-light); color: #14532d; }
.vcia-status-badge.cancelled  { background: #fee2e2; color: #7f1d1d; }

/* ── Loyalty ── */
.vcia-loyalty-card { background: linear-gradient(135deg, var(--vcia-primary), #0d9488); color: #fff; border-radius: 20px; padding: 28px; text-align: center; margin-bottom: 20px; }
.vcia-loyalty-points { font-size: 56px; font-weight: 900; line-height: 1; }
.vcia-loyalty-label  { font-size: 15px; opacity: .9; margin-top: 4px; }
.vcia-loyalty-meta   { display: flex; justify-content: center; gap: 24px; margin-top: 16px; }
.vcia-loyalty-meta div { text-align: center; }
.vcia-loyalty-meta .num { font-size: 22px; font-weight: 800; }
.vcia-loyalty-meta .lbl { font-size: 12px; opacity: .8; }
.vcia-transaction { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--vcia-border); font-size: 14px; }
.vcia-transaction:last-child { border-bottom: none; }
.vcia-transaction .pts { font-weight: 700; }
.vcia-transaction .pts.earn   { color: var(--vcia-primary); }
.vcia-transaction .pts.redeem { color: #dc2626; }

/* ── Alert / Notification ── */
.vcia-alert-msg { padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.vcia-alert-msg.success { background: var(--vcia-primary-light); color: #14532d; border: 1px solid #86efac; }
.vcia-alert-msg.error   { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.vcia-alert-msg.info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .vcia-messages { height: 320px; }
    .vcia-products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .vcia-store-hero h1 { font-size: 22px; }
}
