/* siblingIndexEditor.css — Sibling reorder panel (C2 / D13) */

/* ── Panel shell ─────────────────────────────────────────────────────────── */

.sib-editor-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.18);
    z-index: 8500;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}

.sib-editor-panel.visible {
    display: flex;
    animation: sib-slide-in 0.2s ease-out;
}

@keyframes sib-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0);    }
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.sib-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #f7f8fa;
    flex-shrink: 0;
}

.sib-editor-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2328;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 40px);
}

.sib-editor-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #57606a;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.sib-editor-close:hover { background: #e5e7eb; color: #1f2328; }

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

.sib-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    -webkit-overflow-scrolling: touch;
}

.sib-editor-loading,
.sib-editor-empty,
.sib-editor-error {
    padding: 24px 18px;
    color: #57606a;
    font-size: 14px;
    text-align: center;
}

.sib-editor-error { color: #cf222e; }

/* ── Table ───────────────────────────────────────────────────────────────── */

.sib-editor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sib-editor-table thead th {
    padding: 6px 14px 8px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #57606a;
    border-bottom: 1px solid #e5e7eb;
    background: #f7f8fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sib-editor-table .col-order { width: 80px; }
.sib-editor-table .col-gender { width: 60px; }

.sib-editor-row {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s;
}

.sib-editor-row:hover { background: #f7f8fa; }

.sib-editor-row.dirty { background: #fffbeb; }

.sib-editor-table td {
    padding: 8px 14px;
    color: #1f2328;
    vertical-align: middle;
}

.col-name { font-weight: 500; }

.col-gender {
    color: #57606a;
    font-size: 13px;
}

/* ── Order input ─────────────────────────────────────────────────────────── */

.sib-order-input {
    width: 54px;
    padding: 6px 8px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #1f2328;
    background: #fff;
    text-align: center;
    /* Remove spin arrows on number input */
    -moz-appearance: textfield;
    appearance: textfield;
    /* Minimum touch target */
    min-height: 36px;
}

.sib-order-input::-webkit-outer-spin-button,
.sib-order-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.sib-order-input:focus {
    outline: none;
    border-color: #3b82d4;
    box-shadow: 0 0 0 3px rgba(59, 130, 212, 0.15);
}

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

.sib-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-top: 1px solid #e5e7eb;
    background: #f7f8fa;
    flex-shrink: 0;
}

.sib-editor-hint {
    font-size: 11px;
    color: #57606a;
    flex: 1;
    line-height: 1.4;
}

.sib-editor-save-btn {
    padding: 9px 20px;
    background: #2da44e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-height: 44px;
    transition: background 0.15s;
}

.sib-editor-save-btn:hover:not(:disabled) { background: #2c974b; }
.sib-editor-save-btn:disabled { opacity: 0.6; cursor: default; }

/* ── Status bar ──────────────────────────────────────────────────────────── */

.sib-editor-status {
    min-height: 0;
    font-size: 12px;
    padding: 0 18px;
    line-height: 1.5;
    transition: all 0.2s;
}

.sib-editor-status:not(:empty) {
    padding: 8px 18px;
    border-top: 1px solid #e5e7eb;
}

.sib-editor-status--success { color: #1a7f37; background: #dafbe1; }
.sib-editor-status--error   { color: #cf222e; background: #ffebe9; }
.sib-editor-status--info    { color: #0550ae; background: #ddf4ff; }

/* ── Mobile adjustments ─────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .sib-editor-panel {
        max-width: 100%;
    }

    .sib-editor-hint {
        display: none; /* too small on phone, save the space */
    }

    .sib-order-input {
        width: 48px;
        min-height: 44px;
    }
}
