/* ============================================
   MADx Hub Source Tools Modal
   v5.0 - Unified black/red/white theme
   ============================================ */

/* Modal overlay */
#source-tools-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

/* Modal container */
.st-modal {
    background: #0a0a1a;
    border: 1px solid #333;
    border-top: 2px solid #e63946;
    border-radius: 12px;
    width: 680px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

/* Header */
.st-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #222;
    background: #0a0a1a;
}

.st-header h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.st-close-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.st-close-btn:hover { color: #e63946; }

/* Tabs */
.st-tabs {
    display: flex;
    border-bottom: 1px solid #222;
    background: #0a0a1a;
}

.st-tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.st-tab:hover { color: #ccc; }
.st-tab.active {
    color: #e63946;
    border-bottom-color: #e63946;
}

/* Panel body */
.st-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Section labels */
.st-label {
    font-size: 12px;
    font-weight: 700;
    color: #e63946;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* Filter row */
.st-filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.st-filter-row select {
    flex: 1;
    padding: 8px 10px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
}
.st-filter-row select:focus {
    outline: none;
    border-color: #e63946;
}

/* Chips row */
.st-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.st-chip {
    padding: 8px 14px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #ccc;
    font-size: 13px;
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', monospace;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 48px;
    text-align: center;
}
.st-chip:hover {
    border-color: #e63946;
    color: #fff;
}
.st-chip.active {
    background: #e63946;
    border-color: #e63946;
    color: #fff;
}

/* Count badge */
.st-count {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}
.st-count-zero { color: #666; }

/* Preview table */
.st-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 8px;
}
.st-preview-table th {
    text-align: left;
    padding: 6px 8px;
    color: #e63946;
    border-bottom: 1px solid #222;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.3px;
}
.st-preview-table td {
    padding: 5px 8px;
    color: #ccc;
    border-bottom: 1px solid #1a1a2e;
}

.st-more {
    font-size: 12px;
    color: #666;
    font-style: italic;
    padding: 4px 0;
}

.st-empty {
    color: #666;
    font-style: italic;
    padding: 20px 0;
    text-align: center;
}

/* Apply button */
.st-apply-btn {
    width: 100%;
    padding: 12px;
    background: #e63946;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.15s;
}
.st-apply-btn:hover { background: #d32f3f; }
.st-apply-btn:disabled {
    background: #222;
    color: #666;
    cursor: not-allowed;
}

/* Status message */
.st-status {
    font-size: 13px;
    padding: 8px 0;
    text-align: center;
}
.st-status-success { color: #4ade80; }
.st-status-error { color: #ff6b6b; }

/* Search input */
.st-search-input {
    width: 100%;
    padding: 10px 14px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    margin-bottom: 16px;
    box-sizing: border-box;
}
.st-search-input::placeholder { color: #555; }
.st-search-input:focus {
    outline: none;
    border-color: #e63946;
}

/* Search result item */
.st-search-item {
    padding: 10px 0;
    border-bottom: 1px solid #1a1a2e;
}

.st-search-info {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
}

.st-search-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.st-search-meta {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.st-search-item .st-chips-row {
    margin-bottom: 0;
}

.st-search-item .st-chip {
    padding: 5px 10px;
    font-size: 11px;
    min-width: 36px;
}

/* Divider */
.st-divider {
    height: 1px;
    background: #222;
    margin: 16px 0;
}

/* Hidden input */
.st-hidden { display: none; }