/*
 * ESprices - Discord Trading Price Tracker
 * By Murr (https://github.com/vtstv)
 * GitHub: https://github.com/vtstv/ESprices
 * Version: 0.2.1
 */

/* CSS Variables for Light/Dark Theme */
:root {
    /* Light theme colors */
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-shadow: rgba(0, 0, 0, 0.1);
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #999;
    --border-color: #ddd;
    --header-color: #667eea;
    --hover-shadow: rgba(0, 0, 0, 0.15);
    --table-stripe: #f8f9fa;
    --input-bg: white;
    --input-border: #ddd;
    --link-color: #667eea;
    --link-hover: #764ba2;
    --price-na: rgba(153, 153, 153, 0.5);
}

body.dark-theme {
    /* Dark theme colors */
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --card-bg: rgba(30, 30, 46, 0.95);
    --card-shadow: rgba(0, 0, 0, 0.3);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --border-color: #3a3a4a;
    --header-color: #8b9dc3;
    --hover-shadow: rgba(0, 0, 0, 0.4);
    --table-stripe: rgba(255, 255, 255, 0.03);
    --input-bg: #2a2a3e;
    --input-border: #3a3a4a;
    --link-color: #8b9dc3;
    --link-hover: #a5b4d3;
    --price-na: rgba(128, 128, 128, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    cursor: pointer;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 5px 20px var(--card-shadow);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 8px 30px var(--hover-shadow);
}

header {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px var(--card-shadow);
    margin-bottom: 30px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

h1 {
    color: var(--header-color);
    font-size: 2.5em;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
    transition: color 0.3s ease;
}

/* Mobile header */
.mobile-header {
    display: none;
    background: var(--card-bg);
    color: var(--header-color);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px var(--card-shadow);
}

/* Mobile search */
.mobile-search {
    display: none;
    position: relative;
    margin-bottom: 15px;
}

.mobile-search input {
    width: 100%;
    padding: 10px 35px 10px 12px;
    font-size: 0.95em;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.mobile-search input:focus {
    outline: none;
    border-color: var(--link-hover);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.mobile-clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px 8px;
    font-size: 16px;
    display: none;
    transition: color 0.3s ease;
}

.mobile-clear-search-btn:hover {
    color: var(--link-hover);
}

.controls {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 20px var(--card-shadow);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.control-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    background: var(--card-bg);
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px var(--card-shadow);
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-secondary);
    transition: all 0.3s;
    border: 3px solid transparent;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tab:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px var(--hover-shadow);
}

.tab:active {
    transform: translateY(-1px);
}

.tab.active {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: white;
    border-color: var(--header-color);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
}

body.dark-theme .tab.active {
    box-shadow: 0 10px 40px rgba(139, 157, 195, 0.3);
}

label {
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

select, input {
    padding: 10px 15px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--input-bg);
    color: var(--text-primary);
}

#timezoneSelect {
    min-width: 120px;
    cursor: pointer;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--header-color);
}

button {
    background: var(--header-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

button:hover {
    background: var(--link-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

body.dark-theme button:hover {
    box-shadow: 0 5px 15px rgba(139, 157, 195, 0.3);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.stat-card {
    background: var(--card-bg);
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--card-shadow);
    text-align: center;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--header-color);
    margin-bottom: 2px;
    transition: color 0.3s ease;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8em;
    transition: color 0.3s ease;
}

/* Hamburger menu button (mobile only) */
.hamburger-menu {
    display: none; /* Hidden by default on desktop */
    position: fixed;
    top: 12px;
    right: 15px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 18px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

.hamburger-menu:hover {
    background: var(--link-hover);
    color: white;
    transform: scale(1.05);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

.mobile-menu-content {
    position: absolute;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--card-bg);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    padding: 20px;
    transition: right 0.3s ease;
    border-left: 1px solid var(--border-color);
}

.mobile-menu-overlay.active .mobile-menu-content {
    right: 0;
}

.close-mobile-menu {
    position: absolute;
    top: 15px;
    left: 15px;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.close-mobile-menu:hover {
    color: var(--link-hover);
}

.mobile-menu-section {
    margin-bottom: 30px;
}

.mobile-menu-section h3 {
    color: var(--header-color);
    font-size: 1.2em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

#mobileStats .stat-card {
    margin-bottom: 10px;
}

#mobileControls .control-group {
    margin-bottom: 15px;
}

#mobileControls label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
    font-size: 0.9em;
}

#mobileControls input,
#mobileControls select,
#mobileControls button {
    width: 100%;
}

/* Compact theme toggle button in mobile menu */
.theme-toggle-menu-compact {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    cursor: pointer;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin: 0 auto;
}

.theme-toggle-menu-compact:hover {
    background: var(--link-hover);
    color: white;
    border-color: var(--link-hover);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Mobile menu compact stat-card */
#mobileStats .stat-card {
    margin-bottom: 8px;
    padding: 8px 12px;
}

#mobileStats .stat-value {
    font-size: 1.2em;
    margin-bottom: 2px;
}

#mobileStats .stat-label {
    font-size: 0.75em;
}

.data-table {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 40px var(--card-shadow);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
}

th:hover {
    background: rgba(255,255,255,0.1);
}

th.sortable::after {
    content: ' ↕';
    opacity: 0.5;
}

th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s;
}

tbody tr:hover {
    background: var(--table-stripe);
}

tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

tbody tr:nth-child(even):hover {
    background: var(--hover-shadow);
    opacity: 0.8;
}

td {
    padding: 15px;
    color: var(--text-primary);
}

.item-name {
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.item-level {
    color: var(--header-color);
    font-size: 0.85em;
    margin-left: 5px;
    transition: color 0.3s ease;
}

.price {
    font-weight: bold;
    color: #27ae60;
}

body.dark-theme .price {
    color: #52c77d;
}

.price-range {
    font-size: 0.85em;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* Style for N/A prices - make them subtle */
.price-na {
    color: var(--price-na);
    font-weight: normal;
    font-style: italic;
}

.count-badge {
    background: var(--header-color);
    transition: background 0.3s ease;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

/* Modal window */
.modal {
    display: block;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

body.dark-theme .modal {
    background-color: rgba(0, 0, 0, 0.7);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px var(--card-shadow);
    animation: slideIn 0.3s;
    color: var(--text-primary);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    color: var(--text-tertiary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: color 0.3s ease;
}

.modal-close:hover,
.modal-close:focus {
    color: var(--text-primary);
}

.modal-content h2 {
    color: var(--header-color);
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.modal-content h3 {
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--header-color);
    padding-bottom: 10px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

/* Detailed buyer/seller list in modal */
.buyer-list-detailed {
    max-height: 500px;
    overflow-y: auto;
}

.buyer-item-detailed {
    padding: 15px;
    margin: 10px 0;
    background: var(--table-stripe);
    border-radius: 10px;
    border-left: 4px solid var(--header-color);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.buyer-info {
    margin-bottom: 10px;
}

.buyer-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
}

.buyer-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.buyer-actions .buyer-link {
    background: var(--header-color);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s;
}

.buyer-actions .buyer-link:hover {
    background: var(--link-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

body.dark-theme .buyer-actions .buyer-link:hover {
    box-shadow: 0 4px 12px rgba(139, 157, 195, 0.3);
}

.buyer-list {
    max-height: 200px;
    overflow-y: auto;
}

.buyer-item {
    padding: 8px;
    margin: 5px 0;
    background: var(--table-stripe);
    border-radius: 5px;
    border-left: 3px solid var(--header-color);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.buyer-name {
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.buyer-display {
    color: var(--header-color);
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.buyer-price {
    color: #27ae60;
    font-weight: 600;
}

body.dark-theme .buyer-price {
    color: #52c77d;
}

.buyer-date {
    color: var(--text-tertiary);
    font-size: 0.85em;
    transition: color 0.3s ease;
}

.buyer-link {
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.85em;
    transition: color 0.3s ease;
}

.buyer-link:hover {
    text-decoration: underline;
    color: var(--link-hover);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-primary);
    font-size: 1.2em;
    transition: color 0.3s ease;
}

.error {
    background: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.search-highlight {
    background: #ffeb3b;
    font-weight: bold;
    color: #000;
    padding: 2px 4px;
    border-radius: 3px;
}

body.dark-theme .search-highlight {
    background: #fbc02d;
    color: #1a1a2e;
}

.update-indicator {
    position: fixed;
    top: 80px;
    right: 20px;
    background: #27ae60;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 999;
}

body.dark-theme .update-indicator {
    background: #52c77d;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.update-indicator.show {
    opacity: 1;
}

.update-indicator.updating {
    background: var(--header-color);
}

/* Footer */
.footer {
    background: var(--card-bg);
    color: #444;
    text-align: center;
    padding: 8px 12px;
    margin-top: 20px;
    border-radius: 6px;
    box-shadow: 0 3px 10px var(--card-shadow);
    font-size: 0.92em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.footer-disclaimer {
    line-height: 1.6;
}

.footer-disclaimer p {
    margin: 2px 0;
}

.footer-disclaimer p:first-child {
    font-weight: 400;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #888;
}

.footer-disclaimer p:last-child {
    font-size: 0.95em;
    color: #555;
    opacity: 1;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.footer a {
    color: #3366cc;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.footer a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
}

.pagination button {
    padding: 8px 15px;
    background: var(--card-bg);
    color: var(--header-color);
    border: 2px solid var(--header-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: var(--header-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

body.dark-theme .pagination button:hover:not(:disabled) {
    box-shadow: 0 5px 15px rgba(139, 157, 195, 0.3);
}

.pagination button:disabled {
    background: var(--table-stripe);
    color: var(--text-tertiary);
    border-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination button.active {
    background: var(--header-color);
    color: white;
    border-color: var(--header-color);
}

.pagination .page-numbers {
    display: flex;
    gap: 5px;
}

.pagination .page-numbers button {
    padding: 8px 12px;
    min-width: 40px;
}

.pagination .ellipsis {
    padding: 8px 12px;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

/* Items per page control */
.items-per-page-control {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 15px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--card-shadow);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.items-per-page-control label {
    color: var(--text-secondary);
    font-weight: 600;
    transition: color 0.3s ease;
}

.items-per-page-control select {
    padding: 8px 12px;
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.items-per-page-control select:hover {
    border-color: #667eea;
}

.items-per-page-control select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.items-info {
    color: var(--text-secondary);
    font-size: 0.9em;
    text-align: center;
    font-weight: 500;
}

/* Scroll to top button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--header-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

body.dark-theme .scroll-to-top {
    box-shadow: 0 4px 15px rgba(139, 157, 195, 0.3);
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: var(--link-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

body.dark-theme .scroll-to-top:hover {
    box-shadow: 0 6px 20px rgba(139, 157, 195, 0.4);
}

.scroll-to-top:active {
    transform: translateY(-1px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    /* Show mobile header */
    .mobile-header {
        display: block;
    }
    
    /* Show mobile search */
    .mobile-search {
        display: block;
    }
    
    /* Hide desktop header */
    .desktop-header {
        display: none;
    }
    
    /* Show hamburger menu on mobile */
    .hamburger-menu {
        display: flex !important;
        top: 10px;
        right: 10px;
        z-index: 1100; /* Higher than tabs to avoid conflicts */
    }
    
    /* Hide theme toggle button on mobile */
    .theme-toggle {
        display: none;
    }
    
    /* Hide desktop controls on mobile */
    .desktop-controls {
        display: none !important;
    }
    
    /* Hide desktop stats on mobile */
    .desktop-stats {
        display: none !important;
    }
    
    /* Show mobile menu when active */
    .mobile-menu-overlay.active {
        display: block;
    }
    
    /* Compact table for mobile */
    table {
        font-size: 0.9em;
    }
    
    table th, table td {
        padding: 10px 8px;
    }
    
    /* Hide less important columns on mobile for WTS */
    .data-table table th:nth-child(3),
    .data-table table td:nth-child(3),
    .data-table table th:nth-child(4),
    .data-table table td:nth-child(4) {
        display: none;
    }
    
    /* Mobile tabs - keep visible */
    .tabs {
        margin-top: 50px; /* Space for hamburger menu */
        padding-right: 0;
    }
    
    .tab {
        padding: 15px 15px;
        font-size: 0.95em;
        min-height: 55px;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        z-index: 10; /* Below hamburger menu */
    }
    
    .tab:active {
        transform: scale(0.98);
    }
    
    /* Scroll to top button - smaller on mobile */
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 5vh auto;
        padding: 20px;
    }
    
    /* Buyer details in modal - stack vertically */
    .buyer-item {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }
    
    .buyer-name {
        font-size: 1em;
    }
    
    .buyer-price {
        font-size: 1.1em;
    }
    
    /* Pagination controls */
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .pagination button {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    /* Items per page control */
    .items-per-page-control {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}

/* Extra small devices (phones in portrait, less than 400px) */
@media (max-width: 400px) {
    h1 {
        font-size: 1.5em;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 0.85em;
    }
    
    table th, table td {
        padding: 8px 5px;
    }
    
    .item-name {
        font-size: 0.9em;
    }
}

/* Dark theme scrollbar styling */
body.dark-theme ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

body.dark-theme ::-webkit-scrollbar-track {
    background: var(--card-bg);
    border-radius: 10px;
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
    border: 2px solid var(--card-bg);
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Dark theme select dropdown options */
body.dark-theme select option {
    background: var(--input-bg);
    color: var(--text-primary);
}

/* Dark theme items-per-page select */
body.dark-theme .items-per-page-control select {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.dark-theme .items-per-page-control select:hover {
    border-color: var(--header-color);
}

body.dark-theme .items-per-page-control select:focus {
    border-color: var(--header-color);
    box-shadow: 0 0 0 3px rgba(139, 157, 195, 0.2);
}

/* Dark theme modal background */
body.dark-theme .modal-content {
    background: var(--card-bg);
    color: var(--text-primary);
}

body.dark-theme .modal-content h2 {
    color: var(--header-color);
}

/* Dark theme modal price stats background */
body.dark-theme .modal-content > div[style*="background: #f5f5f5"] {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Dark theme modal labels */
body.dark-theme .modal-content div[style*="color: #999"] {
    color: var(--text-tertiary) !important;
}

/* Dark theme modal close button */
body.dark-theme .modal-close {
    color: var(--text-secondary);
}

body.dark-theme .modal-close:hover {
    color: var(--text-primary);
}

/* Dark theme - compact theme toggle button in mobile menu */
body.dark-theme .theme-toggle-menu-compact {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

body.dark-theme .theme-toggle-menu-compact:hover {
    background: var(--link-hover);
    border-color: var(--link-hover);
    box-shadow: 0 4px 12px rgba(139, 157, 195, 0.3);
}

/* Dark theme - mobile header */
body.dark-theme .mobile-header {
    background: var(--card-bg);
    color: var(--header-color);
}


