/* ===================================
   Inputs Configuration Modal - Modern
   =================================== */

/* Modal sizing & border */
.inputs-modal-modern {
    max-width: 880px;
    width: 92%;
    max-height: 88vh;
    height: min(88vh, 760px);
    border-radius: 12px;
    border: 1px solid var(--color-border, #333);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 0;
    overflow: hidden;
    background: var(--color-bg-primary, #1e1e2e);
    color: var(--color-text-primary, #e0e0e0);
    flex-direction: column;
}

.inputs-modal-modern[open] {
    display: flex;
}

.inputs-modal-modern::backdrop {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}

/* Header - gradient matching platform style */
.inputs-modal-header {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    padding: 18px 24px;
    border-bottom: none;
    margin-bottom: 0;
    border-radius: 12px 12px 0 0;
    cursor: move;
    user-select: none;
    flex: 0 0 auto;
}

.inputs-modal-header h2 {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.inputs-modal-header .modal-close {
    color: white;
    font-size: 24px;
    font-weight: 300;
    transition: transform 0.2s, opacity 0.2s;
    padding: 0 4px;
}

.inputs-modal-header .modal-close:hover {
    opacity: 0.8;
    transform: rotate(90deg);
}

/* Body */
.inputs-modal-body {
    padding: 20px 24px;
    min-height: 12rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    max-height: none;
    overscroll-behavior: contain;
    background: var(--color-bg-primary, #1e1e2e);
    color: var(--color-text-primary, #e0e0e0);
}

/* Toolbar */
.inputs-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.inputs-toolbar-hint {
    margin-left: auto;
    font-size: 11px;
    color: var(--color-text-secondary, #999);
}

/* Buttons */
.inputs-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.inputs-btn-icon {
    font-size: 15px;
    line-height: 1;
}

.inputs-btn-add {
    background: linear-gradient(135deg, #4A90E2, #357ABD);
    color: white;
    border-color: #357ABD;
}

.inputs-btn-add:hover {
    background: linear-gradient(135deg, #5BA0F2, #4A90E2);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(74, 144, 226, 0.3);
}

.inputs-btn-remove {
    background: var(--color-bg-secondary, #2a2a3a);
    color: #ef4444;
    border-color: var(--color-border, #444);
}

.inputs-btn-remove:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    transform: translateY(-1px);
}

.inputs-btn-save {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: #059669;
}

.inputs-btn-save:hover {
    background: linear-gradient(135deg, #22d39a, #10b981);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16, 185, 129, 0.3);
}

.inputs-btn-cancel {
    background: var(--color-bg-secondary, #2a2a3a);
    color: var(--color-text-secondary, #aaa);
    border-color: var(--color-border, #444);
}

.inputs-btn-cancel:hover {
    background: var(--color-bg-hover, #3a3a4a);
    color: var(--color-text-primary, #e0e0e0);
}

/* Table wrapper */
.inputs-table-wrapper {
    border: 1px solid var(--color-border, #333);
    border-radius: 8px;
    overflow: auto;
    position: relative;
    max-height: none;
    min-height: 160px;
    flex: 0 1 42vh;
    background: var(--color-bg-secondary, #2a2a3a);
}

/* Table */
#inputs-config-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

#inputs-config-table thead tr {
    background: var(--color-bg-secondary, #2a2a3a);
}

#inputs-config-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary, #4A90E2);
    background: var(--color-bg-secondary, #2a2a3a);
    border-bottom: 2px solid var(--color-primary, #4A90E2);
    border-right: none;
    border-left: none;
    border-top: none;
    text-align: left;
}

#inputs-config-table th:first-child {
    text-align: center;
}

#inputs-config-table td {
    padding: 6px 10px;
    border: none;
    border-bottom: 1px solid var(--color-border, #333);
    vertical-align: middle;
    color: var(--color-text-primary, #e0e0e0);
}

#inputs-config-table tbody tr {
    transition: background 0.15s;
}

#inputs-config-table tbody tr:hover {
    background: var(--color-bg-hover, rgba(74, 144, 226, 0.06));
}

#inputs-config-table tbody tr:last-child td {
    border-bottom: none;
}

/* Inputs inside table cells */
#inputs-config-table input[type="checkbox"] {
    margin: 0;
    accent-color: var(--color-primary, #4A90E2);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#inputs-config-table input[type="text"] {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--color-border, #444);
    border-radius: 6px;
    background: var(--color-bg-primary, #1e1e2e);
    color: var(--color-text-primary, #e0e0e0);
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#inputs-config-table input[type="text"]::placeholder,
#inputs-config-table select,
#inputs-config-table option {
    color: var(--color-text-primary, #e0e0e0);
}

#inputs-config-table input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary, #4A90E2);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

#inputs-config-table select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--color-border, #444);
    border-radius: 6px;
    background: var(--color-bg-primary, #1e1e2e);
    color: var(--color-text-primary, #e0e0e0);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

#inputs-config-table select:focus {
    outline: none;
    border-color: var(--color-primary, #4A90E2);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

/* Empty state (toggled via JS) */
.inputs-empty-state {
    display: none;
    text-align: center;
    padding: 32px 16px;
    color: var(--color-text-primary, #ccc);
}

.inputs-empty-icon {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.inputs-empty-state p {
    margin: 4px 0;
    font-size: 13px;
}

.inputs-empty-sub {
    font-size: 12px !important;
    color: var(--color-text-secondary, #999) !important;
}

/* SVG cell */
.inputs-svg-cell {
    text-align: center;
    min-width: 100px;
}

.svg-cell-content {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.inputs-svg-upload {
    background: var(--color-bg-primary, #1e1e2e);
    border: 1px dashed var(--color-border, #555);
    border-radius: 6px;
    color: var(--color-text-secondary, #aaa);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    transition: all 0.2s;
    line-height: 1;
}

.inputs-svg-upload:hover {
    border-color: var(--color-primary, #4A90E2);
    color: var(--color-primary, #4A90E2);
    background: rgba(74, 144, 226, 0.08);
}

.inputs-svg-name {
    font-size: 11px;
    color: var(--color-primary, #4A90E2);
    max-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.inputs-svg-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.inputs-svg-remove:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Footer */
.inputs-modal-footer {
    padding: 14px 24px;
    gap: 10px;
    border-top: 1px solid var(--color-border, #333);
    display: flex;
    justify-content: flex-end;
    flex: 0 0 auto;
    background: var(--color-bg-primary, #1e1e2e);
}

.inputs-modal-modern label,
.inputs-modal-modern p,
.inputs-modal-modern span,
.inputs-modal-modern td {
    color: var(--color-text-primary, #e0e0e0);
}

.inputs-modal-modern .inputs-toolbar-hint,
.inputs-modal-modern .inputs-empty-sub,
.inputs-modal-modern [style*="color: var(--color-text-secondary"] {
    color: var(--color-text-secondary, #a3a3a3) !important;
}

.inputs-modal-modern button.inputs-btn-cancel,
.inputs-modal-modern button.inputs-btn-remove {
    background: var(--color-bg-secondary, #2a2a3a);
    color: var(--color-text-primary, #e0e0e0);
}

.inputs-modal-modern .inputs-btn-add,
.inputs-modal-modern .inputs-btn-save,
.inputs-modal-modern .inputs-btn-add span,
.inputs-modal-modern .inputs-btn-save span {
    color: #ffffff;
}

/* Responsive */
@media (max-width: 600px) {
    .inputs-modal-modern {
        max-width: 98%;
    }
    .inputs-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .inputs-toolbar-hint {
        margin-left: 0;
    }
}
