/* ========================================
   GLOBAL CONTRAST OVERRIDES
   Fixes visibility issues across entire app
   ======================================== */

/* ========================================
   SIDEBAR / NAVIGATION MENU
   ======================================== */

/* Force sidebar menu items to be visible */
.sidebar,
.sidebar *,
.nav-menu,
.nav-menu *,
.nav-item,
.nav-item *,
.nav-text,
.nav-section-title,
.nav-brand,
.brand-title,
.brand-subtitle,
.nav-footer,
.nav-footer * {
    color: rgba(255, 255, 255, 0.95) !important;
    opacity: 1 !important;
}

/* Active nav items */
.nav-item.active,
.nav-item.active * {
    color: white !important;
}

/* Hover state */
.nav-item:hover,
.nav-item:hover * {
    color: white !important;
}

/* Nav section titles */
.nav-section-title {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* ========================================
   TABLES - Member List & All Tables
   ======================================== */

/* Force table backgrounds to be DARK */
table,
.table,
.members-table-card,
.table-responsive {
    background: var(--bg-secondary, #1e293b) !important;
}

/* Table headers - dark background with bright text */
table thead,
.table thead,
table thead th,
.table thead th {
    background: var(--bg-tertiary, #334155) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-color: var(--border-color, #334155) !important;
}

/* Table body - dark background */
table tbody,
.table tbody {
    background: var(--bg-secondary, #1e293b) !important;
}

/* Table rows - dark background */
table tbody tr,
.table tbody tr {
    background: var(--bg-secondary, #1e293b) !important;
    border-color: var(--border-color, #334155) !important;
    opacity: 1 !important;
    filter: none !important;
}

/* Table rows hover - slightly lighter dark */
table tbody tr:hover,
.table tbody tr:hover {
    background: var(--bg-tertiary, #334155) !important;
}

/* Table cells - dark background with bright text */
table tbody td,
.table tbody td {
    background: transparent !important;
    color: #f1f5f9 !important;
    border-color: var(--border-color, #334155) !important;
}

/* Force table text to be highly visible */
table,
table *,
.table,
.table *,
.table th,
.table td,
.table thead,
.table tbody,
.table tr {
    color: #f1f5f9 !important;
    opacity: 1 !important;
}

/* Table cells - ensure content is visible */
.member-name,
.member-email,
.member-cell,
.member-info,
.member-info * {
    color: #f1f5f9 !important;
}

/* ========================================
   PAGE HEADERS & TITLES
   ======================================== */

.page-header,
.page-header *,
.page-title,
.page-subtitle,
h1,
h2,
h3,
h4,
h5,
h6 {
    color: #f1f5f9 !important;
    opacity: 1 !important;
}

/* ========================================
   CARDS & CONTENT AREAS
   ======================================== */

/* All cards - dark background */
.card,
.stat-card,
.filter-card,
.filters-card,
.members-table-card,
.members-cards,
.member-card,
.schedule-card,
.empty-state-card {
    background: var(--bg-secondary, #1e293b) !important;
    border-color: var(--border-color, #334155) !important;
}

/* Card headers - slightly lighter dark */
.card-header {
    background: var(--bg-tertiary, #334155) !important;
    border-color: var(--border-color, #334155) !important;
    color: #ffffff !important;
}

/* Card body - dark background */
.card-body {
    background: var(--bg-secondary, #1e293b) !important;
    color: #f1f5f9 !important;
}

/* Card footer - slightly lighter dark */
.card-footer {
    background: var(--bg-tertiary, #334155) !important;
    border-color: var(--border-color, #334155) !important;
}

/* All card content text */
.card *,
.card-body *,
.card-header * {
    color: #f1f5f9 !important;
}

/* Member cards (mobile) */
.member-card {
    background: var(--bg-secondary, #1e293b) !important;
    border: 1px solid var(--border-color, #334155) !important;
}

.member-card-header {
    background: transparent !important;
}

.member-card-details {
    background: transparent !important;
}

.member-card-actions {
    background: transparent !important;
    border-top: 1px solid var(--border-color, #334155) !important;
}

/* ========================================
   FORMS
   ======================================== */

/* Form inputs - dark background */
.form-control,
.form-select,
input,
textarea,
select {
    background: var(--bg-tertiary, #334155) !important;
    color: #f1f5f9 !important;
    border-color: var(--border-color, #334155) !important;
}

.form-control:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
    background: var(--bg-secondary, #1e293b) !important;
    color: #f1f5f9 !important;
    border-color: var(--primary-color, #8b5cf6) !important;
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.6) !important;
}

/* Form labels */
.form-label,
label {
    color: #f1f5f9 !important;
}

/* Form groups and sections */
.mb-3,
.form-group {
    color: #f1f5f9 !important;
}

/* ========================================
   FORM SWITCHES & CHECKBOXES
   ======================================== */

/* Switch toggle (Membro ativo) - dark background */
.form-check-input,
.form-switch .form-check-input {
    background-color: var(--bg-tertiary, #334155) !important;
    border: 2px solid var(--border-light, #475569) !important;
    cursor: pointer !important;
}

/* Switch when checked (active) - purple/primary */
.form-check-input:checked,
.form-switch .form-check-input:checked {
    background-color: var(--primary-color, #8b5cf6) !important;
    border-color: var(--primary-color, #8b5cf6) !important;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5) !important;
}

/* Switch focus state */
.form-check-input:focus,
.form-switch .form-check-input:focus {
    border-color: var(--primary-color, #8b5cf6) !important;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.25) !important;
    outline: none !important;
}

/* Switch label */
.form-check-label,
.form-switch .form-check-label {
    color: #f1f5f9 !important;
    cursor: pointer !important;
    user-select: none !important;
}

/* Switch container */
.form-check,
.form-switch {
    padding-left: 2.5em !important;
}

/* ========================================
   BADGES & STATUS
   ======================================== */

.badge,
.badge-instrument,
.badge-primary-role {
    background: rgba(139, 92, 246, 0.15) !important;
    color: #a78bfa !important;
    border: none !important;
    font-weight: 500 !important;
}

.status-badge,
.contact-phone {
    color: #f1f5f9 !important;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn,
.btn-primary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-dark {
    color: white !important;
}

.btn-outline-secondary,
.btn-outline-dark {
    border-color: rgba(148, 163, 184, 0.4) !important;
}

/* ========================================
   LINKS
   ======================================== */

a {
    color: #a78bfa !important;
}

a:hover {
    color: #c4b5fd !important;
}

/* ========================================
   MODALS & DROPDOWNS
   ======================================== */

/* Modals - dark background */
.modal-content {
    background: var(--bg-secondary, #1e293b) !important;
    border-color: var(--border-color, #334155) !important;
}

.modal-header {
    background: var(--bg-tertiary, #334155) !important;
    border-color: var(--border-color, #334155) !important;
    color: #ffffff !important;
}

.modal-body {
    background: var(--bg-secondary, #1e293b) !important;
    color: #f1f5f9 !important;
}

.modal-footer {
    background: var(--bg-tertiary, #334155) !important;
    border-color: var(--border-color, #334155) !important;
}

.modal-title {
    color: #ffffff !important;
}

/* Dropdowns - dark background */
.dropdown-menu {
    background: var(--bg-secondary, #1e293b) !important;
    border-color: var(--border-color, #334155) !important;
}

.dropdown-item {
    color: #f1f5f9 !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--bg-tertiary, #334155) !important;
    color: #ffffff !important;
}

.dropdown-divider {
    border-color: var(--border-color, #334155) !important;
}

/* ========================================
   LISTS & LIST GROUPS
   ======================================== */

.list-group {
    background: var(--bg-secondary, #1e293b) !important;
}

.list-group-item {
    background: var(--bg-secondary, #1e293b) !important;
    border-color: var(--border-color, #334155) !important;
    color: #f1f5f9 !important;
}

.list-group-item:hover {
    background: var(--bg-tertiary, #334155) !important;
}

/* ========================================
   ALERTS & NOTIFICATIONS
   ======================================== */

.alert {
    background: var(--bg-secondary, #1e293b) !important;
    border-color: var(--border-color, #334155) !important;
    color: #f1f5f9 !important;
}

.alert-info {
    background: rgba(6, 182, 212, 0.15) !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
    color: #22d3ee !important;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fbbf24 !important;
}

.alert-danger {
    background: rgba(244, 63, 94, 0.15) !important;
    border-color: rgba(244, 63, 94, 0.3) !important;
    color: #fb7185 !important;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    color: #4ade80 !important;
}

/* Toast notifications */
.toast-notification {
    background: var(--bg-secondary, #1e293b) !important;
    border: 1px solid var(--border-color, #334155) !important;
    color: #f1f5f9 !important;
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state {
    color: #f1f5f9 !important;
}

.empty-state-title {
    color: #ffffff !important;
}

.empty-state-description {
    color: #94a3b8 !important;
}

/* ========================================
   MUTED TEXT
   ======================================== */

.text-muted,
.muted,
.text-secondary {
    color: #94a3b8 !important;
    opacity: 1 !important;
}

/* ========================================
   MEMBER CARDS (Mobile)
   ======================================== */

.member-card,
.member-card *,
.member-card-name,
.member-card-info,
.member-card-details {
    color: #f1f5f9 !important;
}

.member-card-roles .badge {
    color: #a78bfa !important;
    background: rgba(139, 92, 246, 0.15) !important;
}

/* ========================================
   INACTIVE ITEMS
   ======================================== */

.inactive,
.member-inactive {
    opacity: 0.7 !important;
}

/* ========================================
   GLOBAL SAFETY RULES
   ======================================== */

/* Override any inline opacity styles that make text invisible */
body *:not(.spinner):not(.loading):not(.fade) {
    opacity: 1 !important;
}

/* Ensure all text is readable */
div,
span,
p,
td,
th,
li,
label,
a,
button {
    color: inherit;
}

/* ========================================
   MEMBERS SELECTION GRID (Schedules modal)
   Ensure items use dark backgrounds and clear selected state
   ======================================== */

.members-selection-grid {
    background: transparent !important;
    gap: 0.5rem !important;
    max-height: 320px !important;
    overflow-y: auto !important;
    padding: 0.5rem !important;
}

.member-selection-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.625rem !important;
    padding: 0.625rem !important;
    background: var(--bg-secondary, #1e293b) !important;
    border: 1.5px solid var(--border-color, #334155) !important;
    border-radius: var(--radius, 0.5rem) !important;
    cursor: pointer !important;
    transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease !important;
    position: relative !important;
    color: #f1f5f9 !important;
}

.member-selection-item:hover {
    border-color: var(--primary-color, #8b5cf6) !important;
    background: var(--bg-tertiary, #334155) !important;
}

.member-selection-item.selected {
    border-color: var(--primary-color, #8b5cf6) !important;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.04), transparent) !important;
    box-shadow: 0 2px 8px rgba(2, 6, 23, 0.6) inset !important;
}

.member-selection-item input {
    display: none !important;
}

.member-avatar-sm {
    width: 2rem !important;
    height: 2rem !important;
    border-radius: 50% !important;
    background: var(--primary-gradient, linear-gradient(90deg, #8b5cf6, #7c3aed)) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    flex-shrink: 0 !important;
}

.member-selection-info {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.member-selection-name {
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    color: #f1f5f9 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.member-selection-instrument {
    font-size: 0.75rem !important;
    color: #94a3b8 !important;
}

.check-icon {
    display: none !important;
    color: var(--primary-color, #8b5cf6) !important;
    font-size: 1.125rem !important;
    flex-shrink: 0 !important;
}

.member-selection-item.selected .check-icon {
    display: block !important;
}

.member-selection-item:focus-within {
    outline: 2px solid rgba(139, 92, 246, 0.12) !important;
    outline-offset: 2px !important;
}