/* 
 * Legacy CSS Compatibility Layer
 * Ensures override system works harmoniously with legacy files
 * Load this BEFORE override.css
 */

/* =================================
   LEGACY COMPATIBILITY FIXES
   ================================= */

/* Prevent legacy navbar conflicts */
.navbar.cdta-navbar,
.navbar.gfi-navbar,
.navbar.acme-navbar {
  /* Allow legacy tenant navbars to maintain their colors */
  background-color: inherit !important;
}

/* Legacy DataTables compatibility */
table.dataTable.legacy-table {
  /* Opt-out class for tables that need legacy styling */
  border: inherit !important;
  border-radius: 0 !important;
}

table.dataTable.legacy-table thead {
  background: inherit !important;
}

/* Preserve legacy form styling where needed */
.legacy-form .form-control {
  border-radius: inherit !important;
  border-color: inherit !important;
}

/* Legacy modal compatibility */
.modal.legacy-modal .modal-content {
  border-radius: inherit !important;
}

/* =================================
   TENANT-SPECIFIC OVERRIDES
   ================================= */

/* CDTA Tenant Preservation */
body.cdta-tenant .navbar {
  background-color: #0f2b5b !important;
}

body.cdta-tenant .email-header {
  background-color: #0f2b5b !important;
}

/* ACME Tenant Preservation */
body.acme-tenant .acme-footer {
  background-color: #EEDC94 !important;
}

body.acme-tenant .acme-navbar {
  background-color: #774B14 !important;
  position: fixed !important;
}

/* GFI Tenant Preservation */
body.gfi-tenant .gfi-navbar {
  background-color: #147732 !important;
}

/* =================================
   LEGACY COMPONENT PRESERVATION
   ================================= */

/* Preserve legacy spinner styling */
.loading-animation .spin > * {
  background: #0f2b5b none repeat scroll 0 0 !important;
}

/* Preserve legacy matrix table styling */
.matrix-container {
  /* Keep complex legacy layout intact */
  border: 1px solid #cccccc !important;
  border-radius: 5px !important;
}

/* Preserve legacy roles matrix */
.roles-matrix-panel .nav-pills > li.active > a {
  background-color: #4CA6FF !important;
  border-radius: 0 !important;
}

/* =================================
   MIGRATION HELPERS
   ================================= */

/* Gradual migration class */
.migrated-to-override {
  /* Components that have been migrated can use this class */
  /* to ensure they use override system instead of legacy */
}

/* Legacy fallback class */
.keep-legacy-styling {
  /* Components that must maintain legacy styling */
  /* Override system will not affect these */
}

/* =================================
   DEBUGGING HELPERS
   ================================= */

/* Development mode indicators */
body.dev-mode .legacy-css-active::before {
  content: "🔧 Legacy CSS Active";
  position: fixed;
  top: 0;
  right: 0;
  background: orange;
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  z-index: 9999;
}

body.dev-mode .override-css-active::after {
  content: "✨ Override CSS Active";
  position: fixed;
  top: 20px;
  right: 0;
  background: green;
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  z-index: 9999;
}