/**
 * Text Contrast Fixes
 * Ensures all text is readable on light backgrounds
 * Fixes white text on light backgrounds across all interfaces
 */

/* ========================================
   MODAL & POP-UP FIXES
   ======================================== */

/* All modals and pop-ups */
.modal,
.popup,
.dialog,
.alert,
.notification,
.toast,
.message-box {
  color: #333 !important;
}

.modal-content,
.popup-content,
.dialog-content {
  color: #333 !important;
}

.modal-title,
.popup-title,
.dialog-title {
  color: #212121 !important;
}

.modal-body,
.popup-body,
.dialog-body {
  color: #424242 !important;
}

/* Modal text elements */
.modal p,
.modal span,
.modal label,
.popup p,
.popup span,
.popup label {
  color: #333 !important;
}

/* ========================================
   FORM ELEMENTS ON LIGHT BACKGROUNDS
   ======================================== */

/* Form labels on light backgrounds */
.form-group label,
.input-label,
form label {
  color: #333 !important;
}

/* Input placeholders */
input::placeholder,
textarea::placeholder,
select::placeholder {
  color: #757575 !important;
}

/* Form helper text */
.form-help,
.help-text,
.form-hint {
  color: #616161 !important;
}

/* ========================================
   CARD & PANEL TEXT
   ======================================== */

/* Cards with light backgrounds */
.card:not([class*="gradient"]):not([class*="primary"]):not([class*="accent"]) {
  color: #333 !important;
}

.card-body,
.card-content {
  color: #424242 !important;
}

.card-title:not(.dashboard-welcome .card-title) {
  color: #212121 !important;
}

.card-text {
  color: #616161 !important;
}

/* ========================================
   TABLE FIXES
   ======================================== */

/* Table body text */
table tbody td {
  color: #333 !important;
}

/* Table headers - dark text for light backgrounds */
table thead th {
  color: #333 !important;
}

/* ========================================
   BUTTON TEXT FIXES
   ======================================== */

/* Secondary and outline buttons */
.btn-secondary,
.btn-outline,
.btn-light {
  color: #333 !important;
}

.btn-secondary:hover,
.btn-outline:hover {
  color: #fff !important;
}

/* ========================================
   SPECIFIC INTERFACE FIXES
   ======================================== */

/* Admin Interface */
.admin-interface .card:not([class*="gradient"]) .card-title {
  color: #212121 !important;
}

.admin-interface .form-label {
  color: #333 !important;
}

.admin-interface .input-group-text {
  color: #333 !important;
}

/* Settings panels */
.settings-panel,
.profile-panel {
  color: #333 !important;
}

.settings-panel label,
.profile-panel label {
  color: #333 !important;
}

/* System tab */
.system-settings,
.system-config {
  color: #333 !important;
}

.system-settings label,
.system-config label {
  color: #333 !important;
}

/* ========================================
   DROPDOWN & SELECT FIXES
   ======================================== */

/* Dropdown menus */
.dropdown-menu {
  color: #333 !important;
}

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

.dropdown-item:hover {
  color: #fff !important;
  background-color: var(--primary-color, #673AB7);
}

/* Select elements */
select option {
  color: #333 !important;
  background: white !important;
}

/* ========================================
   LIST & MENU FIXES
   ======================================== */

/* List items on light backgrounds */
.list-group-item {
  color: #333 !important;
}

.list-item {
  color: #333 !important;
}

/* Menu items */
.menu-item:not(.active) {
  color: #333 !important;
}

/* ========================================
   NOTIFICATION & ALERT FIXES
   ======================================== */

/* Success alerts */
.alert-success {
  color: #1B5E20 !important;
  background-color: #E8F5E9 !important;
}

/* Info alerts */
.alert-info {
  color: #01579B !important;
  background-color: #E1F5FE !important;
}

/* Warning alerts */
.alert-warning {
  color: #E65100 !important;
  background-color: #FFF3E0 !important;
}

/* Error alerts */
.alert-error,
.alert-danger {
  color: #B71C1C !important;
  background-color: #FFEBEE !important;
}

/* Toast notifications */
.toast {
  color: #333 !important;
}

.toast-success {
  color: #1B5E20 !important;
  background-color: #E8F5E9 !important;
}

.toast-error {
  color: #B71C1C !important;
  background-color: #FFEBEE !important;
}

/* ========================================
   BADGE & TAG FIXES
   ======================================== */

/* Badges on light backgrounds */
.badge-light,
.badge-secondary {
  color: #333 !important;
  background-color: #E0E0E0 !important;
}

/* Tags */
.tag:not([class*="primary"]):not([class*="accent"]) {
  color: #333 !important;
}

/* ========================================
   TAB & NAVIGATION FIXES
   ======================================== */

/* Tabs */
.tab:not(.active) {
  color: #333 !important;
}

.tab-content {
  color: #333 !important;
}

/* Breadcrumbs */
.breadcrumb-item:not(.active) {
  color: #616161 !important;
}

/* ========================================
   SPECIFIC COMPONENT FIXES
   ======================================== */

/* User profile sections */
.profile-info,
.user-details {
  color: #333 !important;
}

.profile-info label,
.user-details label {
  color: #616161 !important;
}

/* Settings sections */
.setting-item {
  color: #333 !important;
}

.setting-item label {
  color: #333 !important;
}

.setting-description {
  color: #757575 !important;
}

/* Dashboard stats on light backgrounds */
.stat-card:not([class*="gradient"]) {
  color: #333 !important;
}

.stat-card:not([class*="gradient"]) h4,
.stat-card:not([class*="gradient"]) .stat-title {
  color: #333 !important;
}

.stat-value {
  color: #212121 !important;
}

.stat-label {
  color: #616161 !important;
}

/* Fix stat-change and stat-trend text visibility */
.stat-change,
.stat-trend {
  color: #4CAF50 !important; /* Green for positive */
  font-weight: 500 !important;
}

.stat-change.negative {
  color: #F44336 !important; /* Red for negative */
}

/* Fix light text in stat cards */
.stat-card .stat-content p:not(.stat-value) {
  color: #616161 !important;
}

/* ========================================
   OWNER INTERFACE SPECIFIC
   ======================================== */

/* Add user/restaurant forms */
.add-user-form,
.add-restaurant-form {
  color: #333 !important;
}

.add-user-form label,
.add-restaurant-form label {
  color: #333 !important;
}

/* Staff management */
.staff-list,
.staff-item {
  color: #333 !important;
}

.staff-card {
  color: #333 !important;
}

.staff-card .staff-name {
  color: #212121 !important;
}

.staff-card .staff-role,
.staff-card .staff-status,
.staff-card .staff-info {
  color: #616161 !important;
}

/* Staff card text overflow fix */
.staff-card {
  overflow: hidden;
}

.staff-card .staff-name,
.staff-card .staff-email {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ========================================
   MANAGER INTERFACE SPECIFIC
   ======================================== */

/* Schedule view */
.schedule-grid:not(.header) {
  color: #333 !important;
}

.schedule-cell:not(.header) {
  color: #333 !important;
}

/* Operations section text fixes */
.operations-content,
.operations-stats {
  color: #333 !important;
}

.operations-content label,
.operations-stats label {
  color: #333 !important;
}

/* Alert and notification text in manager dashboard */
.manager-interface .alert-item,
.manager-interface .notification-item {
  color: #333 !important;
}

/* Task list */
.task-item {
  color: #333 !important;
}

.task-description {
  color: #616161 !important;
}

/* ========================================
   CUSTOMER INTERFACE SPECIFIC
   ======================================== */

/* Restaurant cards */
.restaurant-card {
  color: #333 !important;
}

.restaurant-name {
  color: #212121 !important;
}

.restaurant-info {
  color: #616161 !important;
}

/* Review forms */
.review-form {
  color: #333 !important;
}

.review-form label {
  color: #333 !important;
}

/* ========================================
   WAITER INTERFACE SPECIFIC
   ======================================== */

/* Table status */
.table-status:not(.occupied):not(.reserved) {
  color: #333 !important;
}

/* Order items */
.order-item {
  color: #333 !important;
}

.order-details {
  color: #616161 !important;
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Ensure minimum contrast ratio (WCAG AA) */
.text-muted {
  color: #616161 !important;
}

.text-secondary {
  color: #757575 !important;
}

/* Fix specific dashboard text contrast issues */
.dashboard-content p,
.dashboard-content span:not(.badge):not(.stat-value) {
  color: #424242 !important;
}

/* Fix header actions text */
.header-actions .quick-actions button {
  color: #333 !important;
}

.header-actions .quick-actions button:hover {
  color: #212121 !important;
}

/* Fix empty state text */
.empty-state p {
  color: #616161 !important;
}

/* Fix hint text visibility */
.hint-text,
.help-text {
  color: #757575 !important;
}

/* Focus states */
*:focus {
  outline: 2px solid #673AB7 !important;
  outline-offset: 2px !important;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  * {
    color: #000 !important;
    background: white !important;
  }
}

/* ========================================
   DARK MODE EXCEPTIONS
   ======================================== */

@media (prefers-color-scheme: dark) {
  /* Revert fixes for dark mode */
  body.dark-mode .modal,
  body.dark-mode .popup,
  body.dark-mode .card {
    color: #E0E0E0 !important;
  }
}

/* ========================================
   ADDITIONAL TEXT CONTRAST FIXES (2025-11-26)
   ======================================== */

/* Main content text - ensure dark text */
.main-content,
.dashboard-content,
.content-area,
.tab-content,
main {
  color: #333 !important;
}

/* All paragraph text */
p:not([class*="white"]):not([style*="color: white"]):not([style*="color:#fff"]) {
  color: #424242 !important;
}

/* All span text except badges and status indicators */
span:not(.badge):not(.status):not(.tag):not([class*="white"]):not([style*="color: white"]) {
  color: #424242 !important;
}

/* Input text */
input:not([type="button"]):not([type="submit"]),
textarea,
select {
  color: #333 !important;
}

/* Section headers */
.section-header h2,
.section-header p,
.section-title,
.section-description {
  color: #333 !important;
}

/* Overview sections */
.overview-stats,
.stats-overview,
.quick-stats {
  color: #333 !important;
}

/* Filter groups */
.filter-group label,
.filter-item label,
.filter-controls label {
  color: #333 !important;
}

/* Report and analytics text */
.report-item,
.report-info,
.report-stats,
.analytics-card {
  color: #333 !important;
}

/* Shift and schedule displays */
.shift-status-banner,
.shift-info,
.schedule-info,
#shift-time-display {
  color: #333 !important;
}

/* Notification dropdowns */
.notifications-dropdown .dropdown-content,
.notifications-list,
.notification-message,
.notification-title {
  color: #333 !important;
}

/* User management */
.user-table td,
.user-info,
.user-details p,
.user-email {
  color: #333 !important;
}

/* Restaurant cards and info */
.restaurant-card p,
.restaurant-info p,
.restaurant-details {
  color: #424242 !important;
}

/* Fix any inline white text on cards with light backgrounds */
.card:not([style*="gradient"]):not([style*="background: #"]):not([style*="background:#"]) p,
.card:not([style*="gradient"]):not([style*="background: #"]):not([style*="background:#"]) span:not(.badge) {
  color: #424242 !important;
}

/* Fix stat cards specifically */
.stat-card .stat-content,
.stat-card .stat-label,
.stat-card p {
  color: #616161 !important;
}

.stat-card .stat-value,
.stat-card h3,
.stat-card h4 {
  color: #212121 !important;
}

/* Fix dashboard section titles */
h2, h3, h4, h5 {
  color: #212121 !important;
}

/* Fix light gray text that's hard to read */
[style*="color: #999"],
[style*="color:#999"],
[style*="color: #aaa"],
[style*="color:#aaa"],
[style*="color: #bbb"],
[style*="color:#bbb"],
[style*="color: #ccc"],
[style*="color:#ccc"] {
  color: #616161 !important;
}

/* Fix secondary text that might be too light */
.text-muted,
.text-secondary,
.text-gray,
.text-light {
  color: #616161 !important;
}

/* Performance metrics */
.performance-stats p,
.performance-card p {
  color: #424242 !important;
}

/* Task items */
.task-item p,
.task-card p,
.task-details {
  color: #424242 !important;
}

/* Schedule cells */
.schedule-cell p,
.schedule-item p {
  color: #333 !important;
}

/* Table cells - ensure readable */
td {
  color: #333 !important;
}

/* Fix overview card descriptions */
.overview-stats .stat-card p,
.overview-stats .stat-label {
  color: #616161 !important;
}

/* ========================================
   IMPORTANT OVERRIDES
   ======================================== */

/* Ensure these take precedence */
.light-bg,
.white-bg,
.bg-light,
.bg-white {
  color: #333 !important;
}

.light-bg *:not(.btn):not(.badge),
.white-bg *:not(.btn):not(.badge),
.bg-light *:not(.btn):not(.badge),
.bg-white *:not(.btn):not(.badge) {
  color: #333 !important;
}

/* Preserve gradient text colors */
[class*="gradient"] h1,
[class*="gradient"] h2,
[class*="gradient"] h3,
[class*="gradient"] .card-title {
  color: white !important;
}

/* Preserve primary button colors */
.btn-primary,
.btn-accent,
[class*="primary-btn"],
[class*="accent-btn"] {
  color: white !important;
}

/* Preserve navigation colors - EXPLICIT WHITE TEXT */
.sidebar,
.nav-sidebar,
.sidebar *,
.nav-sidebar *,
.sidebar .nav-link,
.sidebar .nav-link span,
.sidebar .material-icons {
  color: white !important;
}

/* Preserve colored card text */
[style*="background: linear-gradient"] *,
[style*="background:linear-gradient"] *,
[style*="background: #673AB7"] *,
[style*="background:#673AB7"] *,
[style*="background: #9C27B0"] *,
[style*="background:#9C27B0"] *,
[style*="background: #4CAF50"] *,
[style*="background:#4CAF50"] *,
[style*="background: #FF9800"] *,
[style*="background:#FF9800"] *,
[style*="background: #2196F3"] *,
[style*="background:#2196F3"] * {
  color: white !important;
}

/* Preserve badge text on colored backgrounds */
.badge[style*="background"],
.status-badge[style*="background"],
.tag[style*="background"] {
  color: white !important;
}

/* Preserve rating display text */
[style*="background: #4CAF50"][style*="color: white"],
[style*="background:#4CAF50"][style*="color: white"] {
  color: white !important;
}

/* Preserve claim code section white text */
#claim-code-section,
#claim-code-section * {
  color: white !important;
}

/* Preserve connoisseur card white text (customer dashboard) */
.card[style*="gradient"] h3,
.card[style*="gradient"] p,
.card[style*="gradient"] span {
  color: white !important;
}
