/* ============================================================
 * WebIgris Design System
 * - Cards SEM marcador colorido (nem border-left, nem stripe-top)
 * - Diferenciação por background tint sutil + cor no texto/número
 * - Modais e toasts consistentes
 * ============================================================ */

/* ===== CEP autofill — loading state ===== */
.wi-cep-loading {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' width='18' height='18'><circle cx='25' cy='25' r='20' stroke='%23C8102E' stroke-width='5' fill='none' stroke-dasharray='90 100' stroke-linecap='round'><animateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='.8s' repeatCount='indefinite'/></circle></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px !important;
}

/* ===== TOAST GLOBAL ===== */
.wi-toast {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(-90px);
    background: #1A1B23;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    opacity: 0;
    transition: all .25s ease;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 90vw;
}
.wi-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.wi-toast-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16A34A;
    flex-shrink: 0;
}
.wi-toast.is-ok .wi-toast-dot   { background: #16A34A; }
.wi-toast.is-info .wi-toast-dot { background: #2563EB; }
.wi-toast.is-warn .wi-toast-dot { background: #D97706; }
.wi-toast.is-err .wi-toast-dot  { background: #C8102E; }

/* ===== MODAL ===== */
.wi-modal-bd {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
    z-index: 100001;
    animation: wiFadeIn .15s ease;
}
.wi-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
    width: 520px;
    max-width: 94vw;
    max-height: 90vh;
    z-index: 100002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Space Grotesk', sans-serif;
    animation: wiScaleIn .18s ease;
}
.wi-modal.is-sm { width: 380px; }
.wi-modal.is-lg { width: 720px; }
.wi-modal.is-xl { width: 920px; }
.wi-modal.is-full { width: 1100px; }
@keyframes wiFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes wiScaleIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

body.wi-modal-open { overflow: hidden; }

.wi-modal-head {
    padding: 22px 26px 18px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    border-bottom: 1px solid #F3F4F6;
}
.wi-modal-ic {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: #EFF6FF;
    color: #2563EB;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wi-modal-ic svg { width: 20px; height: 20px; }
.wi-modal.is-danger .wi-modal-ic { background: #FEE2E2; color: #C8102E; }
.wi-modal-title { flex: 1; min-width: 0; }
.wi-modal-title h3 { margin: 0 0 4px; font-size: 1.12rem; font-weight: 800; color: #1A1B23; letter-spacing: -0.01em; }
.wi-modal-title p { margin: 0; font-size: .88rem; color: #6B7280; line-height: 1.5; }

.wi-modal-body {
    padding: 20px 26px;
    overflow-y: auto;
}
.wi-modal-foot {
    padding: 16px 26px;
    background: #F9FAFB;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.wi-modal .wi-btn { padding: 10px 18px; font-size: .88rem; }

/* Campos dentro do modal */
.wi-field { margin-bottom: 6px; }
.wi-field label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 6px; color: #1A1B23; }
.wi-field input, .wi-field textarea, .wi-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-family: inherit;
    font-size: .9rem;
    background: #fff;
    transition: border-color .15s;
}
.wi-field textarea { resize: vertical; min-height: 80px; }
.wi-field input:focus, .wi-field textarea:focus, .wi-field select:focus {
    outline: none;
    border-color: #C8102E;
}
.wi-field small { display: block; font-size: .74rem; color: #6B7280; margin-top: 5px; }

/* Botões do modal */
.wi-btn {
    padding: 9px 16px;
    border-radius: 6px;
    border: none;
    font-family: inherit;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.wi-btn:active { transform: translateY(1px); }
.wi-btn:focus-visible { outline: 2px solid #2563EB; outline-offset: 2px; }
.wi-btn-primary { background: #C8102E; color: #fff; }
.wi-btn-primary:hover { background: #9B0E25; }
.wi-btn-danger { background: #C8102E; color: #fff; }
.wi-btn-danger:hover { background: #9B0E25; }
.wi-btn-pos { background: #16A34A; color: #fff; }
.wi-btn-pos:hover { background: #047857; }
.wi-btn-ghost { background: transparent; color: #6B7280; border: 1px solid #E5E7EB; }
.wi-btn-ghost:hover { background: #F3F4F6; color: #1A1B23; }

/* ============================================================
 * CARDS — sem marcador colorido, só background tint
 * ============================================================ */
.wi-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    margin-bottom: 10px;
    transition: box-shadow .15s;
}
.wi-card:hover { box-shadow: 0 3px 10px rgba(0, 0, 0, .08); }

/* Variantes só por background tint sutil */
.wi-card.is-alert,
.wi-card.is-alert-tint { background: #FFF1F2; }
.wi-card.is-brand      { background: #FFF1F2; }
.wi-card.is-info,
.wi-card.is-info-tint  { background: #EFF6FF; }
.wi-card.is-warn,
.wi-card.is-warn-tint  { background: #FFFBEB; }
.wi-card.is-win,
.wi-card.is-win-tint   { background: #ECFDF5; }
.wi-card.is-muted { opacity: .6; }

/* Cartão "destaque" (pode ter shadow mais forte e top stripe) */
.wi-card.is-highlight {
    box-shadow: 0 4px 16px rgba(200, 16, 46, .12);
}

/* ============================================================
 * BADGES / TAGS (também sem border-left)
 * ============================================================ */
.wi-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: .64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #F3F4F6;
    color: #6B7280;
}
.wi-tag.is-alert { background: #FEE2E2; color: #991B1B; }
.wi-tag.is-info  { background: #DBEAFE; color: #1E40AF; }
.wi-tag.is-warn  { background: #FEF3C7; color: #92400E; }
.wi-tag.is-win   { background: #D1FAE5; color: #065F46; }
.wi-tag.is-brand { background: #FEE2E2; color: #C8102E; }

/* ============================================================
 * BANNER / CALLOUT (sem border-left — usa background tint + ícone)
 * ============================================================ */
.wi-banner {
    background: #FFFBEB;
    border: 1px solid #FEF3C7;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: .88rem;
}
.wi-banner-ic { color: #92400E; flex-shrink: 0; margin-top: 1px; }
.wi-banner.is-info  { background: #EFF6FF; border-color: #BFDBFE; color: #1E3A8A; }
.wi-banner.is-info .wi-banner-ic { color: #2563EB; }
.wi-banner.is-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.wi-banner.is-success .wi-banner-ic { color: #16A34A; }
.wi-banner.is-danger { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.wi-banner.is-danger .wi-banner-ic { color: #C8102E; }

/* ============================================================
 * KPI — sem marcador colorido (classe mantida como no-op para
 * compatibilidade com chamadas existentes; cor fica no número)
 * ============================================================ */
.kpi-stripe { /* sem efeito visual: marcadores coloridos foram removidos */ }

/* ============================================================
 * RESPONSIVE
 * ============================================================ */
@media (max-width: 580px) {
    .wi-modal { width: 96vw; }
    .wi-modal-head, .wi-modal-body, .wi-modal-foot { padding-left: 16px; padding-right: 16px; }
}

/* ===== Password eye toggle =====
 * Aplicado automaticamente em todo input[type=password] via wi-ui.js
 * Use data-no-eye no input (ou no ancestral) para desativar.
 * ============================================================ */
.wi-pwd-wrap {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    width: 100%;
}
.wi-pwd-wrap .wi-pwd-input {
    width: 100%;
    padding-right: 40px !important;
}
.wi-pwd-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #6B7280;
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
    transition: color .15s, background .15s;
}
.wi-pwd-eye:hover { color: #C8102E; background: rgba(200,16,46,.06); }
.wi-pwd-eye:focus-visible { outline: 2px solid #C8102E; outline-offset: 1px; }
.wi-pwd-eye svg { width: 16px; height: 16px; }
