/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    padding-top: 120px; /* Space for fixed top header (h1 + nav + padding) */
    width: 100%;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: white;
    padding: 20px;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    font-size: 24px;
    color: #2c3e50;
    font-weight: bold;
    text-align: center;
    width: 100%;
    margin: 0;
}

nav {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

nav a {
    color: #666;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s;
}

nav a:hover {
    background: #f0f0f0;
}

nav a.active {
    background: #007bff;
    color: white;
}

nav a {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    padding: 0 4px;
    line-height: 1;
}

.nav-badge.badge-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    border-radius: 50%;
    top: 2px;
    right: 2px;
}

/* Messages */
#message, .message {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
}

.message.success, #message.success {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    display: block;
}

.message.error, #message.error {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    display: block;
}

.message.info, #message.info {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
}

.stat-value.positive {
    color: #28a745;
}

.stat-value.negative {
    color: #dc3545;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.settings-section .btn-settings,
.settings-section .btn-danger {
    background: transparent;
    color: #333;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border: none;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
}

.settings-section .btn-settings:hover,
.settings-section .btn-danger:hover {
    background: #f0f0f0;
    color: #333;
}

.settings-section .btn-danger {
    color: #dc3545;
}

.settings-section .btn-danger:hover {
    background: #fee;
    color: #c82333;
}

/* Settings Page */
.settings-page {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto;
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
}

.user-info-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.user-info-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.user-info-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.user-info-item label {
    font-weight: 600;
    color: #666;
    min-width: 80px;
    margin-right: 15px;
}

.user-info-item div {
    color: #333;
    flex: 1;
}

#user-photo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

button {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

button:hover {
    background: #0056b3;
}

.actions {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.actions-buttons {
    display: flex;
    gap: 10px;
}

.actions-buttons button {
    flex: 1;
    min-width: 0;
}

.action-message {
    display: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    min-width: 200px;
}

.action-message.info {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    display: block;
}

.action-message.success {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    display: block;
}

.action-message.error {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    display: block;
}

/* Table */
.sessions-table {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

/* Right-align Stake (3rd column), Time Played (4th column) and Profit (5th column) */
th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
    text-align: right;
}

tr:hover {
    background: #f8f9fa;
}

/* Blinking animation for ongoing sessions */
.session-ongoing {
    animation: blink-session 2s infinite;
}

@keyframes blink-session {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: #d0d0d0;
    }
}

.positive {
    color: #28a745;
    font-weight: 500;
}

.negative {
    color: #dc3545;
    font-weight: 500;
}

/* Session Menu Button */
.session-menu-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.session-menu-btn:hover {
    background: #5a6268;
}

/* Session Context Menu */
.session-context-menu {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 120px;
    padding: 4px 0;
}

.context-menu-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f5f5f5;
}

.context-menu-item-danger {
    color: #dc3545;
}

.context-menu-item-danger:hover {
    background-color: #fee;
    color: #c82333;
}

.btn-view {
    background: #28a745;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-view:hover {
    background: #218838;
}

.btn-edit {
    background: #007bff;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-edit:hover {
    background: #0056b3;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-delete:hover {
    background: #c82333;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 8px;
    max-width: min(400px, 95%);
    width: min(400px, 95%);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content-compact {
    max-width: min(400px, 95%);
    width: min(400px, 95%);
    padding: 15px;
}

.modal-content-compact .form-group {
    margin-bottom: 12px;
}

.modal-content-compact .form-group label {
    font-size: 13px;
    margin-bottom: 4px;
}

.view-field {
    padding: 6px 10px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 14px;
    min-height: 20px;
    color: #495057;
}

.view-field.positive {
    color: #28a745;
    font-weight: 500;
}

.view-field.negative {
    color: #dc3545;
    font-weight: 500;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input {
    max-width: 150px;
}

.form-group select {
    max-width: 150px;
}

.form-group textarea {
    max-width: 100%;
}

.form-group input[type="datetime-local"] {
    font-size: 14px;
    padding: 8px;
    max-width: 150px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form h2 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.auth-form input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.auth-form button {
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
}

.auth-form button:hover {
    background: #0056b3;
}

.toggle-auth {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.toggle-auth a {
    color: #007bff;
    text-decoration: none;
}

.toggle-auth a:hover {
    text-decoration: underline;
}

/* Friends Page */
.handle-section {
    background: #f8f9fa;
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
}

.handle-display {
    font-size: 28px;
    font-weight: bold;
    color: #007bff;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    text-align: center;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
}

.handle-section p {
    color: #666;
    font-size: 14px;
}

.add-friend-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.add-friend-form {
    display: flex;
    gap: 10px;
}

.add-friend-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.friend-requests-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border: 2px solid #ffc107;
}

.friend-request-card {
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 8px;
    background: #fffbf0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.friend-request-header-compact {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.friend-name {
    font-weight: 600;
    color: #333;
}

.friend-uid-compact {
    color: #007bff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.friend-status-compact {
    font-size: 12px;
    color: #6c757d;
}

.friend-request-header {
    flex: 1;
}

.friend-request-header h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.friend-request-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.share-data-toggle-compact {
    display: flex;
    align-items: center;
    margin-right: auto;
}

.toggle-switch-compact {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: auto;
    height: 16px;
    gap: 5px;
    flex-shrink: 0;
}

.toggle-switch-compact input {
    opacity: 0;
    position: absolute;
    width: 38px;
    height: 20px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    z-index: 2;
    right: 0;
}

.toggle-switch-compact .toggle-slider {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: 0.3s;
    cursor: pointer;
    pointer-events: none;
}

.toggle-switch-compact .toggle-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch-compact input:checked + .toggle-slider {
    background-color: #28a745;
}

.toggle-switch-compact input:checked + .toggle-slider:before {
    transform: translateX(14px);
}

.btn-cancel {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-cancel:hover {
    background-color: #c82333;
}

.friends-list {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.friend-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    background: #fafafa;
}

.friend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.friend-header h3 {
    margin: 0;
    color: #333;
    flex: 1;
}

.friend-header .friend-name {
    margin: 0;
    color: #333;
}

.friend-uid {
    color: #007bff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: right;
    white-space: nowrap;
    margin-left: 10px;
}

.friend-status {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.status-pending {
    color: #6c757d;
}

.status-accepted {
    color: #495057;
}

.privacy-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.privacy-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.privacy-toggle label {
    flex: 1;
    margin: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 38px;
    height: 20px;
    position: absolute;
    z-index: 1;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    width: 38px;
    height: 20px;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #28a745;
}

input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.visibility-statuses {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: 10px;
}

.visibility-status {
    padding: 0;
    border-radius: 0;
    font-size: 12px;
    white-space: nowrap;
}

.status-allowed {
    background: #e9ecef;
    color: #495057;
}

.status-blocked {
    background: #e9ecef;
    color: #495057;
}

.friend-actions {
    display: flex;
    gap: 10px;
}

.friend-actions button {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-remove {
    background: #dc3545;
}

.btn-remove:hover {
    background: #c82333;
}

/* Utility Classes */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error {
    text-align: center;
    padding: 40px;
    color: #495057;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #007bff;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.no-access {
    text-align: center;
    padding: 60px 20px;
}

.no-access-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

/* Responsive - Mobile layout (including landscape) */
@media (max-width: 1024px) and (pointer: coarse), (max-width: 768px), (hover: none) and (pointer: coarse) {
    body {
        overflow-x: hidden;
        width: 100%;
        padding-top: 70px; /* Space for fixed top header */
        padding-bottom: 70px; /* Space for fixed bottom nav */
    }
    
    .container {
        padding: 10px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1000;
        border-radius: 0;
        margin-bottom: 0;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    header h1 {
        font-size: 20px;
        margin-bottom: 0;
        font-weight: bold;
        text-align: center;
        width: 100%;
    }

    header nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #dee2e6;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 10px 0;
        margin: 0;
        width: 100%;
        z-index: 1000;
        gap: 0;
    }
    
    header nav a {
        padding: 10px 8px;
        font-size: 12px;
        flex: 1;
        text-align: center;
        border-radius: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 12px;
        font-weight: 700;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .actions {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .actions-buttons {
        flex-direction: row;
        width: auto;
    }
    
    .actions-buttons button {
        flex: 1;
        min-width: 0;
    }
    
    .action-message {
        width: 100%;
        min-width: auto;
        white-space: normal;
    }
    
    .sessions-table {
        padding: 10px;
        overflow-x: auto;
    }

    .form-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-group {
        width: 100%;
    }

    table {
        font-size: 12px;
        min-width: 600px;
    }

    th, td {
        padding: 8px;
    }
    
    .modal-content {
        max-width: min(400px, 95%);
        width: min(400px, 95%);
        margin: 20px auto;
        padding: 20px;
        max-height: 85vh;
    }
    
    .modal-content-compact {
        max-width: min(400px, 95%);
        width: min(400px, 95%);
    }

    .add-friend-form {
        flex-direction: column;
    }
    
    .handle-display {
        font-size: 18px;
        padding: 0 10px;
    }
    
    .friend-uid {
        font-size: 12px;
        padding: 0 10px;
    }
    
    .friend-request-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .friend-request-header-compact {
        width: 100%;
    }
    
    .friend-request-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .friend-request-actions .btn {
        flex: 1;
    }
    
    .handle-section {
        padding: 20px 15px;
    }
}

/* Plot Page */
.plot-container {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    height: calc(95vh - 120px - 60px); /* 95% of viewport minus header (120px) and margins (60px) */
    min-height: 400px;
}

.plot-container h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    flex-shrink: 0;
    font-size: 18px;
}

#profitChart {
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* Filters */
.filters-toggle-container {
    margin-bottom: 20px;
}

.filters-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.filters-sidebar.active {
    right: 0;
}

.filters-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.filters-sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.filters-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
}

.filters-close:hover {
    color: #333;
}

.filters-content {
    padding: 20px;
}

.filter-section {
    margin-bottom: 25px;
}

.filter-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.date-filter-select {
    width: auto;
    max-width: 200px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.date-filter-select:focus {
    outline: none;
    border-color: #007bff;
}

.custom-date-range {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.date-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.date-input:focus {
    outline: none;
    border-color: #007bff;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 2px 2px;
    border-radius: 4px;
    transition: background 0.2s;
}

.filter-checkbox:hover {
    background: #f8f9fa;
}

.filter-checkbox-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #999;
}

.filter-checkbox-disabled:hover {
    background-color: transparent;
}

.filter-checkbox input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.filter-checkbox input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.filter-checkbox span {
    font-size: 14px;
    color: #333;
}

.filter-checkbox-disabled span {
    color: #999;
}

/* Plot Axis Selector */
.axis-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
}

.axis-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.axis-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.axis-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Filters Page */
.filters-page {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.filters-page h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
}

.filters-page .filter-section {
    margin-bottom: 30px;
}

.filters-page .filter-section h3 {
    margin-bottom: 10px;
    color: #495057;
}

.filters-page .filter-section p {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

.filters-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    transition: opacity 0.3s ease;
}

.filters-overlay.active {
    display: block;
}

@media (max-width: 1024px) and (pointer: coarse), (max-width: 768px), (hover: none) and (pointer: coarse) {
    .filters-sidebar {
        width: 280px;
        right: -280px;
    }
    
    .plot-container {
        padding: 15px;
        margin-bottom: 20px;
        height: calc(95vh - 70px - 70px - 40px); /* 95% of viewport minus header (70px), bottom nav (70px), and margins (40px) */
        min-height: 300px;
    }
    
    .plot-container h2 {
        margin-bottom: 15px;
        font-size: 16px;
    }
    
    #profitChart {
        flex: 1;
        min-height: 0;
        width: 100%;
    }
}