/* ══════════════════════════════════════════════════
   STAS Wizard Modal Design System
   Global CSS for all wizard-style modals.
   Root class: .stas-wizard
   ══════════════════════════════════════════════════ */

/* ── Strip Blazored default header/padding ── */

.blazored-modal:has(.stas-wizard) .bm-header { display: none !important; }
.bm-content:has(> .stas-wizard) { padding: 0 !important; margin-top: 0 !important; }

/* ── Root Container ── */

.stas-wizard {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    background: #f4f5f7;
    overflow: hidden;
}

/* ── Gradient Header ── */

.wizard-header {
    background: linear-gradient(135deg, var(--stas-primary, #003951) 0%, var(--stas-primary-hover, #005a7a) 100%);
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.wizard-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--stas-accent, #ED880E) 0%, var(--stas-accent-hover, #f59e0b) 40%, transparent 100%);
}

.wizard-header-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    backdrop-filter: blur(4px);
}

.wizard-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.wizard-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.stas-wizard .text-white-70 {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.78rem;
    letter-spacing: 0.01em;
}

/* ── Scrollable Body ── */

.wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.125rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    min-height: 0;
}

/* When section cards are wrapped in an EditForm (<form>) inside the body, the form becomes the
   only flex child of .wizard-body — propagate the same vertical rhythm so cards keep their gap. */
.stas-wizard .wizard-body > form {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.wizard-body::-webkit-scrollbar { width: 4px; }
.wizard-body::-webkit-scrollbar-track { background: transparent; }
.wizard-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 10px; }
.wizard-body::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }

/* ── Section Cards ── */

.wiz-section {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.03);
}

.wiz-section-header {
    padding: 0.55rem 1.125rem;
    background: linear-gradient(135deg, var(--stas-primary, #003951) 0%, var(--stas-primary-hover, #005a7a) 100%);
    font-weight: 600;
    color: #fff;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 10px 10px 0 0;
}

.wiz-section-header i { font-size: 0.8rem; }

.wiz-section-header .optional-label {
    font-size: 0.65rem;
    text-transform: none;
    letter-spacing: 0;
    color: #fff;
    opacity: 0.8;
    margin: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.wiz-section-header:not(.wiz-section-header-toggle) .optional-label {
    margin-left: auto;
}

.wiz-section-body {
    padding: 1rem 1.125rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ── Required Section (orange accent) ── */

.wiz-section-required {
    box-shadow: 0 0 0 1px rgba(237, 136, 14, 0.12), 0 1px 4px rgba(237, 136, 14, 0.06), 0 3px 12px rgba(0, 0, 0, 0.04);
}

.wiz-section-header.wiz-section-header-required {
    background: linear-gradient(135deg, var(--stas-accent, #ED880E) 0%, #f5b342 100%);
}

/* ── Collapsible Optional Section ── */

.wiz-section-header-toggle {
    background: linear-gradient(135deg, #4a5568 0%, #5a6a7a 100%);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.wiz-section-header-toggle:hover {
    background: linear-gradient(135deg, #5a6a7a 0%, #6b7d8e 100%);
}

.wiz-toggle-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.8;
    transition: transform 0.15s ease;
}

.wiz-section-collapsed .wiz-section-header {
    border-radius: 10px;
}

/* ── Internal Group Dividers ── */

.wiz-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wiz-section-body > .wiz-group:not(:first-child),
.wiz-section-body > .wiz-field + .wiz-group,
.wiz-section-body > .wiz-row + .wiz-group {
    padding-top: 0.75rem;
    border-top: 1px solid #eef0f2;
}

.wiz-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5a7a8a;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.wiz-group-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dde3e8;
    margin-left: 0.35rem;
}

.wiz-group-label i {
    font-size: 0.65rem;
}

/* ── Grid & Fields ── */

.wiz-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: start;
}

.wiz-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.wiz-field-full {
    grid-column: 1 / -1;
}

.stas-wizard .wiz-field .field-label,
.stas-wizard .wiz-field label:not(.custom-control-label):not(.optional-label):not(.check),
.stas-wizard .wiz-group label:not(.custom-control-label):not(.optional-label):not(.check) {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--stas-primary, #003951);
    margin-bottom: 0.2rem;
}

.stas-wizard .wiz-field .text-danger {
    color: var(--stas-danger, #dc2626) !important;
    font-weight: 700;
}

.stas-wizard .wiz-field .form-control,
.stas-wizard .wiz-field .custom-select,
.stas-wizard .wiz-group .form-control,
.stas-wizard .wiz-group .custom-select {
    font-size: 0.85rem;
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    border: 1px solid #dde1e6;
    background: #fafbfc;
    transition: all 0.15s ease;
}

.stas-wizard .wiz-field .form-control:hover,
.stas-wizard .wiz-field .custom-select:hover,
.stas-wizard .wiz-group .form-control:hover,
.stas-wizard .wiz-group .custom-select:hover {
    border-color: #c0c6cc;
}

.stas-wizard .wiz-field .form-control:focus,
.stas-wizard .wiz-field .custom-select:focus,
.stas-wizard .wiz-group .form-control:focus,
.stas-wizard .wiz-group .custom-select:focus {
    background: #fff;
    border-color: var(--stas-primary, #003951);
    box-shadow: 0 0 0 3px rgba(0, 57, 81, 0.08);
}

.stas-wizard .wiz-field .btn-outline-primary,
.stas-wizard .wiz-group .btn-outline-primary {
    padding: 0.4rem 0.65rem;
    align-self: stretch;
    border-radius: 8px;
}

.stas-wizard .wiz-field .input-group .form-control,
.stas-wizard .wiz-group .input-group .form-control {
    border-radius: 8px 0 0 8px;
}

.stas-wizard .wiz-field .input-group .btn,
.stas-wizard .wiz-group .input-group .btn {
    padding: 0.4rem 0.65rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
}

/* Addon labels (e.g. the "/26" year suffix on order numbers) must match the input height/style */
.stas-wizard .wiz-field .input-group .input-group-text,
.stas-wizard .wiz-group .input-group .input-group-text {
    font-size: 0.85rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid #dde1e6;
    background: #f1f3f5;
    color: #5a7a8a;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
}

.stas-wizard .wiz-field .custom-control {
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
}

/* ── Currency Picker ── */

.stas-wizard .input-group-border {
    border: 1px solid #dde1e6;
    border-radius: 8px;
    background: #fafbfc;
    transition: all 0.15s ease;
}

.stas-wizard .input-group-border:hover {
    border-color: #c0c6cc;
}

.stas-wizard .input-group-border:focus-within {
    background: #fff;
    border-color: var(--stas-primary, #003951);
    box-shadow: 0 0 0 3px rgba(0, 57, 81, 0.08);
}

.stas-wizard .currency-selector {
    font-size: 0.85rem;
    background: transparent;
}

.stas-wizard .currency-symbol {
    border-left-color: #dde1e6;
}

/* ── Coordinates ── */

.stas-wizard .long-lat-div {
    font-size: 0.85rem;
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    border: 1px solid #dde1e6;
    background: #fafbfc;
}

/* ── Table Styling (inside sections) ── */

.stas-wizard .wiz-section-body .table thead th {
    border-bottom: 0 !important;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8896a6;
}

.stas-wizard .wiz-section-body table td {
    font-size: 0.82rem;
}

/* ══════════════════════════════════════════════════
   Info / Detail Modal Pattern
   See WorkerModal.razor for the canonical example.
   ══════════════════════════════════════════════════ */

/* ── Hero block (avatar/icon + name + badges, optional right-side action) ── */

.stas-wizard .wiz-info-hero {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.25rem 0 0.85rem;
    border-bottom: 1px solid #eef0f2;
}

.stas-wizard .wiz-info-hero-avatar {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    border-radius: 50% !important;
    background-size: cover !important;
    background-position: center !important;
    border: 3px solid #fff !important;
    box-shadow: 0 0 0 1px rgba(0, 57, 81, 0.15), 0 4px 12px rgba(0, 57, 81, 0.16) !important;
    flex-shrink: 0;
}

/* Icon-style hero (use when the entity has no photo — e.g. Item, Company, Invoice). */
.stas-wizard .wiz-info-hero-icon {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #003951 0%, #005a7a 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 57, 81, 0.15), 0 4px 12px rgba(0, 57, 81, 0.16);
    flex-shrink: 0;
}

.stas-wizard .wiz-info-hero-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.stas-wizard .wiz-info-name {
    font-size: 1.18rem;
    font-weight: 700;
    color: #003951;
    line-height: 1.2;
    word-break: break-word;
}

.stas-wizard .wiz-info-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* ── Pill chips (use inside hero badges or anywhere a small tag is needed) ── */

.stas-wizard .wiz-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.stas-wizard .wiz-chip-primary {
    background: rgba(0, 57, 81, 0.1);
    color: #003951;
    border: 1px solid rgba(0, 57, 81, 0.2);
}

.stas-wizard .wiz-chip-accent {
    background: rgba(237, 136, 14, 0.12);
    color: #b86b00;
    border: 1px solid rgba(237, 136, 14, 0.25);
}

.stas-wizard .wiz-chip-success {
    background: rgba(40, 167, 69, 0.13);
    color: #1e7e34;
    border: 1px solid rgba(40, 167, 69, 0.28);
}

.stas-wizard .wiz-chip-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(220, 38, 38, 0.28);
}

/* ── Info list (key/value rows with gradient hairline dividers) ── */

.stas-wizard .wiz-info-list {
    display: flex;
    flex-direction: column;
    margin-top: 0.25rem;
}

.stas-wizard .wiz-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0;
    font-size: 0.88rem;
    background-image: linear-gradient(90deg, transparent 0%, rgba(0, 57, 81, 0.18) 20%, rgba(0, 57, 81, 0.18) 80%, transparent 100%);
    background-repeat: no-repeat;
    background-size: 100% 1px;
    background-position: bottom;
}

.stas-wizard .wiz-info-list .wiz-info-row:last-child {
    background-image: none;
}

.stas-wizard .wiz-info-row-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #5a6a7a;
    font-weight: 500;
    flex-shrink: 0;
}

.stas-wizard .wiz-info-row-label i {
    color: #ED880E;
    width: 16px;
    text-align: center;
    font-size: 0.95rem;
}

.stas-wizard .wiz-info-row-value {
    color: #1e293b;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
    min-width: 0;
}

.stas-wizard .wiz-info-row-value a {
    color: #003951;
    text-decoration: none;
    border-bottom: 1px dotted rgba(0, 57, 81, 0.4);
    transition: color 0.15s, border-color 0.15s;
}

.stas-wizard .wiz-info-row-value a:hover {
    color: #ED880E;
    border-bottom-color: #ED880E;
}

/* Compact 2-column variant — for wide modals where a single column of rows looks sparse */
.stas-wizard .wiz-info-list-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.75rem;
}

/* A row that should span the full width of the grid (e.g. long description) */
.stas-wizard .wiz-info-list-grid .wiz-info-row-full {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .stas-wizard .wiz-info-list-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Legacy compact info-field (kept for backward compat — prefer wiz-info-row for new modals) ── */

.stas-wizard .wiz-info-field {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 0.4rem;
    padding: 0.4rem 0;
    align-items: start;
}

.stas-wizard .wiz-info-field + .wiz-info-field {
    border-top: 1px solid #f0f2f4;
}

.stas-wizard .wiz-info-field .wiz-info-icon {
    color: #8896a6;
    font-size: 0.7rem;
    padding-top: 0.1rem;
}

.stas-wizard .wiz-info-field .wiz-info-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #8896a6;
    line-height: 1;
}

.stas-wizard .wiz-info-field .wiz-info-value {
    font-size: 0.85rem;
    color: #1e293b;
    line-height: 1.3;
}

/* ── Info Banner ── */

.stas-wizard .wiz-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: #f0f6fa;
    border-radius: 8px;
    border-left: 3px solid var(--stas-primary, #003951);
}

/* ── Entry Picker Cards ── */

.stas-wizard .entry-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stas-wizard .entry-picker-card {
    border: 1px solid #dde1e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    overflow: hidden;
    background: #fff;
}

.stas-wizard .entry-picker-card:hover {
    border-color: var(--stas-primary, #003951);
    box-shadow: 0 2px 8px rgba(0, 57, 81, 0.12);
}

.stas-wizard .entry-picker-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #fafbfc;
    border-bottom: 1px solid #eef0f2;
}

.stas-wizard .entry-picker-card-body {
    padding: 10px 14px;
}

.stas-wizard .entry-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    font-size: 0.88rem;
}

.stas-wizard .entry-number-badge {
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.stas-wizard .entry-notes {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px dashed #eef0f2;
    font-size: 0.85rem;
    max-width: 100%;
    overflow: hidden;
}

.stas-wizard .entry-notes .text-truncate {
    max-width: calc(100% - 24px);
    display: inline-block;
}

/* ── Confirmation Modal ── */

.stas-confirm .confirm-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.75rem 1.25rem;
    min-height: 140px;
    text-align: center;
    background: #fff;
}

.confirm-icon-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.confirm-icon-warning {
    background: radial-gradient(circle at 30% 30%, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    box-shadow: 0 0 0 6px rgba(180, 83, 9, 0.06);
}

.confirm-icon-danger {
    background: radial-gradient(circle at 30% 30%, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.06);
}

.confirm-icon-positive {
    background: radial-gradient(circle at 30% 30%, #e0f2fe 0%, #bae6fd 100%);
    color: var(--stas-primary, #003951);
    box-shadow: 0 0 0 6px rgba(0, 57, 81, 0.06);
}

.confirm-text {
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.55;
    max-width: 280px;
    word-break: break-word;
}

.confirm-detail {
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: #64748b;
}

.confirm-detail strong {
    color: #28a745;
}

/* ── Footer ── */

.wizard-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-top: 1px solid #eef0f2;
    flex-shrink: 0;
}

/* Base shape shared by ALL footer buttons (filled, outline, any color) */
.stas-wizard .wizard-footer .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-weight: 600;
    padding: 0.4rem 1.25rem;
    border-radius: 8px;
    transition: all 0.15s ease;
}

/* Gap is owned by the button flexbox above — neutralize per-icon margins
   (me-1, Margin.Is1.FromEnd, etc.) so spacing is identical on every button. */
.stas-wizard .wizard-footer .btn > i,
.stas-wizard .wizard-footer .btn > svg,
.stas-wizard .wizard-footer .btn .b-icon {
    margin: 0 !important;
}

.stas-wizard .wizard-footer .btn-primary {
    background: var(--stas-primary, #003951);
    border-color: var(--stas-primary, #003951);
}

.stas-wizard .wizard-footer .btn-primary:hover {
    background: var(--stas-primary-hover, #005a7a);
    border-color: var(--stas-primary-hover, #005a7a);
    box-shadow: 0 2px 8px rgba(0, 57, 81, 0.25);
    transform: translateY(-1px);
}

/* ── Reduced-motion ── */

@media (prefers-reduced-motion: reduce) {
    .wizard-header,
    .wiz-section-header-toggle,
    .wizard-close-btn,
    .wiz-toggle-chevron,
    .stas-wizard .wiz-field .form-control,
    .stas-wizard .wiz-field .custom-select,
    .stas-wizard .wiz-group .form-control,
    .stas-wizard .wiz-group .custom-select,
    .stas-wizard .input-group-border,
    .stas-wizard .wizard-footer .btn {
        transition-duration: 0.01ms !important;
        transform: none !important;
    }
}
