/* ══════════════════════════════════════════════════════════════════
   Excel Upload Wizard — Styles
   All selectors prefixed with .excel-upload-wizard for specificity
   ══════════════════════════════════════════════════════════════════ */

/* ── Window/Dialog containers — rounded corners ──────── */
.excel-wizard-window.k-window,
.description-editor-window.k-window,
.materia-delete-dialog.k-window,
.materia-delete-dialog.k-dialog {
    border-radius: 10px !important;
    overflow: hidden;
}

.excel-upload-wizard {
    min-height: 300px;
}

/* ── Remove dashed focus outline on wizard elements ──── */
.excel-upload-wizard *:focus,
.excel-upload-wizard *:focus-visible {
    outline: none !important;
}

/* ── Upload phase ──────────────────────────────────────── */
.excel-upload-wizard .upload-phase {
    padding: 20px;
}

/* ── Drop zone ─────────────────────────────────────────── */
.excel-upload-wizard .excel-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.15s;
    min-height: 200px;
}

.excel-upload-wizard .excel-dropzone-dragover {
    border-color: #BF70CC !important;
    background: #fdf5ff !important;
}

.excel-upload-wizard .dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    gap: 4px;
}

.excel-upload-wizard .dropzone-icon {
    font-size: 48px;
    color: #BF70CC;
    margin-bottom: 8px;
}

.excel-upload-wizard .dropzone-hint {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.excel-upload-wizard .dropzone-subhint {
    font-size: 13px;
    color: #999;
    margin: 4px 0 8px 0;
}

.excel-upload-wizard .dropzone-formats {
    font-size: 12px;
    color: #999;
    margin: 8px 0 0 0;
}

/* ── Hidden native FileSelect UI ──────────────────────── */
.excel-upload-wizard .hidden-file-select {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ── Selected file card ────────────────────────────────── */
.excel-upload-wizard .selected-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 1px solid #BF70CC;
    border-radius: 8px;
    background: #fdf5ff;
}

.excel-upload-wizard .selected-file-icon {
    font-size: 32px;
    color: #198754;
}

.excel-upload-wizard .selected-file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.excel-upload-wizard .selected-file-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.excel-upload-wizard .selected-file-size {
    font-size: 12px;
    color: #666;
}

.excel-upload-wizard .processing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
}

.excel-upload-wizard .upload-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

/* ── Wizard ROOT — remove outer padding ──────────────── */
.excel-upload-wizard .k-wizard,
.excel-upload-wizard .k-wizard.k-wizard-horizontal,
div.excel-upload-wizard .k-wizard {
    padding: 8px 12px !important;
}

/* ── Wizard stepper — compact ─────────────────────────── */
.excel-upload-wizard .k-stepper,
.excel-upload-wizard .k-wizard .k-stepper,
div.excel-upload-wizard .k-stepper {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
}

.excel-upload-wizard .k-stepper .k-step-text,
div.excel-upload-wizard .k-stepper .k-step-text {
    margin-top: 6px !important;
}

/* ── k-wizard-steps — THE GAP between stepper and content ── */
.excel-upload-wizard .k-wizard-steps,
.excel-upload-wizard .k-wizard .k-wizard-steps,
div.excel-upload-wizard .k-wizard-steps {
    margin-top: 4px !important;
    margin-block-start: 4px !important;
    padding: 0 !important;
}

/* ── k-wizard-content — remove internal padding ────────── */
.excel-upload-wizard .k-wizard-content,
.excel-upload-wizard .k-wizard .k-wizard-content,
.excel-upload-wizard .k-wizard-step .k-wizard-content,
div.excel-upload-wizard .k-wizard-content {
    padding: 0 !important;
    margin: 0 !important;
}

/* ── k-wizard-step — remove padding ──────────────────── */
.excel-upload-wizard .k-wizard-step,
div.excel-upload-wizard .k-wizard-step {
    padding: 0 !important;
}

/* ── k-wizard-buttons — compact ─────────────────────── */
.excel-upload-wizard .k-wizard-buttons,
div.excel-upload-wizard .k-wizard-buttons {
    padding: 4px 0 0 0 !important;
}

/* ── Step content ──────────────────────────────────────── */
.excel-upload-wizard .step-content {
    padding: 8px 4px 20px 4px !important;
}

/* ── File info bar ─────────────────────────────────────── */
.excel-upload-wizard .file-info-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 0 0 4px 0 !important;
}

.excel-upload-wizard .file-info-bar .badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 10px !important;
    font-size: 0.82rem !important;
}

/* ── Dataset name section ─────────────────────────────── */
.excel-upload-wizard .dataset-name-section {
    padding: 20px 0 24px 0 !important;
}

.excel-upload-wizard .dataset-name-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #dc3545;
}

/* ── Preview section ──────────────────────────────────── */
.excel-upload-wizard .preview-section {
    margin-top: 0 !important;
}

/* ── Sheet chip selection (multi-sheet, horizontal) ───── */
.excel-upload-wizard .sheet-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0 4px 0;
}

.excel-upload-wizard .sheet-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 100px;
}

.excel-upload-wizard .sheet-chip:hover {
    background: #f8f9fa;
    border-color: #BF70CC;
}

.excel-upload-wizard .sheet-chip.selected {
    background: #fdf5ff;
    border-color: #BF70CC;
    box-shadow: 0 0 0 1px #BF70CC;
}

.excel-upload-wizard .sheet-chip-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.excel-upload-wizard .sheet-chip-info {
    font-size: 0.78rem;
    color: #888;
}

/* ── Sheet options (header row checkbox) ──────────────── */
.excel-upload-wizard .sheet-options {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-top: 12px !important;
    padding: 0 !important;
}

/* ── Column grid ───────────────────────────────────────── */
.excel-upload-wizard .columns-grid {
    font-size: 0.9rem;
}

.excel-upload-wizard .columns-header {
    color: #333;
}

.excel-upload-wizard .sample-values {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    display: inline-block;
}

.excel-upload-wizard .description-cell {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 2px 4px;
    border-radius: 4px;
}

.excel-upload-wizard .description-cell:hover {
    background: rgba(0, 0, 0, 0.05);
}

.excel-upload-wizard .description-text {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.excel-upload-wizard .description-edit-icon {
    font-size: 0.65rem;
    color: #999;
    flex-shrink: 0;
}

.excel-upload-wizard .description-cell:hover .description-edit-icon {
    color: #BF70CC;
}

.excel-upload-wizard .description-placeholder {
    font-size: 0.8rem;
    color: #aaa;
}

.excel-upload-wizard .description-cell:hover .description-placeholder {
    color: #BF70CC;
}

.excel-upload-wizard .pk-indicator {
    font-size: 0.9rem;
}

/* ── Hint bar ──────────────────────────────────────────── */
.excel-upload-wizard .hint-bar {
    font-size: 0.85rem;
    color: #666;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

/* ── Preview table ─────────────────────────────────────── */
.excel-upload-wizard .preview-table {
    font-size: 0.85rem;
}

.excel-upload-wizard .preview-table th,
.excel-upload-wizard .preview-table td {
    padding: 8px 10px !important;
    vertical-align: middle;
}

.excel-upload-wizard .preview-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.excel-upload-wizard .preview-table td {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Options sections (Step 2: Opzioni avanzate) ─────── */
.excel-upload-wizard .options-section {
    margin-bottom: 20px;
}

.excel-upload-wizard .options-section:last-child {
    margin-bottom: 0;
}

.excel-upload-wizard .options-section-header {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.excel-upload-wizard .options-section-disabled {
    opacity: 0.6;
}

.excel-upload-wizard .options-future-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #ccc;
    font-size: 0.9rem;
    color: #666;
}

/* ── Refresh options (Step 2) ─────────────────────────── */
.excel-upload-wizard .refresh-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.excel-upload-wizard .refresh-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.15s;
}

.excel-upload-wizard .refresh-option.selected {
    background: #fdf5ff;
    border-color: #BF70CC;
}

.excel-upload-wizard .refresh-option.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.excel-upload-wizard .refresh-option-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.excel-upload-wizard .refresh-option-content strong {
    color: #333;
    font-size: 0.95rem;
}

.excel-upload-wizard .refresh-option-content .text-muted {
    font-size: 0.85rem;
}

/* ── Summary (Step 4: Conferma) ───────────────────────── */
.excel-upload-wizard .summary-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.excel-upload-wizard .summary-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #333;
}

.excel-upload-wizard .confirm-preview-section {
    margin-top: 20px;
}

/* ── Wizard footer (stacked rows) ─────────────────────── */
.excel-upload-wizard .wizard-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
}

/* PK section — left-aligned, label on top, buttons below */
.excel-upload-wizard .wizard-pk-section {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    margin-top: 6px !important;
}

.excel-upload-wizard .wizard-pk-label {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 0.85rem !important;
}

.excel-upload-wizard .wizard-pk-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

/* Navigation buttons — right-aligned */
.excel-upload-wizard .wizard-nav-row {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Hint — centered */
.excel-upload-wizard .wizard-hint {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
}

/* ── Primary button hover ─────────────────────────────── */
.excel-upload-wizard .k-button-solid-primary:hover,
.excel-upload-wizard .k-button-solid-primary:focus {
    background-color: #9B3DAF !important;
    border-color: #9B3DAF !important;
}

/* ── Center phases (importing/success/error) ──────────── */
.excel-upload-wizard .phase-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.excel-upload-wizard .phase-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.excel-upload-wizard .phase-subtitle {
    font-size: 0.88rem;
    color: #888;
    margin: 4px 0 0 0;
}

/* ── Import error box (shown in Importing phase) ───────── */
.excel-upload-wizard .import-error-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    color: #991b1b;
    font-size: 0.9rem;
    margin-top: 12px;
    max-width: 90%;
    text-align: left;
}

.excel-upload-wizard .import-error-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Badge types ───────────────────────────────────────── */
.excel-upload-wizard .badge.bg-type-string { background-color: #6c757d !important; }
.excel-upload-wizard .badge.bg-type-number { background-color: #0d6efd !important; }
.excel-upload-wizard .badge.bg-type-date { background-color: #198754 !important; }
.excel-upload-wizard .badge.bg-type-bool { background-color: #dc3545 !important; }

/* ── Fingerprint decision card ─────────────────────────── */
.excel-upload-wizard .fingerprint-decision-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
    border: 1px solid #BF70CC;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(191, 112, 204, 0.08) 0%, rgba(155, 77, 176, 0.04) 100%);
}

.excel-upload-wizard .fingerprint-decision-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.excel-upload-wizard .fingerprint-decision-icon {
    color: #BF70CC;
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}

.excel-upload-wizard .fingerprint-decision-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    color: #333;
}

.excel-upload-wizard .fingerprint-decision-actions {
    display: flex;
    gap: 10px;
    margin-top: 2px;
}
