/* File: assets/css/deal-display.css (v1.1.35 - Style Grid Title/Price) */

/* Basic Styling for the Deal Scraper Display */

.dsp-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; /* Use WP admin-like font stack */
    border: 1px solid #ccd0d4; /* WP admin border color */
    padding: 15px;
    margin-bottom: 20px;
    background-color: #f6f7f7; /* WP admin background */
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    /* Base text color */
    color: #2c3338;
}

/* Filters */
.dsp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 20px; /* Row gap, Column gap */
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e5e5; /* WP separator color */
}

.dsp-filter-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.dsp-filter-item label {
    font-weight: 600; /* Slightly bolder */
    margin-right: 5px;
    white-space: nowrap;
    color: #2c3338; /* WP text color */
}
.dsp-filter-item input[type="text"] {
    padding: 6px 8px; /* WP input padding */
    border: 1px solid #8c8f94; /* WP input border */
    border-radius: 3px;
    min-width: 220px;
    background-color: #fff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
    font-size: 14px; /* WP input font size */
    color: #2c3338;
}
.dsp-filter-item input[type="checkbox"] {
    margin-right: 3px;
    vertical-align: middle; /* Align checkbox better */
}

.dsp-filter-checkboxes {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dsp-filter-checkboxes > span { /* "Sources:" label */
     font-weight: 600;
     margin-right: 5px;
     color: #2c3338;
}
.dsp-source-label {
    font-weight: normal;
    white-space: nowrap;
    margin-right: 10px;
    cursor: pointer;
    display: inline-flex; /* Align checkbox and text better */
    align-items: center;
    gap: 4px;
    color: #2c3338; /* Ensure default label color */
}


/* Buttons & Spinners */
.dsp-button {
    display: inline-block;
    text-decoration: none;
    font-size: 13px;
    line-height: 2.15384615; /* WP button line height */
    min-height: 30px; /* WP button height */
    margin: 0;
    padding: 0 10px; /* WP button padding */
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
    -webkit-appearance: none;
    border-radius: 3px;
    white-space: nowrap;
    box-sizing: border-box;
    vertical-align: middle;

    /* Primary Button Colors */
    background: #2271b1; /* WP primary blue */
    border-color: #2271b1;
    color: #fff;
    box-shadow: 0 1px 0 #2271b1;
}
.dsp-button:hover, .dsp-button:focus {
    background: #1d6197;
    border-color: #1d6197;
    color: #fff;
    outline: none;
}
.dsp-button:active {
     background: #185380;
     border-color: #185380;
     box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
}

.dsp-button:disabled, .dsp-button[disabled] {
    color: #a7aaad !important;
    border-color: #dcdcde !important;
    background: #f6f7f7 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    cursor: default;
}


.dsp-spinner {
    display: inline-block;
    visibility: hidden; /* Hide by default, show when needed */
    background: url(/wp-admin/images/spinner.gif) no-repeat; /* Use WP spinner */
    background-size: 16px 16px;
    width: 16px;
    height: 16px;
    opacity: .7;
    filter: alpha(opacity=70);
    margin-left: 8px;
    vertical-align: middle;
}
/* Show spinner when sibling button is disabled */
.dsp-button:disabled + .dsp-spinner {
    visibility: visible;
}
/* Spinner for table loading state */
.dsp-table-wrapper.dsp-table-loading::after {
    content: '';
    position: absolute;
    top: 50%; /* Center vertically */
    left: 50%; /* Center horizontally */
    width: 20px; /* Spinner size */
    height: 20px; /* Spinner size */
    margin-top: -10px; /* Offset by half height */
    margin-left: -10px; /* Offset by half width */
    background: url(/wp-admin/images/spinner-2x.gif) no-repeat center center; /* WP Spinner */
    background-size: 20px 20px;
    z-index: 11; /* Ensure spinner is above overlay */
    visibility: visible;
    opacity: 1;
}


.dsp-refresh-status {
     margin-left: 10px;
     font-size: 0.9em;
     vertical-align: middle;
     font-style: italic;
}
.dsp-refresh-status.dsp-success { color: #008000; } /* Green */
.dsp-refresh-status.dsp-error { color: #d63638; } /* WP error red */


/* Debug Controls */
.dsp-debug-controls {
    display: flex; /* Use flex for alignment */
    gap: 10px; /* Space between buttons */
    margin-top: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
    flex-wrap: wrap; /* Allow buttons to wrap */
}

/* Secondary Button Style (for debug toggle and donate) */
.dsp-button-secondary {
    background: #f6f7f7;
    border-color: #dcdcde;
    color: #50575e;
    box-shadow: none;
    /* Ensure size matches primary if needed */
    font-size: 13px;
    line-height: 2.15384615;
    min-height: 30px;
    padding: 0 10px;
}
.dsp-button-secondary:hover, .dsp-button-secondary:focus {
    background: #f0f0f1;
    border-color: #b4b9be;
    color: #1d2327;
}
.dsp-button-secondary:active {
     background: #e8e9ea;
     border-color: #b4b9be;
     box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
}

/* Debug Log Container */
#dsp-debug-log-container {
    border: 1px dashed #ccd0d4;
    padding: 10px 15px;
    margin-top: 10px;
    margin-bottom: 15px;
    background-color: #fff; /* White background for contrast */
    max-height: 400px;
    overflow-y: auto;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
}

#dsp-debug-log-container h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 14px; /* Slightly larger heading */
    font-weight: 600;
    color: #1d2327; /* WP heading color */
}

#dsp-debug-log {
    font-family: monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #3c434a; /* Darker grey for log text */
    white-space: pre-wrap;
    word-wrap: break-word;
}


/* Status Bar */
.dsp-status-bar {
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #50575e; /* WP text secondary color */
    padding: 5px 0;
    overflow: hidden; /* Contain floats */
    line-height: 1.4;
}
#dsp-last-updated {
    color: #7e8993; /* Lighter grey */
    float: right; /* Align to the right */
}


/* Table Styling */
.dsp-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px; /* WP standard table font size */
    background-color: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    border: 1px solid #ccd0d4;
    clear: both;
    transition: opacity 0.2s ease-in-out; /* Add transition for fade effect */
}

.dsp-table th,
.dsp-table td {
    border-bottom: 1px solid #e5e5e5; /* Separator */
    padding: 8px 10px; /* WP table padding */
    text-align: left;
    vertical-align: top;
    line-height: 1.4;
}
.dsp-table td {
     color: #2c3338;
}


.dsp-table thead th {
    background-color: #f6f7f7;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    padding: 10px; /* Slightly more padding for headers */
    border-bottom-width: 1px; /* Ensure bottom border on header */
    color: #2c3338;
}

/* Sorting indicators */
.dsp-table thead th .dsp-sort-indicator { /* Create a dedicated span for the indicator */
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.5;
    margin-left: 6px;
    vertical-align: middle;
    border-top: 5px solid #50575e; /* Default arrow pointing down slightly dimmed */
}
.dsp-table thead th.dsp-sort-asc .dsp-sort-indicator {
    border-top: none;
    border-bottom: 5px solid #2271b1; /* Blue arrow up */
    opacity: 1;
}
.dsp-table thead th.dsp-sort-desc .dsp-sort-indicator {
    border-top: 5px solid #2271b1; /* Blue arrow down */
     opacity: 1;
}


.dsp-table tbody tr:hover {
    background-color: #f0f0f1; /* Lighter hover */
}
/* Alternate row background */
.dsp-table tbody tr.dsp-odd-row {
    background-color: #fff;
}
.dsp-table tbody tr.dsp-even-row {
    background-color: #f6f7f7;
}

.dsp-table td a {
    color: #2271b1;
    text-decoration: none;
}
.dsp-table td a:hover {
    color: #1d6197;
    text-decoration: underline;
}

.dsp-description {
    display: block;
    font-size: 0.9em;
    color: #50575e;
    margin-top: 3px;
}

/* Row Highlighting */
.dsp-new-item {
    background-color: #fff9e6 !important; /* Light yellow, important to override even/odd */
}
.dsp-table .dsp-new-item td { /* Table specific */
    font-weight: 600; /* Make text bolder for new items */
}

.dsp-table .dsp-lifetime-item td:nth-child(2) a, /* Style title link for lifetime */
.dsp-table .dsp-lifetime-item td:nth-child(3) { /* Style price cell for lifetime */
    color: #006400 !important; /* Darker Green - use !important if needed */
    font-weight: 600;
}
.dsp-lifetime-badge {
    display: inline-block;
    background-color: #d1fcd1;
    color: #005a00;
    padding: 1px 5px;
    font-size: 0.8em;
    border-radius: 3px;
    margin-left: 5px;
    font-weight: bold;
    vertical-align: middle;
}


/* Loading / Error / No Deals Rows */
.dsp-loading-row td,
.dsp-error-row td,
.dsp-no-deals-row td { /* Includes no sources selected */
    text-align: center;
    color: #7e8993;
    font-style: italic;
    padding: 20px;
}
.dsp-error-row td {
    color: #d63638; /* Red error text */
}

/* Donate Modal Styles */
.dsp-modal {
    display: none; /* Hidden by default */
    position: fixed; z-index: 1050;
    left: 0; top: 0; width: 100%; height: 100%;
    overflow: auto; background-color: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.dsp-modal-content {
    background-color: #fefefe; margin: 8% auto; padding: 25px 35px;
    border: 1px solid #dcdcde; width: 90%; max-width: 750px;
    border-radius: 4px; position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: dsp-modal-appear 0.3s ease-out;
}
@keyframes dsp-modal-appear { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
.dsp-modal-close {
    color: #777; position: absolute; top: 10px; right: 15px;
    font-size: 28px; font-weight: bold; line-height: 1; cursor: pointer;
    background: none; border: none; padding: 0;
}
.dsp-modal-close:hover, .dsp-modal-close:focus { color: #000; text-decoration: none; outline: none;}
.dsp-modal-content h2 {
    margin-top: 0; margin-bottom: 15px; color: #1d2327; font-size: 1.5em;
    border-bottom: 1px solid #eee; padding-bottom: 10px;
}
.dsp-donate-images {
    display: flex; flex-wrap: wrap; justify-content: space-around;
    align-items: flex-start; gap: 25px; margin: 20px 0;
}
.dsp-donate-item {
    text-align: center; flex: 1; min-width: 180px; max-width: 220px;
}
.dsp-donate-item p strong { display: block; margin-bottom: 8px; color: #3c434a; }
.dsp-donate-item img {
    max-width: 100%; height: auto; border: 1px solid #ddd;
    padding: 4px; background-color: #fff; margin-bottom: 10px;
}
.dsp-donate-item code {
    display: block; font-size: 11px; word-wrap: break-word; color: #50575e;
    background-color: #f0f0f1; padding: 5px 8px; border-radius: 3px;
    margin-top: 5px; line-height: 1.5; text-align: left; cursor: pointer;
}
.dsp-donate-item code:hover { background-color: #e0e1e2; }
.dsp-copy-feedback { font-size: 0.9em; color: green; font-weight: bold; margin-top: 10px; display: none; text-align: center; }
.dsp-thank-you { margin-top: 20px; font-style: italic; text-align: center; }


/* Subscribe Modal Styles */
.dsp-subscribe-modal-content {
    padding: 25px 30px;
}
.dsp-subscribe-form {
    display: flex;
    gap: 10px;
    align-items: center; /* Align items vertically */
    margin-top: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}
.dsp-subscribe-form input[type="email"] {
    flex-grow: 1; /* Allow input to take available space */
    padding: 8px 10px; /* Slightly larger padding */
    border: 1px solid #8c8f94;
    border-radius: 3px;
    min-width: 200px; /* Minimum width */
    font-size: 14px;
}
.dsp-subscribe-form button {
    /* Uses .dsp-button styles already */
    flex-shrink: 0; /* Prevent button from shrinking */
}
.dsp-subscribe-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 0.95em;
    display: none; /* Hidden by default */
    text-align: center;
}
.dsp-subscribe-status.dsp-success {
    background-color: #e7f7e8; /* Light green background */
    border: 1px solid #a0d3a3;
    color: #006400; /* Dark green text */
}
.dsp-subscribe-status.dsp-error {
    background-color: #fdecea; /* Light red background */
    border: 1px solid #f2b0b0;
    color: #a94442; /* Dark red text */
}

/* Responsive Adjustments for Modals */
@media (max-width: 600px) {
    .dsp-modal-content { width: 95%; margin: 5% auto; padding: 15px 20px; }
    .dsp-donate-images { flex-direction: column; align-items: center; gap: 30px; }
    .dsp-donate-item { min-width: 200px; max-width: 250px; }
    .dsp-subscribe-form { flex-direction: column; align-items: stretch; }
    .dsp-subscribe-form input[type="email"] { min-width: 0; }
}


/* ============================================ */
/* === DARK MODE STYLES START HERE === */
/* ============================================ */

/* Apply base dark styles to the container when html has the class */
html.dsp-theme-dark .dsp-container {
    background-color: #2a2e34; border-color: #4f545c; color: #e0e1e2;
}
html.dsp-theme-dark .dsp-filters { border-bottom-color: #4f545c; }
html.dsp-theme-dark .dsp-filter-item label,
html.dsp-theme-dark .dsp-filter-checkboxes > span { color: #e0e1e2; }
html.dsp-theme-dark .dsp-filter-item input[type="text"],
html.dsp-theme-dark .dsp-filter-price-range input[type="number"] { background-color: #1e2227; border-color: #6c737c; color: #e0e1e2; box-shadow: inset 0 1px 2px rgba(0,0,0,.3); }
html.dsp-theme-dark .dsp-source-label { color: #c8cacc; }

/* Buttons Dark */
html.dsp-theme-dark .dsp-button { background: #3c8dbc; border-color: #3c8dbc; color: #fff; box-shadow: 0 1px 0 #2a7aaf; }
html.dsp-theme-dark .dsp-button:hover,
html.dsp-theme-dark .dsp-button:focus { background: #3483b5; border-color: #3483b5; }
html.dsp-theme-dark .dsp-button:active { background: #2e75a3; border-color: #2e75a3; }
html.dsp-theme-dark .dsp-button:disabled,
html.dsp-theme-dark .dsp-button[disabled] { background: #3a3f46 !important; border-color: #4f545c !important; color: #7e8993 !important; }
html.dsp-theme-dark .dsp-button-secondary { background: #4f545c; border-color: #6c737c; color: #e0e1e2; }
html.dsp-theme-dark .dsp-button-secondary:hover,
html.dsp-theme-dark .dsp-button-secondary:focus { background: #5a6068; border-color: #7e8993; color: #f0f1f2; }
html.dsp-theme-dark .dsp-button-secondary:active { background: #454a51; border-color: #6c737c; }

/* Status/Log Dark */
html.dsp-theme-dark .dsp-refresh-status { color: #b4b9be; }
html.dsp-theme-dark .dsp-refresh-status.dsp-success { color: #6af072; }
html.dsp-theme-dark .dsp-refresh-status.dsp-error { color: #ff7b7b; }
html.dsp-theme-dark .dsp-debug-controls { border-bottom-color: #4f545c; }
html.dsp-theme-dark #dsp-debug-log-container { background-color: #1e2227; border-color: #4f545c; }
html.dsp-theme-dark #dsp-debug-log-container h4 { color: #e0e1e2; }
html.dsp-theme-dark #dsp-debug-log { color: #b4b9be; }
html.dsp-theme-dark .dsp-status-bar { color: #b4b9be; }
html.dsp-theme-dark #dsp-last-updated { color: #9ea3a8; }

/* Table Dark */
html.dsp-theme-dark .dsp-table { background-color: #2a2e34; border-color: #4f545c; }
html.dsp-theme-dark .dsp-table th,
html.dsp-theme-dark .dsp-table td { border-bottom-color: #4f545c; color: #e0e1e2; }
html.dsp-theme-dark .dsp-table thead th { background-color: #3a3f46; color: #f0f1f2; border-bottom-color: #4f545c; }
html.dsp-theme-dark .dsp-table thead th .dsp-sort-indicator { border-top-color: #9ea3a8; }
html.dsp-theme-dark .dsp-table thead th.dsp-sort-asc .dsp-sort-indicator { border-bottom-color: #6dbff2; border-top-color: transparent !important; } /* Override default border-top */
html.dsp-theme-dark .dsp-table thead th.dsp-sort-desc .dsp-sort-indicator { border-top-color: #6dbff2; }
html.dsp-theme-dark .dsp-table tbody tr:hover { background-color: #3a3f46; }
html.dsp-theme-dark .dsp-table tbody tr.dsp-odd-row { background-color: #2a2e34; }
html.dsp-theme-dark .dsp-table tbody tr.dsp-even-row { background-color: #30353c; }
html.dsp-theme-dark .dsp-table td a { color: #6dbff2; }
html.dsp-theme-dark .dsp-table td a:hover { color: #8ecbf4; }
html.dsp-theme-dark .dsp-description { color: #b4b9be; }

/* Highlighting Dark */
html.dsp-theme-dark .dsp-new-item {
    background-color: #4a4a2a !important; /* Dark Yellowish background */
}
html.dsp-theme-dark .dsp-table .dsp-new-item td {
    font-weight: 600;
    color: #f5f5d1 !important; /* Ensure bright text on dark yellow bg */
}
html.dsp-theme-dark .dsp-table .dsp-lifetime-item td:nth-child(2) a,
html.dsp-theme-dark .dsp-table .dsp-lifetime-item td:nth-child(3) {
    color: #77dd77 !important;
    font-weight: 600;
}
html.dsp-theme-dark .dsp-lifetime-badge { color: #1f5c1f; background-color: #a1e9a1; } /* Adjust badge for dark */

/* Loading/Error Dark */
html.dsp-theme-dark .dsp-loading-row td,
html.dsp-theme-dark .dsp-error-row td,
html.dsp-theme-dark .dsp-no-deals-row td { color: #9ea3a8; }
html.dsp-theme-dark .dsp-error-row td { color: #ff7b7b; }

/* Donate Modal Dark */
html.dsp-theme-dark #dsp-donate-modal .dsp-modal-content { background-color: #2a2e34; border-color: #4f545c; color: #e0e1e2; }
html.dsp-theme-dark .dsp-modal-close { color: #b4b9be; }
html.dsp-theme-dark .dsp-modal-close:hover,
html.dsp-theme-dark .dsp-modal-close:focus { color: #f0f1f2; }
html.dsp-theme-dark #dsp-donate-modal .dsp-modal-content h2 { color: #f0f1f2; border-bottom-color: #4f545c; }
html.dsp-theme-dark #dsp-donate-modal .dsp-donate-item p strong { color: #e0e1e2; }
html.dsp-theme-dark #dsp-donate-modal .dsp-donate-item img { border-color: #4f545c; background-color: #f0f0f0; } /* Keep QR light */
html.dsp-theme-dark #dsp-donate-modal .dsp-donate-item code { color: #b4b9be; background-color: #1e2227; }
html.dsp-theme-dark #dsp-donate-modal .dsp-copy-feedback { color: #6af072; }

/* Subscribe Modal Dark */
html.dsp-theme-dark #dsp-subscribe-modal .dsp-modal-content { background-color: #2a2e34; border-color: #4f545c; color: #e0e1e2; } /* Apply dark bg */
html.dsp-theme-dark #dsp-subscribe-modal .dsp-modal-content h2 { color: #f0f1f2; border-bottom-color: #4f545c; } /* Apply dark heading */
html.dsp-theme-dark .dsp-subscribe-form input[type="email"] { background-color: #1e2227; border-color: #6c737c; color: #e0e1e2; }
html.dsp-theme-dark .dsp-subscribe-status.dsp-success { background-color: #2b4f2d; border-color: #518e55; color: #b6eeb9; }
html.dsp-theme-dark .dsp-subscribe-status.dsp-error { background-color: #5a2a2a; border-color: #a86c6c; color: #f5c0c0; }

/* Pagination Dark */
html.dsp-theme-dark .dsp-pagination .dsp-page-link { background-color: #3a3f46; border-color: #5a6068; color: #c8cacc; }
html.dsp-theme-dark .dsp-pagination .dsp-page-link:hover { background-color: #4f545c; border-color: #6c737c; color: #e0e1e2; }
html.dsp-theme-dark .dsp-pagination .dsp-page-item.dsp-disabled .dsp-page-link { background-color: #3a3f46; border-color: #5a6068; color: #7e8993; opacity: 0.5; }
html.dsp-theme-dark .dsp-pagination .dsp-page-item.dsp-current-page .dsp-page-link { background-color: #3c8dbc; border-color: #3c8dbc; color: #fff; }

/* Background Update Notice Dark */
html.dsp-theme-dark .dsp-update-notice { background-color: #2a3f5c; color: #cde4ff; border-color: #4b6f9e; }
html.dsp-theme-dark .dsp-dismiss-notice:hover,
html.dsp-theme-dark .dsp-dismiss-notice:focus { background-color: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }


/* === DARK MODE STYLES END HERE === */

/* Responsive Adjustments */

/* Wrapper for the table to allow horizontal scrolling on small screens */
.dsp-table-wrapper {
    width: 100%;
    overflow-x: auto; /* Enable horizontal scrollbar only when needed */
    -webkit-overflow-scrolling: touch; /* Smoother scrolling momentum on iOS */
    margin-bottom: 1em; /* Add some space below the scrolling table */
    position: relative; /* Needed for overlay positioning */
}
/* Styles for loading overlay */
.dsp-table-wrapper.dsp-table-loading > .dsp-table {
    opacity: 0.5; /* Fade out the table content */
    pointer-events: none; /* Prevent interaction with faded table */
}
.dsp-table-wrapper.dsp-table-loading::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(246, 247, 247, 0.7); /* Light background overlay (matches WP admin bg) */
    z-index: 10;
    display: block;
    border-radius: 3px; /* Optional: Match container radius */
}
html.dsp-theme-dark .dsp-table-wrapper.dsp-table-loading::before {
    background-color: rgba(42, 46, 52, 0.8); /* Dark background overlay */
}
/* Spinner positioning is handled by ::after on the wrapper */

/* Ensure table inside the wrapper takes at least the wrapper width,
   but can grow wider based on content, forcing the scroll */
.dsp-table-wrapper .dsp-table {
    width: 100%;
    /* Optional: Define a minimum width larger than typical mobile screens
       if columns collapse too much otherwise. Adjust value as needed. */
    /* min-width: 650px; */
}

/* Make controls stack vertically on smaller screens */
@media (max-width: 767px) {
    .dsp-controls-area { /* Assuming you have a wrapper div? If not, ignore */
        display: flex;
        flex-direction: column; /* Stack filters and actions */
        gap: 15px; /* Space between filters and actions block */
    }

    .dsp-filters {
        display: flex;
        flex-wrap: wrap; /* Allow filter items to wrap */
        gap: 10px; /* Space between filter items */
        /* Reset bottom border if stacking */
        border-bottom: none;
        padding-bottom: 0;
    }

    .dsp-filter-item {
        width: 100%; /* Make each filter group take full width */
        flex-basis: 100%;
        box-sizing: border-box; /* Include padding in width calculation */
        margin-bottom: 10px; /* Add space between stacked filter items */
    }
    .dsp-filter-item input[type="text"] { /* Ensure text inputs adapt */
        width: 100%; /* Make search input take full width */
    }
     .dsp-filter-price-range {
        display: flex;
        align-items: center;
        width: 100%;
        justify-content: space-between; /* Space out labels/inputs */
     }
     .dsp-filter-price-range label { flex-shrink: 0; margin-right: 5px;}
     .dsp-filter-price-range input[type="number"] { width: 40%; } /* Adjust width */
     .dsp-filter-price-range span { flex-shrink: 0; }

    .dsp-filter-checkboxes {
         justify-content: flex-start; /* Align checkboxes left */
         width: 100%;
    }
     #dsp-source-checkboxes { /* Allow source checkboxes to wrap */
        display: flex;
        flex-wrap: wrap;
        gap: 5px 15px;
     }
    .dsp-filter-checkboxes label { /* New/LTD labels */
        margin-right: 15px; /* Adjust spacing */
    }


    .dsp-debug-controls {
        display: flex;
        flex-wrap: wrap; /* Allow button groups to wrap */
        justify-content: flex-start; /* Align left */
        gap: 10px;
        border-bottom: 1px solid #e5e5e5; /* Restore border */
        padding-bottom: 10px;
        margin-top: 15px; /* Add space after filters */
    }
    html.dsp-theme-dark .dsp-debug-controls { border-bottom-color: #4f545c; }


    /* Adjust status bar for better stacking */
    .dsp-status-bar {
        display: flex;
        flex-direction: column; /* Stack status and last updated */
        align-items: flex-start; /* Align left */
        gap: 5px; /* Space between lines */
        margin-top: 15px; /* Add space before table */
    }
    #dsp-last-updated { /* Corrected selector */
        float: none; /* Remove float */
        width: 100%; /* Take full width */
        text-align: left; /* Align text left */
        font-size: 0.9em;
    }

    /* Optional: Adjust table cell padding for smaller screens */
    .dsp-table td,
    .dsp-table th {
        padding: 8px 6px; /* Slightly reduce padding */
        font-size: 0.95em; /* Slightly reduce font size */
    }

    /* Ensure modals are still usable */
     .dsp-modal-content {
        width: 90%; /* Allow modal to take more width */
        max-width: 500px;
     }
     .dsp-donate-images {
         flex-direction: column; /* Stack donate items */
         align-items: center; /* Center stacked items */
     }

}

@media (max-width: 480px) {
     /* Further adjustments for very small screens if needed */
     .dsp-table thead {
         /* Consider hiding less critical columns on very small screens,
            but horizontal scroll is often preferred over hiding data. */
         /* display: none; */ /* Example: Hide header - Not recommended generally */
     }
     .dsp-debug-controls .dsp-button {
         flex-grow: 1; /* Make buttons take more space */
         text-align: center;
         padding: 5px 8px; /* Slightly smaller buttons */
     }
     .dsp-filter-price-range input[type="number"] { width: 35%; } /* Further reduce price input width */
}

/* --- Pagination --- */
.dsp-pagination {
    margin-top: 20px;
    margin-bottom: 10px;
    text-align: center;
    clear: both;
    transition: opacity 0.3s ease-in-out;
}
.dsp-pagination.dsp-loading {
    opacity: 0.5;
    pointer-events: none;
}
.dsp-page-numbers {
    display: inline-block;
    padding-left: 0;
    margin: 0;
    border-radius: 4px;
    list-style: none; /* Remove list bullets */
}
.dsp-page-item {
    display: inline; /* Display items side-by-side */
}
.dsp-page-link {
    position: relative;
    display: inline-block; /* Needed for padding */
    padding: 0.5em 0.8em;
    margin-left: -1px; /* Overlap borders */
    line-height: 1.25;
    color: #007bff; /* Default link color */
    background-color: #fff;
    border: 1px solid #dee2e6;
    text-decoration: none;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
}
.dsp-page-item:first-child .dsp-page-link {
    margin-left: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}
.dsp-page-item:last-child .dsp-page-link {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}
.dsp-page-link:hover {
    z-index: 2;
    color: #0056b3;
    background-color: #e9ecef;
    border-color: #dee2e6;
}
.dsp-page-item.dsp-disabled .dsp-page-link {
    color: #6c757d;
    pointer-events: none;
    cursor: default; /* Use default cursor for disabled items */
    background-color: #fff;
    border-color: #dee2e6;
    opacity: 0.6;
}
.dsp-page-item.dsp-current-page .dsp-page-link {
    z-index: 1;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
    cursor: default;
}

/* --- Background Update Notice Styles --- */
.dsp-update-notice {
    background-color: #eef7ff; /* Light blue background */
    color: #1d4f8a; /* Dark blue text */
    border: 1px solid #b6dcfb; /* Light blue border */
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 0.9em;
    display: flex; /* Use flexbox for alignment */
    justify-content: space-between; /* Space text and button */
    align-items: center; /* Vertically center items */
}

.dsp-dismiss-notice {
    background: none;
    border: 1px solid transparent; /* Keep space, hide border */
    color: inherit; /* Inherit color */
    font-size: 1.2em; /* Make X slightly larger */
    line-height: 1;
    padding: 0 5px;
    cursor: pointer;
    margin-left: 10px;
    opacity: 0.7;
}
.dsp-dismiss-notice:hover,
.dsp-dismiss-notice:focus {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1); /* Slight hover effect */
    border-color: rgba(0, 0, 0, 0.2);
    outline: none;
}

/* Price Filter Specific Styles */
.dsp-filter-price-range label { margin-right: 5px; }
.dsp-filter-price-range span { margin: 0 3px; }
.dsp-price-input {
    width: 70px; /* Adjust as needed */
    padding: 5px;
    font-size: 0.9em;
     border: 1px solid #8c8f94; /* WP input border */
     border-radius: 3px;
     background-color: #fff;
     box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
     color: #2c3338;
}
/* Remove spinner buttons for number inputs if desired */
.dsp-price-input::-webkit-outer-spin-button,
.dsp-price-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.dsp-price-input[type=number] {
  -moz-appearance: textfield; /* Firefox */
}
/* --- Grid View Styles --- */

/* Hide table elements when in grid view */
.dsp-view-grid .dsp-table-wrapper {
    display: none;
}

/* Show grid container only in grid view */
.dsp-view-table #dsp-deals-grid {
    display: none;
}

/* Basic Grid Layout */
.dsp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Responsive columns */
    gap: 20px; /* Space between grid items */
    padding: 10px 0;
}

/* Individual Grid Item Styling */
.dsp-grid-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden; /* Prevents content spilling */
    display: flex;
    flex-direction: column;
    background-color: #fff; /* Light background for items */
    transition: box-shadow 0.2s ease-in-out;
}
.dsp-grid-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Image Area */
.dsp-grid-item-image {
    position: relative;
    width: 100%;
    padding-top: 60%; /* Aspect ratio for image area (e.g., 5:3). Adjust as needed */
    background-color: #f0f0f0; /* Placeholder background */
    display: block;
}
.dsp-grid-item-image a {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.dsp-grid-item-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area, might crop */
    display: block;
}
.dsp-image-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: #ccc; /* Placeholder symbol color */
    /* Basic camera icon using borders */
    border: 2px solid #fff;
    border-radius: 4px;
    box-sizing: border-box;
}
.dsp-image-placeholder::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 26px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 2px;
}
.dsp-image-placeholder::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 22px;
    width: 8px;
    height: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
}


/* Content Area */
.dsp-grid-item-content {
    padding: 15px;
    flex-grow: 1; /* Allows content to fill space if item heights vary */
    display: flex;
    flex-direction: column;
}
.dsp-grid-item-title {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    line-height: 1.3;
    font-weight: 600; /* Make titles bolder by default in grid */
}
.dsp-grid-item-title a {
    text-decoration: none;
    color: #2271b1; /* Default: WP primary blue (like table links) */
}
.dsp-grid-item-title a:hover {
    color: #1d6197; /* Darker blue on hover */
    text-decoration: underline;
}
.dsp-grid-item-meta {
    font-size: 0.85em;
    color: #555;
    margin-bottom: 10px;
}
.dsp-grid-item-meta span {
    margin-right: 5px;
}
.dsp-grid-item-new {
    font-weight: bold;
    color: #d9534f; /* Example color for 'New' */
    margin-left: 5px;
}
.dsp-grid-item-description {
    font-size: 0.9em;
    color: #333;
    line-height: 1.4;
    margin-top: auto; /* Pushes description down if content height varies */
}

/* Badges */
.dsp-grid-item .dsp-lifetime-badge {
    font-size: 0.7em;
    background-color: #d1fcd1; /* Use same green as table */
    color: #005a00;
    padding: 2px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 5px;
    font-weight: bold;
}

/* *** NEW: Specific Grid Item Lifetime Styling *** */
.dsp-grid-item.dsp-lifetime-item .dsp-grid-item-title a {
    color: #006400; /* Darker Green */
}
.dsp-grid-item.dsp-lifetime-item .dsp-grid-item-title a:hover {
    color: #004d00; /* Slightly darker green on hover */
}
.dsp-grid-item.dsp-lifetime-item .dsp-grid-item-price {
     color: #006400; /* Darker Green */
     font-weight: 600;
}
/* *** END NEW *** */

/* Loading/Error messages for Grid View */
.dsp-grid .dsp-loading-message,
.dsp-grid .dsp-no-deals-message,
.dsp-grid .dsp-error-message {
    grid-column: 1 / -1; /* Span full grid width */
    text-align: center;
    padding: 40px 20px;
    color: #555;
    font-style: italic;
}

/* --- Dark Mode Grid Styles --- */
.dsp-theme-dark .dsp-grid-item {
    background-color: #333; /* Darker item background */
    border-color: #555;
}
.dsp-theme-dark .dsp-grid-item-content {
     color: #ccc; /* Lighter text */
}
.dsp-theme-dark .dsp-grid-item-title a {
    color: #6dbff2; /* Default: Dark mode blue */
}
.dsp-theme-dark .dsp-grid-item-title a:hover {
    color: #8ecbf4; /* Lighter blue */
}
/* *** NEW: Dark Mode Lifetime Grid Styling *** */
.dsp-theme-dark .dsp-grid-item.dsp-lifetime-item .dsp-grid-item-title a {
     color: #77dd77; /* Light green */
}
.dsp-theme-dark .dsp-grid-item.dsp-lifetime-item .dsp-grid-item-title a:hover {
     color: #91e791; /* Lighter green on hover */
}
.dsp-theme-dark .dsp-grid-item.dsp-lifetime-item .dsp-grid-item-price {
     color: #77dd77; /* Light green */
}
/* Badge color adjusted previously, should be okay */
/* *** END NEW *** */

.dsp-theme-dark .dsp-grid-item-meta {
    color: #aaa;
}
.dsp-theme-dark .dsp-grid-item-description {
    color: #bbb;
}
.dsp-theme-dark .dsp-image-placeholder {
    background-color: #555;
    border-color: #888;
}
.dsp-theme-dark .dsp-image-placeholder::before,
.dsp-theme-dark .dsp-image-placeholder::after {
    border-color: #888;
}
.dsp-theme-dark .dsp-grid .dsp-loading-message,
.dsp-theme-dark .dsp-grid .dsp-no-deals-message,
.dsp-theme-dark .dsp-grid .dsp-error-message {
    color: #aaa;
}

/* --- Loading Overlay for Grid/Table --- */
/* Use a common wrapper for the overlay */
#dsp-deals-content {
    position: relative; /* Needed for overlay positioning */
    min-height: 150px; /* Prevent collapse during load */
}
.dsp-loading-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7); /* Light overlay */
    z-index: 10;
    pointer-events: none; /* Allow clicks through overlay if needed, though usually not */
}
.dsp-loading-overlay::after { /* Optional spinner */
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    margin-left: -20px;
    border: 4px solid #f3f3f3; /* Light grey */
    border-top: 4px solid #3498db; /* Blue */
    border-radius: 50%;
    animation: dsp-spin 1s linear infinite;
    z-index: 11;
}
.dsp-theme-dark .dsp-loading-overlay::before {
     background-color: rgba(0, 0, 0, 0.7); /* Dark overlay */
}
.dsp-theme-dark .dsp-loading-overlay::after {
    border: 4px solid #555;
    border-top: 4px solid #5cacee;
}
/* Keep the spinner animation */
@keyframes dsp-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.dsp-loader-container {
    text-align: center;
    padding: 20px 0;
    width: 100%;
    clear: both; /* Important if using floats for grid */
}
.dsp-loader-container .dsp-spinner {
    display: inline-block;
    vertical-align: middle;
    /* Make sure your .dsp-spinner styles are defined (width, height, border, animation) */
    /* Example spinner (adapt as needed): */
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-left-color: #0073aa; /* Example color */
    border-radius: 50%;
    animation: dsp-spin 1s linear infinite;
    margin-right: 10px;
}
.dsp-loader-container span {
    vertical-align: middle;
    color: #555;
}
/* Ensure your animation is defined */
@keyframes dsp-spin {
    to { transform: rotate(360deg); }
}

/* Hide standard pagination if it exists */
#dsp-pagination-controls {
    display: none !important;
}