/* 
  Amazon Django - Additional Dark Theme Fixes
  This file adds specific fixes for dark mode in marketplace pages
*/

/* Fix for small text elements */
html[data-theme="dark"] .small,
html[data-theme="dark"] small,
html[data-theme="dark"] .card-body .small,
html[data-theme="dark"] span.small {
  color: var(--text-color) !important;
}

/* Fix for form labels */
html[data-theme="dark"] .form-label,
html[data-theme="dark"] label {
  color: var(--text-color) !important;
}

/* Fix for placeholder text in inputs */
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] select::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.7;
}

/* Fix for form feedback messages */
html[data-theme="dark"] .form-text,
html[data-theme="dark"] .valid-feedback,
html[data-theme="dark"] .invalid-feedback {
  color: var(--text-muted) !important;
}

/* Fix for more edge cases */
html[data-theme="dark"] .description,
html[data-theme="dark"] .help-text,
html[data-theme="dark"] .text-description {
  color: var(--text-color) !important;
}

/* Fix for inventory history sections */
html[data-theme="dark"] .inventory-history,
html[data-theme="dark"] .inventory-history .small {
  color: var(--text-color) !important;
}

/* Additional fixes for various text elements */
html[data-theme="dark"] .card a,
html[data-theme="dark"] .card button,
html[data-theme="dark"] .card span,
html[data-theme="dark"] .card div {
  color: inherit;
}

/* Ensure all text content in these specific sections is visible */
html[data-theme="dark"] .d-flex .small,
html[data-theme="dark"] .d-flex span.small,
html[data-theme="dark"] .d-flex p,
html[data-theme="dark"] .justify-content-between .small,
html[data-theme="dark"] .align-items-center .small {
  color: var(--text-color) !important;
}

/* Force proper coloring for any status and info panels */
html[data-theme="dark"] .card .card-text,
html[data-theme="dark"] .info-box,
html[data-theme="dark"] .status-box {
  color: var(--text-color) !important;
}

/* Fix for input groups */
html[data-theme="dark"] .input-group-text {
  background-color: var(--dropdown-link-hover);
  border-color: var(--input-border);
  color: var(--text-color);
}

/* Fix for disabled inputs and read-only inputs */
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] input[readonly],
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled {
  background-color: var(--dropdown-link-hover);
  color: var(--text-muted);
}

/* Product detail page specific fixes */
html[data-theme="dark"] .drop-zone-prompt {
  color: #e0e0e0 !important;
}

html[data-theme="dark"] #upload-image-button {
  color: #e0e0e0 !important;
}

html[data-theme="dark"] #toggle-edit-mode {
  color: #e0e0e0 !important;
}

html[data-theme="dark"] .btn-outline-danger {
  color: #dc3545 !important;
}

html[data-theme="dark"] .btn-outline-danger:hover {
  color: #fff !important;
  background-color: #dc3545 !important;
}

/* Inventory detail page specific fixes */
html[data-theme="dark"] .card-header.bg-light h5 {
  color: var(--text-color) !important;
}

html[data-theme="dark"] .card-header.bg-light {
  background-color: var(--card-header-bg) !important;
}

html[data-theme="dark"] .card-body .row .fw-bold,
html[data-theme="dark"] .card-body .row div:not(.fw-bold) {
  color: var(--text-color) !important;
}

/* Bundle detail page specific fixes */
html[data-theme="dark"] .list-group-item {
  background-color: var(--card-background) !important;
  border-color: var(--border-color) !important;
  color: var(--text-color) !important;
}

html[data-theme="dark"] .list-group-item .text-muted {
  color: var(--text-muted) !important;
}

/* Profile page specific fixes */
html[data-theme="dark"] .btn-outline-primary {
  color: #4da3ff !important;
}

html[data-theme="dark"] .btn-outline-primary:hover {
  color: #000 !important;
  background-color: #4da3ff !important;
}

/* Amazon orders page specific fixes */
html[data-theme="dark"] .btn-outline-secondary {
  color: #e0e0e0 !important;
}

html[data-theme="dark"] .btn-outline-secondary:hover {
  color: #000 !important;
  background-color: #6c757d !important;
}

/* Fix for bg-warning text readability in dark mode */
html[data-theme="dark"] .bg-warning,
html[data-theme="dark"] .badge.bg-warning,
html[data-theme="dark"] .btn.bg-warning,
html[data-theme="dark"] .alert-warning {
  color: #000 !important; /* Change text color to black for better contrast */
}

html[data-theme="dark"] .bg-warning.text-dark {
  color: #000 !important; /* Ensure text-dark still works with bg-warning */
}

html[data-theme="dark"] .badge.bg-warning {
  background-color: #ffc107 !important; /* Ensure consistent warning color */
}

/* Attribute edit page specific fixes */
html[data-theme="dark"] .title-preview {
  background-color: var(--card-background) !important;
  border-color: var(--border-color) !important;
  color: var(--text-color) !important;
}

html[data-theme="dark"] .card-body strong,
html[data-theme="dark"] .card-body p,
html[data-theme="dark"] .card-body li,
html[data-theme="dark"] .card-body ol {
  color: var(--text-color) !important;
}

/* Fix for text values in Current Information box */
html[data-theme="dark"] .card-body div.mb-3 {
  color: var(--text-color) !important;
}

/* Fix for headings in cards */
html[data-theme="dark"] .card-body h1,
html[data-theme="dark"] .card-body h2,
html[data-theme="dark"] .card-body h3,
html[data-theme="dark"] .card-body h4,
html[data-theme="dark"] .card-body h5,
html[data-theme="dark"] .card-body h6 {
  color: var(--text-color) !important;
}

/* Fix for definition lists in reference file create page */
html[data-theme="dark"] .card-body dl dt,
html[data-theme="dark"] .card-body dl dd {
  color: var(--text-color) !important;
}

html[data-theme="dark"] .card-body dl dd {
  margin-bottom: 1rem;
}

html[data-theme="dark"] .select2-container .select2-selection--single,
html[data-theme="dark"] .select2-container .select2-selection--multiple {
  background-color: var(--input-background) !important;
  border-color: var(--input-border) !important;
  color: var(--text-color) !important;
}

html[data-theme="dark"] .select2-container .select2-selection__rendered {
  color: var(--text-color) !important;
}

html[data-theme="dark"] .select2-dropdown {
  background-color: var(--dropdown-background) !important;
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] .select2-results__option {
  color: var(--text-color) !important;
}

html[data-theme="dark"] .select2-results__option--highlighted {
  background-color: var(--dropdown-link-hover) !important;
}

/* Fix for dropdown menus in dark mode */
html[data-theme="dark"] .dropdown-menu {
  background-color: var(--card-background) !important;
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] .dropdown-menu .dropdown-item {
  color: var(--text-color) !important;
}

html[data-theme="dark"] .dropdown-menu .dropdown-item:hover,
html[data-theme="dark"] .dropdown-menu .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
}

html[data-theme="dark"] .dropdown-menu .dropdown-divider {
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] button.btn-outline-secondary {
  color: #f8f9fa !important;
  border-color: #6c757d !important;
}

html[data-theme="dark"] button.btn-outline-secondary:hover {
  background-color: #6c757d !important;
  color: #fff !important;
}

/* Fix for striped tables in dark mode - make stripes and hover more visible */
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--text-color) !important;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: rgba(0, 0, 0, 0.1) !important;
  color: var(--text-color) !important;
}

html[data-theme="dark"] .table-hover > tbody > tr:hover > * {
  background-color: rgba(255, 255, 255, 0.15) !important;
  color: var(--text-color) !important;
}

/* Fix specifically for the inventory history table */
html[data-theme="dark"] .inventory-history-table > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .inventory-history-table > tbody > tr:nth-of-type(even) > * {
  background-color: rgba(0, 0, 0, 0.15) !important;
}

html[data-theme="dark"] .inventory-history-table > tbody > tr:hover > * {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Improved styling for inventory history table in dark mode */
html[data-theme="dark"] .table.table-striped.table-hover {
  border-collapse: collapse;
  border: 1px solid var(--border-color);
}

html[data-theme="dark"] .table.table-striped.table-hover thead tr th {
  background-color: var(--card-header-bg) !important;
  color: var(--text-color) !important;
  border-bottom: 2px solid var(--border-color);
  padding: 0.75rem;
}

html[data-theme="dark"] .table.table-striped.table-hover tbody tr:nth-of-type(odd) > * {
  background-color: rgba(60, 60, 60, 0.5) !important;
  color: var(--text-color) !important;
}

html[data-theme="dark"] .table.table-striped.table-hover tbody tr:nth-of-type(even) > * {
  background-color: rgba(40, 40, 40, 0.5) !important;
  color: var(--text-color) !important;
}

html[data-theme="dark"] .table.table-striped.table-hover tbody tr:hover > * {
  background-color: rgba(80, 80, 80, 0.7) !important;
  color: var(--text-color) !important;
}

/* Custom out-of-stock styling for both light and dark modes */
tr.out-of-stock > td {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: inherit !important;
}

html[data-theme="dark"] tr.out-of-stock > td {
  background-color: rgba(220, 53, 69, 0.2) !important;
  color: var(--text-color) !important;
}

html[data-theme="dark"] .table-striped tbody tr.out-of-stock:nth-of-type(odd) > td {
  background-color: rgba(220, 53, 69, 0.25) !important; 
}

html[data-theme="dark"] .table-striped tbody tr.out-of-stock:nth-of-type(even) > td {
  background-color: rgba(220, 53, 69, 0.2) !important;
}

html[data-theme="dark"] .table-hover tbody tr.out-of-stock:hover > td {
  background-color: rgba(220, 53, 69, 0.3) !important;
}

/* General improvements for standard striped table in dark mode */
html[data-theme="dark"] .table.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="dark"] .table.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: var(--card-background) !important;
}

html[data-theme="dark"] .table.table-hover > tbody > tr:hover > * {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* CSV Import Review page fixes for dark mode */
html[data-theme="dark"] .batch-controls {
  background-color: var(--card-background) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color);
}

html[data-theme="dark"] .batch-controls .form-label,
html[data-theme="dark"] .batch-controls .form-check-label {
  color: var(--text-color) !important;
}

html[data-theme="dark"] .multiplier-input + small.text-muted {
  color: var(--text-muted) !important;
}

html[data-theme="dark"] .input-group-text .text-info {
  color: #8ecdf7 !important; /* Lighter blue for better contrast in dark mode */
}

/* Fix for multiplier badge */
html[data-theme="dark"] .multiplier-badge {
  background-color: rgba(0, 131, 143, 0.3) !important;
  color: #4dd0e1 !important;
  border: 1px solid #00838f !important;
}
