/* FINAL, DEFINITIVE STYLING FIX */

/* --- DARK THEME --- */

/* Set the default and hover colors for tables on specific pages */
[data-theme="dark"] .contact-details-page .table,
[data-theme="dark"] .processed-appeals-page .table,
[data-theme="dark"] .pending-breaches-page .table,
[data-theme="dark"] .appeals-page .table,
[data-theme="dark"] .appeal-details-page .table,
[data-theme="dark"] .api-logs-page .table,
[data-theme="dark"] .enforcement-setup-page .table,
[data-theme="dark"] .visitor-parking-page .table,
[data-theme="dark"] .breach-search-results-page .table,
[data-theme="dark"] #appealsTable,
[data-theme="dark"] #paymentDetails .table,
[data-theme="dark"] #permitDetails .table {
    --bs-table-hover-bg: #0d6efd !important; /* Lighter blue for hover */
    --bs-table-color: #ffffff !important;
}

/* Alternating row colors for striped tables in dark theme */
/* Odd rows (1st, 3rd, 5th, etc.) - Lighter blue background */
[data-theme="dark"] .contact-details-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .processed-appeals-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .pending-breaches-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .appeals-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .appeal-details-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .api-logs-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .enforcement-setup-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .visitor-parking-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .breach-search-results-page .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] #appealsTable > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] #paymentDetails .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] #permitDetails .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #303d5d !important;
    color: #ffffff !important;
}

/* Even rows (2nd, 4th, 6th, etc.) - Darker blue background */
[data-theme="dark"] .contact-details-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .processed-appeals-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .pending-breaches-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .appeals-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .appeal-details-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .api-logs-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .enforcement-setup-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .visitor-parking-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .breach-search-results-page .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] #appealsTable > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] #paymentDetails .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] #permitDetails .table-striped > tbody > tr:nth-of-type(even) > td,
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: #252f48 !important;
    color: #ffffff !important;
}

/* Non-striped tables - single color for all rows */
[data-theme="dark"] .table:not(.table-striped) > tbody > tr > td {
    background-color: #303d5d !important;
    color: #ffffff !important;
}

/* Ensure other elements on the page are styled correctly */
[data-theme="dark"] .contact-details-page .card,
[data-theme="dark"] .processed-appeals-page .card,
[data-theme="dark"] .pending-breaches-page .card,
[data-theme="dark"] .appeals-page .card,
[data-theme="dark"] .appeal-details-page .card,
[data-theme="dark"] .api-logs-page .card,
[data-theme="dark"] .enforcement-setup-page .card,
[data-theme="dark"] .visitor-parking-page .card,
[data-theme="dark"] .breach-search-results-page .card {
    background-color: #303d5d !important;
    color: #ffffff !important;
}

[data-theme="dark"] .contact-details-page .card-header,
[data-theme="dark"] .processed-appeals-page .card-header,
[data-theme="dark"] .pending-breaches-page .card-header,
[data-theme="dark"] .appeals-page .card-header,
[data-theme="dark"] .appeal-details-page .card-header,
[data-theme="dark"] .api-logs-page .card-header,
[data-theme="dark"] .enforcement-setup-page .card-header,
[data-theme="dark"] .visitor-parking-page .card-header,
[data-theme="dark"] .breach-search-results-page .card-header {
    background-color: #252f48 !important;
}

[data-theme="dark"] .contact-details-page .form-control,
[data-theme="dark"] .contact-details-page .form-select,
[data-theme="dark"] .processed-appeals-page .form-control,
[data-theme="dark"] .processed-appeals-page .form-select,
[data-theme="dark"] .pending-breaches-page .form-control,
[data-theme="dark"] .pending-breaches-page .form-select,
[data-theme="dark"] .appeals-page .form-control,
[data-theme="dark"] .appeals-page .form-select,
[data-theme="dark"] .appeal-details-page .form-control,
[data-theme="dark"] .appeal-details-page .form-select,
[data-theme="dark"] .api-logs-page .form-control,
[data-theme="dark"] .api-logs-page .form-select,
[data-theme="dark"] .enforcement-setup-page .form-control,
[data-theme="dark"] .enforcement-setup-page .form-select,
[data-theme="dark"] .visitor-parking-page .form-control,
[data-theme="dark"] .visitor-parking-page .form-select,
[data-theme="dark"] .breach-search-results-page .form-control,
[data-theme="dark"] .breach-search-results-page .form-select {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .contact-details-page a,
[data-theme="dark"] .processed-appeals-page a,
[data-theme="dark"] .pending-breaches-page a,
[data-theme="dark"] .appeals-page a,
[data-theme="dark"] .appeal-details-page a,
[data-theme="dark"] .api-logs-page a,
[data-theme="dark"] .enforcement-setup-page a,
[data-theme="dark"] .visitor-parking-page a,
[data-theme="dark"] .breach-search-results-page a {
    color: #8ab4f8;
}

/* Style the table headers for dark theme */
[data-theme="dark"] #appealsTable > thead > tr > th,
[data-theme="dark"] #paymentDetails .table > thead > tr > th,
[data-theme="dark"] #permitDetails .table > thead > tr > th {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

/* Style the pagination controls for dark theme */
[data-theme="dark"] .dataTable-pagination a {
    color: #ffffff !important;
    background-color: #252f48 !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .dataTable-pagination a:hover,
[data-theme="dark"] .dataTable-pagination a.active {
    background-color: #0d6efd !important;
}

/* Style the search and filter inputs for dark theme */
[data-theme="dark"] .dataTable-input,
[data-theme="dark"] .dataTable-selector {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

/* Style the table wrapper */
[data-theme="dark"] .dataTable-wrapper {
    background-color: #303d5d !important;
    color: #ffffff !important;
}

/* Style the payment and permit card headers and bodies */
[data-theme="dark"] .payment-card .card-header {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .payment-card .card-body {
    background-color: #303d5d !important;
    color: #ffffff !important;
}

/* Style the total rows in payment and permit tables */
[data-theme="dark"] #paymentDetails .font-weight-bold td,
[data-theme="dark"] #permitDetails .font-weight-bold td {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

/* Style the payment and permit details modals */
[data-theme="dark"] .modal-content {
    background-color: #303d5d !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .modal-header {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .modal-body {
    background-color: #303d5d !important;
    color: #ffffff !important;
}

[data-theme="dark"] .modal-footer {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

/* Style the tables inside modals */
[data-theme="dark"] .modal-body .table {
    background-color: #303d5d !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .modal-body .table > tbody > tr > td {
    background-color: #303d5d !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .modal-body .table > tbody > tr > th {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .modal-body .table-info,
[data-theme="dark"] .modal-body .additional-fields-header {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

[data-theme="light"] .additional-fields-header {
    background-color: #e9ecef !important;
    color: #212529 !important;
}

/* --- jQuery DataTables Dark Theme Overrides for Breach Search Page --- */

[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_filter,
[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_processing,
[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_paginate {
    color: #ffffff !important;
}

[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #ffffff !important;
    background: #252f48 !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #6c757d !important;
    background: #303d5d !important;
    border-color: #454d55 !important;
}

[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #0d6efd !important;
    border-color: #0d6efd !important;
}

[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #0d6efd !important;
    border-color: #0d6efd !important;
}

[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .breach-search-results-page .dataTables_wrapper .dataTables_filter input {
    background-color: #252f48 !important;
    color: #ffffff !important;
    border-color: #454d55 !important;
}

/* --- LIGHT THEME --- */

/* Ensure light theme is not broken */
[data-theme="light"] .contact-details-page .table,
[data-theme="light"] .processed-appeals-page .table,
[data-theme="light"] .pending-breaches-page .table,
[data-theme="light"] .breach-search-results-page .table {
    --bs-table-bg: #ffffff !important;
    --bs-table-striped-bg: #f9f9f9 !important;
    --bs-table-hover-bg: #f2f2f2 !important;
    --bs-table-color: #212529 !important;
}

