/* ── AI Settings Page (FEAT-071) ──────────────────────────────────────────── */

/* Refresh button */
.ais-refresh-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #1e2130;
    color: #adb5bd;
    cursor: pointer;
    font-size: 13px;
}
.ais-refresh-btn:hover { background: #2d3548; color: #e8eaf0; }

/* Tab row */
.ais-tab-row { display: flex; gap: 8px; }

.ais-tab-btn {
    padding: 6px 18px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #1e2130;
    color: #adb5bd;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
.ais-tab-btn:hover { background: #2d3548; color: #e8eaf0; }
.ais-tab-active { background: #e8734a !important; border-color: #e8734a !important; color: #fff !important; }

/* Status bar */
.ais-status-bar {
    font-size: 12px;
    color: #6c757d;
    min-height: 18px;
    margin-bottom: 6px;
}

/* Section actions */
.ais-section-actions { display: flex; gap: 8px; }

.ais-action-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    background: #4a9eff;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
}
.ais-action-btn:hover { background: #3385e8; }

.ais-cancel-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid #555;
    background: transparent;
    color: #adb5bd;
    cursor: pointer;
    font-size: 13px;
}
.ais-cancel-btn:hover { background: #2d3548; }

/* Provider table */
.ais-table-wrap { overflow-x: auto; margin-bottom: 16px; }

.ais-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ais-table th {
    background: #1e2537;
    color: #adb5bd;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #2d3548;
    white-space: nowrap;
}
.ais-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #1e2537;
    color: #c9d1d9;
    vertical-align: middle;
}
.ais-table tr:hover td { background: #1e2537; }

.ais-url-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ais-key-mask { color: #6c757d; letter-spacing: 2px; }

.ais-action-cell { white-space: nowrap; }

.ais-row-btn {
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #252b3b;
    color: #adb5bd;
    cursor: pointer;
    font-size: 12px;
    margin-right: 4px;
}
.ais-row-btn:hover { background: #2d3548; }
.ais-row-edit:hover   { color: #4a9eff; border-color: #4a9eff; }
.ais-row-test:hover   { color: #28a745; border-color: #28a745; }
.ais-row-delete:hover { color: #e8734a; border-color: #e8734a; }

/* Add / edit form card */
.ais-form-card {
    background: #1a1f2e;
    border: 1px solid #2d3548;
    border-radius: 8px;
    padding: 20px;
    margin-top: 12px;
}
.ais-form-title { font-size: 15px; font-weight: 600; color: #e8eaf0; margin-bottom: 14px; }

.ais-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.ais-label { display: block; font-size: 12px; color: #adb5bd; margin-bottom: 4px; }
.ais-label.mt-1 { margin-top: 10px; }

.ais-input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #3a4060;
    background: #252b3b;
    color: #e8eaf0;
    font-size: 13px;
    box-sizing: border-box;
}
.ais-input:focus { outline: none; border-color: #4a9eff; }

.ais-dropdown .Select-control {
    background: #252b3b !important;
    border-color: #3a4060 !important;
    color: #e8eaf0 !important;
}

.ais-form-actions { display: flex; gap: 8px; margin-top: 8px; }
.ais-form-status { font-size: 12px; color: #e8734a; min-height: 18px; margin-top: 6px; }

/* Empty state */
.ais-empty { color: #6c757d; font-size: 13px; padding: 20px 0; }

/* Feature bindings */
.ais-feat-list { display: flex; flex-direction: column; gap: 14px; }

.ais-feat-card {
    background: #1a1f2e;
    border: 1px solid #2d3548;
    border-radius: 8px;
    padding: 16px 20px;
}
.ais-feat-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ais-feat-name { font-size: 14px; font-weight: 600; color: #e8eaf0; }
.ais-feat-key-badge {
    font-size: 11px;
    color: #6c757d;
    background: #252b3b;
    border: 1px solid #3a4060;
    border-radius: 4px;
    padding: 2px 7px;
}

.ais-feat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}
@media (max-width: 600px) { .ais-feat-grid { grid-template-columns: 1fr; } }

.ais-feat-col { display: flex; flex-direction: column; }
.ais-feat-footer { display: flex; justify-content: flex-end; }

/* Usage bars */
.ais-usage-list { display: flex; flex-direction: column; gap: 16px; }

.ais-usage-row {
    background: #1a1f2e;
    border: 1px solid #2d3548;
    border-radius: 8px;
    padding: 14px 18px;
}
.ais-usage-meta {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.ais-usage-name   { font-size: 14px; font-weight: 600; color: #e8eaf0; }
.ais-usage-counts { font-size: 12px; color: #adb5bd; flex: 1; }
.ais-usage-pct    { font-size: 13px; color: #e8eaf0; font-weight: 600; min-width: 40px; text-align: right; }

.ais-usage-bar-track {
    height: 8px;
    border-radius: 4px;
    background: #2d3548;
    overflow: hidden;
}
.ais-usage-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Approvals sub-tab row */
.ais-sub-tab-row { display: flex; gap: 8px; margin-bottom: 12px; }

.ais-sub-tab-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #1e2130;
    color: #adb5bd;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
.ais-sub-tab-btn:hover { background: #2d3548; color: #e8eaf0; }
.ais-sub-tab-active { background: #e8734a !important; border-color: #e8734a !important; color: #fff !important; }

/* ── Light theme overrides ─────────────────────────────────────────────────── */
body[data-theme="light"] .ais-refresh-btn   { background: #f8f9fa; color: #495057; border-color: #dee2e6; }
body[data-theme="light"] .ais-tab-btn       { background: #f8f9fa; color: #495057; border-color: #dee2e6; }
body[data-theme="light"] .ais-tab-btn:hover { background: #e9ecef; }
body[data-theme="light"] .ais-table th      { background: #f8f9fa; color: #495057; border-color: #dee2e6; }
body[data-theme="light"] .ais-table td      { color: #212529; border-color: #e9ecef; }
body[data-theme="light"] .ais-table tr:hover td { background: #f8f9fa; }
body[data-theme="light"] .ais-key-mask      { color: #adb5bd; }
body[data-theme="light"] .ais-row-btn       { background: #fff; border-color: #dee2e6; color: #495057; }
body[data-theme="light"] .ais-row-btn:hover { background: #f8f9fa; }
body[data-theme="light"] .ais-form-card     { background: #fff; border-color: #dee2e6; }
body[data-theme="light"] .ais-form-title    { color: #212529; }
body[data-theme="light"] .ais-input         { background: #fff; border-color: #dee2e6; color: #212529; }
body[data-theme="light"] .ais-feat-card     { background: #fff; border-color: #dee2e6; }
body[data-theme="light"] .ais-feat-name     { color: #212529; }
body[data-theme="light"] .ais-feat-key-badge { background: #f8f9fa; border-color: #dee2e6; color: #6c757d; }
body[data-theme="light"] .ais-usage-row     { background: #fff; border-color: #dee2e6; }
body[data-theme="light"] .ais-usage-name    { color: #212529; }
body[data-theme="light"] .ais-usage-pct     { color: #212529; }
body[data-theme="light"] .ais-usage-bar-track { background: #e9ecef; }
body[data-theme="light"] .ais-status-bar    { color: #6c757d; }
body[data-theme="light"] .ais-sub-tab-btn       { background: #f8f9fa; color: #495057; border-color: #dee2e6; }
body[data-theme="light"] .ais-sub-tab-btn:hover { background: #e9ecef; }

/* ── FEAT-095: Users & Channels ─────────────────────────────────────────────── */
.ais-active-cell { font-size: 12px; }

.ais-link-code-box {
    min-height: 28px;
    margin-top: 8px;
}
.ais-link-code-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ais-link-code-label { font-size: 12px; color: #adb5bd; }
.ais-link-code-value {
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    color: #4a9eff;
    background: #1a1f2e;
    border: 1px solid #3a4060;
    border-radius: 4px;
    padding: 3px 10px;
    letter-spacing: 2px;
    user-select: all;
}

.ais-dropdown-sm { min-width: 160px; }
.ais-add-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }

body[data-theme="light"] .ais-link-code-value {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #2c6dcd;
}
