/* ============================================================
   Field Caption Wizard - styles
   Componente Razor: Blazor.Server/Components/FieldCaptionWizardComponent.razor
   Caricato globalmente da _Host.cshtml
   ============================================================ */

.fcw-root {
    --fcw-primary: #0078d4;
    --fcw-primary-dark: #005a9e;
    --fcw-success: #28a745;
    --fcw-text: #1f2328;
    --fcw-muted: #57606a;
    --fcw-border: #d0d7de;
    --fcw-bg-soft: #f6f8fa;
    --fcw-danger-bg: #fff5f5;
    --fcw-danger-border: #f5c2c7;
    --fcw-danger-text: #842029;
    --fcw-warning-bg: #fffbe6;
    --fcw-warning-border: #ffe58f;

    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0;
    min-height: 480px;
    font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    color: var(--fcw-text);
}

/* Quando il componente e' montato dentro un popup XAF, nascondiamo i bottoni
   OK/Cancel standard del popup (sono ridondanti: il wizard ha gia' i propri). */
.popup-content-template:has(.fcw-root) .popup-window-footer,
.popup-content-template:has(.fcw-root) .dxbs-popup-footer,
.popup-content-template:has(.fcw-root) .modal-footer {
    display: none !important;
}

/* ─── Stepper ──────────────────────────────────────────── */

.fcw-stepper {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0;
    padding: 0.5rem 0 1.25rem 0;
    border-bottom: 1px solid var(--fcw-border);
    position: relative;
}

.fcw-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    text-align: center;
    cursor: default;
}

.fcw-step + .fcw-step::before {
    content: "";
    position: absolute;
    top: 18px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--fcw-border);
    z-index: 0;
}

.fcw-step--done + .fcw-step::before,
.fcw-step--active + .fcw-step::before {
    background: var(--fcw-primary);
}

.fcw-step__bullet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--fcw-border);
    color: var(--fcw-muted);
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 1;
    transition: all 0.2s ease;
}

.fcw-step--active .fcw-step__bullet {
    background: var(--fcw-primary);
    border-color: var(--fcw-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 120, 212, 0.15);
}

.fcw-step--done .fcw-step__bullet {
    background: var(--fcw-success);
    border-color: var(--fcw-success);
    color: #fff;
}

.fcw-step--done .fcw-step__bullet::after {
    content: "\2713";
    font-weight: 700;
}

.fcw-step--done .fcw-step__bullet > span { display: none; }

.fcw-step__label {
    font-size: 0.85rem;
    color: var(--fcw-muted);
    font-weight: 500;
}

.fcw-step--active .fcw-step__label {
    color: var(--fcw-primary);
    font-weight: 600;
}

.fcw-step--done .fcw-step__label {
    color: var(--fcw-success);
}

/* ─── Body ─────────────────────────────────────────────── */

.fcw-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.25rem 0.25rem 0;
}

.fcw-body__title {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--fcw-text);
}

.fcw-body__subtitle {
    margin: 0;
    color: var(--fcw-muted);
    font-size: 0.95rem;
}

.fcw-body__context {
    background: var(--fcw-bg-soft);
    border: 1px solid var(--fcw-border);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    color: var(--fcw-text);
}

.fcw-body__context strong {
    color: var(--fcw-primary);
}

.fcw-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0.75rem 1rem;
    align-items: center;
}

.fcw-row > label {
    font-weight: 500;
    color: var(--fcw-text);
    font-size: 0.92rem;
}

.fcw-row > label.required::after {
    content: " *";
    color: #d62828;
    font-weight: 700;
}

.fcw-row > .fcw-input {
    width: 100%;
}

.fcw-row > .fcw-input .dxbs-editor,
.fcw-row > .fcw-input .dxbs-input,
.fcw-row > .fcw-input .dx-textbox {
    width: 100%;
}

/* ─── Step 3: gruppo testi multilingua ──────────────────── */

.fcw-translations {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}

.fcw-translations .fcw-row {
    grid-template-columns: 160px 1fr;
}

.fcw-current-value {
    background: var(--fcw-bg-soft);
    border-left: 3px solid var(--fcw-primary);
    padding: 0.6rem 0.8rem;
    font-size: 0.92rem;
    border-radius: 4px;
    color: var(--fcw-muted);
}

.fcw-current-value strong {
    color: var(--fcw-text);
    margin-right: 0.5rem;
}

/* ─── Step 4: tabella occorrenze ────────────────────────── */

.fcw-occurrence-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.fcw-occurrence-toolbar .fcw-counter {
    margin-left: auto;
    font-size: 0.88rem;
    color: var(--fcw-muted);
}

.fcw-occurrences {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.93rem;
    background: #fff;
    border: 1px solid var(--fcw-border);
    border-radius: 6px;
    overflow: hidden;
}

.fcw-occurrences thead th {
    text-align: left;
    background: var(--fcw-bg-soft);
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--fcw-border);
    font-weight: 600;
    color: var(--fcw-text);
    font-size: 0.88rem;
}

.fcw-occurrences tbody td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid #eaecef;
    vertical-align: middle;
}

.fcw-occurrences tbody tr:last-child td {
    border-bottom: none;
}

.fcw-occurrences tbody tr:hover {
    background: #f8fafc;
}

.fcw-monospace {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    color: var(--fcw-muted);
    font-size: 0.78rem;
}

.fcw-empty {
    background: var(--fcw-warning-bg);
    border: 1px solid var(--fcw-warning-border);
    padding: 0.85rem 1rem;
    border-radius: 6px;
    color: #664d03;
}

.fcw-info {
    background: #e7f1ff;
    border: 1px solid #b6d4fe;
    color: #084298;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.92rem;
    margin-bottom: 0.75rem;
}

/* ─── Stato di errore ───────────────────────────────────── */

.fcw-error {
    background: var(--fcw-danger-bg);
    border: 1px solid var(--fcw-danger-border);
    color: var(--fcw-danger-text);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.92rem;
}

/* ─── Schermata successo ────────────────────────────────── */

.fcw-success {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 1rem;
    text-align: center;
}

.fcw-success__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--fcw-success);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
}

.fcw-success h3 {
    margin: 0;
    color: var(--fcw-text);
    font-weight: 600;
}

.fcw-success p {
    margin: 0;
    color: var(--fcw-muted);
    max-width: 480px;
    line-height: 1.55;
}

/* ─── Footer azioni ─────────────────────────────────────── */

.fcw-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--fcw-border);
    margin-top: auto;
}

.fcw-actions__hint {
    color: var(--fcw-muted);
    font-size: 0.85rem;
}

.fcw-actions__buttons {
    display: flex;
    gap: 0.5rem;
}

/* ─── Import Field Rule wizard: righe gia' presenti ──────── */

.ifw-row-exists {
    background: var(--fcw-bg-soft);
    color: var(--fcw-muted);
}

.ifw-row-exists strong {
    font-weight: 500;
}
