/* ============================================================
   ASSISTENTE CONFIG — WIZARD DESIGN SYSTEM
   Bootstrap 5 · Hermmes IA
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
    --wiz-primary:       #4f46e5;
    --wiz-primary-light: #ede9fe;
    --wiz-success:       #10b981;
    --wiz-danger:        #ef4444;
    --wiz-done:          #10b981;
    --wiz-radius:        1rem;
    --wiz-radius-sm:     .6rem;
    --wiz-shadow:        0 2px 16px rgba(0,0,0,.07);
    --wiz-shadow-md:     0 4px 24px rgba(0,0,0,.10);
    --wiz-border:        #e5e7eb;
    --wiz-bg-card:       #ffffff;
    --wiz-bg-sidebar:    #f8f7ff;
    --wiz-text:          #111827;
    --wiz-muted:         #6b7280;
    --wiz-step-size:     44px;
    --wiz-line-h:        3px;
    --wiz-transition:    .2s ease;
}

/* ── Loading ─────────────────────────────────────────────── */
.wiz-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

/* ── Topbar ──────────────────────────────────────────────── */
.wiz-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    background: var(--wiz-bg-card);
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius);
    padding: .875rem 1.25rem;
    box-shadow: var(--wiz-shadow);
}

.wiz-topbar-left {
    display: flex;
    align-items: center;
    gap: .875rem;
}

.wiz-topbar-right {
    display: flex;
    align-items: center;
    gap: .625rem;
    flex-wrap: wrap;
}

.wiz-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--wiz-primary-light);
}

.wiz-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--wiz-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wiz-primary);
    font-size: 1.25rem;
}

.wiz-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--wiz-text);
}

.wiz-subtitle {
    font-size: .75rem;
    color: var(--wiz-muted);
}

.wiz-autosave {
    font-size: .75rem;
    color: var(--wiz-muted);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: .25rem;
}

/* ── Stepper Horizontal ──────────────────────────────────── */
.wiz-stepper-wrap {
    background: var(--wiz-bg-card);
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--wiz-shadow);
    overflow-x: auto;
}

.wiz-stepper {
    display: flex;
    align-items: center;
    min-width: 560px;
}

/* Step item */
.wiz-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--wiz-transition);
}

.wiz-step:hover .wiz-step-circle {
    transform: scale(1.08);
}

/* Circle */
.wiz-step-circle {
    width: var(--wiz-step-size);
    height: var(--wiz-step-size);
    border-radius: 50%;
    border: 2.5px solid var(--wiz-border);
    background: #fff;
    color: var(--wiz-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    transition: var(--wiz-transition);
    position: relative;
    z-index: 1;
}

/* Active */
.wiz-step.active .wiz-step-circle {
    border-color: var(--wiz-primary);
    background: var(--wiz-primary);
    color: #fff;
    box-shadow: 0 0 0 5px var(--wiz-primary-light);
    transform: scale(1.12);
}

.wiz-step.active .wiz-step-label {
    color: var(--wiz-primary);
    font-weight: 700;
}

/* Done */
.wiz-step.done .wiz-step-circle {
    border-color: var(--wiz-done);
    background: var(--wiz-done);
    color: #fff;
}

.wiz-step.done .wiz-step-label {
    color: var(--wiz-done);
}

/* Error */
.wiz-step.has-error .wiz-step-circle {
    border-color: var(--wiz-danger);
    background: var(--wiz-danger);
    color: #fff;
    animation: wiz-shake .3s ease;
}

.wiz-step.has-error .wiz-step-label {
    color: var(--wiz-danger);
}

@keyframes wiz-shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-3px); }
    75%       { transform: translateX(3px); }
}

/* Label */
.wiz-step-label {
    font-size: .7rem;
    color: var(--wiz-muted);
    text-align: center;
    white-space: nowrap;
    transition: var(--wiz-transition);
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Connector line */
.wiz-step-line {
    flex: 1;
    height: var(--wiz-line-h);
    background: var(--wiz-border);
    border-radius: 99px;
    margin-bottom: 1.1rem;
    transition: background var(--wiz-transition);
}

.wiz-step-line.done {
    background: var(--wiz-done);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.wiz-sidebar {
    background: var(--wiz-bg-sidebar);
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius);
    padding: 1rem;
    box-shadow: var(--wiz-shadow);
    position: sticky;
    top: 1rem;
}

.wiz-sidebar-header {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--wiz-muted);
    padding: 0 .25rem .75rem;
    border-bottom: 1px solid var(--wiz-border);
    margin-bottom: .5rem;
}

.wiz-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wiz-nav-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .5rem .625rem;
    border-radius: var(--wiz-radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: var(--wiz-transition);
    text-align: left;
    width: 100%;
}

.wiz-nav-item:hover {
    background: rgba(79, 70, 229, .06);
}

.wiz-nav-item.active {
    background: var(--wiz-primary-light);
}

.wiz-nav-item.active .wiz-nav-label {
    color: var(--wiz-primary);
    font-weight: 700;
}

.wiz-nav-item.active .wiz-nav-num {
    background: var(--wiz-primary);
    color: #fff;
    border-color: var(--wiz-primary);
}

.wiz-nav-item.done .wiz-nav-num {
    background: var(--wiz-done);
    color: #fff;
    border-color: var(--wiz-done);
}

.wiz-nav-item.has-error .wiz-nav-num {
    background: var(--wiz-danger);
    color: #fff;
    border-color: var(--wiz-danger);
}

.wiz-nav-item.has-error .wiz-nav-label {
    color: var(--wiz-danger);
}

.wiz-nav-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--wiz-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    color: var(--wiz-muted);
    flex-shrink: 0;
    transition: var(--wiz-transition);
}

.wiz-nav-label {
    font-size: .8rem;
    color: var(--wiz-text);
    flex: 1;
    transition: var(--wiz-transition);
}

.wiz-nav-badge-error {
    font-size: .65rem;
    font-weight: 700;
    background: var(--wiz-danger);
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wiz-done-icon {
    font-size: .75rem;
}

.wiz-sidebar-progress {
    padding-top: .75rem;
    border-top: 1px solid var(--wiz-border);
}

/* ── Content Card ────────────────────────────────────────── */
.wiz-card {
    background: var(--wiz-bg-card);
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius);
    box-shadow: var(--wiz-shadow);
    overflow: hidden;
    animation: wiz-fade-in .2s ease;
}

@keyframes wiz-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wiz-card-header {
    display: flex;
    align-items: flex-start;
    gap: .875rem;
    padding: 1rem 1.25rem .75rem;
    border-bottom: 1px solid rgba(0,0,0,.04);
    background: transparent;
}

.wiz-card-icon {
    width: 48px;
    height: 48px;
    border-radius: .75rem;
    background: color-mix(in srgb, var(--icon-color) 12%, transparent);
    color: var(--icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.wiz-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--wiz-text);
    margin-bottom: .15rem;
}

.wiz-card-desc {
    font-size: .78rem;
    color: var(--wiz-muted);
    margin: 0;
}

/* ── Lifecycle block ─────────────────────────────────────── */
.wiz-lifecycle {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--wiz-border);
}

.wiz-lifecycle-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    margin-bottom: .75rem;
    font-size: .9rem;
}

.wiz-lifecycle-body {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .5rem;
}

.wiz-lifecycle-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    font-size: .75rem;
    color: var(--wiz-muted);
}

/* ── Info / Hint boxes ───────────────────────────────────── */
.wiz-info-box {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--wiz-radius-sm);
    padding: .625rem .875rem;
    font-size: .8rem;
    color: #1e40af;
}

.wiz-info-box i {
    flex-shrink: 0;
    margin-top: .1rem;
}

.wiz-prompt-hint {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--wiz-radius-sm);
    padding: .5rem .75rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

/* ── Char counter / tag count ────────────────────────────── */
.wiz-char-counter,
.wiz-tag-count {
    font-size: .72rem;
    color: var(--wiz-muted);
}

/* ── Toggle card ─────────────────────────────────────────── */
.wiz-toggle-card {
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius-sm);
    overflow: hidden;
}

.wiz-toggle-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .875rem 1rem;
    background: #f9fafb;
}

/* ── Section divider ─────────────────────────────────────── */
.wiz-section-divider {
    border-top: 1px solid var(--wiz-border);
    padding-top: 1.25rem;
    margin-top: 1.25rem;
}

/* ── Pasta card ──────────────────────────────────────────── */
.wiz-pasta-card {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem .875rem;
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius-sm);
    background: #fff;
    font-size: .82rem;
}

/* ── Empty state ─────────────────────────────────────────── */
.wiz-empty-state {
    text-align: center;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: var(--wiz-radius-sm);
    border: 1px dashed var(--wiz-border);
}

/* ── Widget Preview ──────────────────────────────────────── */
.wiz-widget-preview {
    background: #f1f5f9;
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius);
    padding: 1rem;
    position: sticky;
    top: 1rem;
}

.wiz-preview-label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--wiz-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .75rem;
}

.wiz-chat-mock {
    border-radius: .875rem;
    overflow: hidden;
    box-shadow: var(--wiz-shadow-md);
    background: #fff;
}

.wiz-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    transition: background var(--wiz-transition);
}

.wiz-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .9rem;
}

.wiz-chat-body {
    padding: .875rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 90px;
    background: #f8fafc;
}

.wiz-bubble {
    max-width: 80%;
    padding: .45rem .75rem;
    border-radius: 1rem;
    font-size: .78rem;
    line-height: 1.4;
}

.wiz-bubble.bot {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: .25rem;
    align-self: flex-start;
    color: #374151;
}

.wiz-bubble.user {
    background: var(--wiz-primary);
    color: #fff;
    border-bottom-right-radius: .25rem;
    align-self: flex-end;
}

.wiz-chat-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .625rem .875rem;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

.wiz-chat-send {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .75rem;
    transition: background var(--wiz-transition);
}

.wiz-chat-fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    transition: background var(--wiz-transition);
}

/* ── Resumo grid ─────────────────────────────────────────── */
.wiz-resumo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .875rem;
    padding: 1.25rem 1.5rem;
}

.wiz-resumo-card {
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius-sm);
    padding: .875rem 1rem;
    cursor: pointer;
    transition: var(--wiz-transition);
    background: #fff;
}

.wiz-resumo-card:hover {
    border-color: var(--wiz-primary);
    box-shadow: 0 0 0 3px var(--wiz-primary-light);
    transform: translateY(-1px);
}

.wiz-resumo-card-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .625rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--wiz-border);
}

.wiz-resumo-icon {
    width: 28px;
    height: 28px;
    border-radius: .4rem;
    background: color-mix(in srgb, var(--icon-color) 12%, transparent);
    color: var(--icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
}

.wiz-resumo-body {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    font-size: .77rem;
    color: var(--wiz-text);
}

.wiz-resumo-body .label {
    color: var(--wiz-muted);
    font-weight: 500;
}

.wiz-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.1);
    vertical-align: middle;
    margin-right: 2px;
}

/* ── Final CTA ───────────────────────────────────────────── */
.wiz-final-cta {
    text-align: center;
    padding: 1.25rem 1.5rem 1.5rem;
    border-top: 1px solid var(--wiz-border);
    background: linear-gradient(135deg, #f8f7ff 0%, #f0fdf4 100%);
}

/* ── Nav footer ──────────────────────────────────────────── */
.wiz-nav-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .875rem 1.5rem;
    border-top: 1px solid var(--wiz-border);
    background: #f9fafb;
}

.wiz-step-counter {
    font-size: .78rem;
    color: var(--wiz-muted);
    font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .wiz-stepper-wrap {
        padding: 1rem;
    }
    .wiz-card-header {
        padding: 1rem;
    }
    .wiz-nav-footer {
        padding: .75rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .wiz-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .wiz-topbar-right {
        width: 100%;
    }
    .wiz-step-label {
        display: none;
    }
    .wiz-step-circle {
        width: 36px;
        height: 36px;
        font-size: .78rem;
    }
    .wiz-resumo-grid {
        grid-template-columns: 1fr;
    }
}

/* ── TagsInput Component ──────────────────────────────────────────────── */

.tags-input-container {
    width: 100%;
}

.tags-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius-sm);
    background: var(--wiz-bg-card);
    min-height: 2.5rem;
    align-items: center;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: text;
}

.tags-input-wrapper:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, .15);
}

.tags-input-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    background: var(--wiz-primary);
    color: #fff;
    border-radius: 1rem;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tags-input-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.tags-input-remove:hover {
    color: #fff;
}

.tags-input-field {
    border: none;
    outline: none;
    background: transparent;
    flex: 1 1 120px;
    min-width: 80px;
    font-size: 0.875rem;
    padding: 0.15rem 0;
}

.tags-input-field::placeholder {
    color: var(--wiz-muted);
    opacity: 0.65;
}

/* ── Avatar Upload ──────────────────────────────────────────────────── */

.wiz-avatar-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.wiz-avatar-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    color: #fff;
    font-size: 1.2rem;
}

.wiz-avatar-upload:hover .wiz-avatar-upload-overlay {
    opacity: 1;
}

.wiz-avatar-upload-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
}

/* ── Fix overflow em editors/textareas dentro dos steps ── */
.wiz-card textarea,
.wiz-card .form-control {
    max-width: 100%;
    overflow-wrap: break-word;
}

.col-lg-9 {
    overflow-x: hidden;
}

/* ── Utilitários legados (compatibilidade) ─────────────── */
.fs-14 { font-size: .875rem; }
.form-hint {
    font-size: .8rem;
    color: var(--wiz-muted);
}
