/**
 * Afagu TV — design system (paridade com php-app)
 * Tokens, ui-*, Select2 light + brand #0070c8
 */
:root {
    --bg-page: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-2: #f8fafc;
    --bg-surface-3: #f1f5f9;
    --border-base: #e2e8f0;
    --border-strong: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --brand: #0070c8;
    --brand-dark: #005aa3;
    --brand-light: rgba(0, 112, 200, 0.10);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.95); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background-color: var(--brand);
    color: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(0, 112, 200, 0.2);
}
.btn-primary:hover { background-color: var(--brand-dark); }

.btn-secondary {
    background-color: var(--bg-surface);
    border-color: var(--border-base);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background-color: var(--bg-surface-3);
    color: var(--text-primary);
}

.btn-danger { background-color: #dc2626; color: #ffffff; }
.btn-danger:hover { background-color: #b91c1c; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background-color: var(--bg-surface-3); color: var(--text-primary); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; border-radius: 0.5rem; }

.page-head {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
@media (min-width: 640px) {
    .page-head {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }
}

.page-title {
    font-size: 1.875rem;
    line-height: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.page-sub {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.alert-ok {
    border-radius: 0.75rem;
    background-color: #f0fdf4;
    border: 1px solid #86efac;
    padding: 1rem;
    font-size: 0.875rem;
    color: #166534;
}

.alert-err {
    border-radius: 0.75rem;
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
    padding: 1rem;
    font-size: 0.875rem;
    color: #991b1b;
}

.ui-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-base);
    border-radius: 1rem;
}

.ui-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

.ui-modal-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-base);
    border-radius: 1rem;
    width: 100%;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.ui-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.ui-modal-close:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-3);
}

.ui-input {
    display: block;
    width: 100%;
    border-radius: 0.75rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    padding: 0.625rem 0.875rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ui-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 600;
    border: 1px solid var(--border-base);
    background-color: var(--bg-surface);
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.filter-chip:hover {
    background-color: var(--bg-surface-3);
    border-color: var(--brand);
    color: var(--brand);
}
.filter-chip-active {
    background-color: var(--brand);
    border-color: var(--brand);
    color: #ffffff;
    box-shadow: 0 4px 12px -2px rgba(0, 112, 200, 0.18);
}
.filter-chip-active:hover {
    background-color: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #ffffff;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    font-family: ui-monospace, monospace;
    border: 1px solid var(--border-base);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pagination-btn:hover {
    background: var(--brand-light);
    border-color: rgba(0, 112, 200, 0.30);
    color: var(--brand);
}
.pagination-btn.active {
    background: rgba(0, 112, 200, 0.12);
    border-color: rgba(0, 112, 200, 0.45);
    color: var(--brand);
    font-weight: 700;
}
.pagination-btn.disabled,
.pagination-btn:disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
}

.sidebar-link.active {
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 600;
}
.sidebar-link.active svg { color: var(--brand); }

/* Select2 — light + brand (paridade php-app/header.php) */
.select2-container { width: 100% !important; font-family: 'Inter', system-ui, sans-serif; }
.select2-container--default .select2-selection--single {
    height: 42px;
    border: 1px solid var(--border-strong) !important;
    border-radius: 0.75rem !important;
    background-color: #ffffff !important;
    display: flex;
    align-items: center;
    padding: 0 0.25rem 0 0.35rem;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary) !important;
    line-height: 1.25rem;
    padding-left: 0.65rem;
    font-size: 0.875rem;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-faint) !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 8px;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 1px var(--brand);
}
.select2-dropdown {
    border: 1px solid var(--border-strong) !important;
    border-radius: 0.75rem !important;
    overflow: hidden;
    box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.18);
    z-index: 80;
}
.select2-search--dropdown { padding: 0.5rem; }
.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border-strong) !important;
    border-radius: 0.5rem !important;
    padding: 0.45rem 0.65rem !important;
    font-size: 0.8125rem;
    outline: none !important;
}
.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--brand) !important;
}
.select2-container--default .select2-results__option {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--brand) !important;
    color: #ffffff !important;
}
.select2-container--default .select2-results__option--selected {
    background-color: var(--brand-light) !important;
    color: var(--brand-dark) !important;
}
.select2-results__message { font-size: 0.8125rem; color: var(--text-muted); }

.select2-sm + .select2-container .select2-selection--single,
select.text-xs + .select2-container .select2-selection--single {
    height: 34px;
    border-radius: 0.5rem !important;
}
.select2-sm + .select2-container .select2-selection--single .select2-selection__rendered,
select.text-xs + .select2-container .select2-selection--single .select2-selection__rendered {
    font-size: 0.75rem;
    padding-left: 0.5rem;
}
.select2-sm + .select2-container .select2-selection--single .select2-selection__arrow,
select.text-xs + .select2-container .select2-selection--single .select2-selection__arrow {
    height: 32px;
}

.select2-container--default .select2-selection--multiple {
    min-height: 42px;
    border: 1px solid var(--border-strong) !important;
    border-radius: 0.75rem !important;
    background-color: #ffffff !important;
    padding: 4px 6px;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 1px var(--brand);
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--brand-light) !important;
    border: 1px solid rgba(0, 112, 200, 0.25) !important;
    color: var(--brand-dark) !important;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    padding: 2px 8px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--brand-dark) !important;
    margin-right: 4px;
}
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: var(--text-faint) !important;
}

/* Login */
.login-page {
    min-height: 100%;
    background-color: var(--bg-page);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 112, 200, 0.14), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 112, 200, 0.06), transparent 50%);
}
.login-card {
    box-shadow: 0 4px 24px 0 rgba(15, 23, 42, 0.08), 0 1px 4px rgba(15, 23, 42, 0.05);
}
