/* ========================================
   CSS VARIABLES FOR THEMING
   ======================================== */

/* Light Theme (Default) */
:root {
    /* Background Colors */
    --bg-primary: #fff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #f1f1f1;
    --bg-accent: #f8f9fa;
    --bg-hover: #fafbfc;
    --bg-even-row: #fafbfc;
    --bg-hover-even: #f1f3f4;

    /* Text Colors */
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --text-inverse: #fff;

    /* Border Colors */
    --border-primary: #007bff;
    --border-secondary: #ddd;
    --border-light: #f0f4f8;
    --border-table: #e0e6ed;

    /* Button Colors */
    --btn-primary-start: #007bff;
    --btn-primary-end: #0056b3;
    --btn-primary-hover-start: #0056b3;
    --btn-primary-hover-end: #004085;

    --btn-danger-start: #dc3545;
    --btn-danger-end: #c82333;
    --btn-danger-hover-start: #c82333;
    --btn-danger-hover-end: #a02622;

    --btn-secondary-start: #6c757d;
    --btn-secondary-end: #495057;
    --btn-secondary-hover-start: #495057;
    --btn-secondary-hover-end: #343a40;

    /* Shadow Colors */
    --shadow-light: rgba(0, 0, 0, 0.06);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-primary: rgba(0, 123, 255, 0.2);
    --shadow-primary-hover: rgba(0, 123, 255, 0.3);
    --shadow-danger: rgba(220, 53, 69, 0.2);
    --shadow-danger-hover: rgba(220, 53, 69, 0.3);
    --shadow-secondary: rgba(108, 117, 125, 0.2);
    --shadow-secondary-hover: rgba(108, 117, 125, 0.3);

    /* Modal & Overlay */
    --modal-overlay: rgba(0, 0, 0, 0.4);
    --modal-bg: #fff;

    /* Status Colors */
    --color-positive: green;
    --color-negative: red;
    --color-error-bg: #f8d7da;
    --color-error-text: #721c24;
    --color-error-border: #f5c6cb;

    /* Table Header */
    --table-header-start: #007bff;
    --table-header-end: #0056b3;
    --table-header-border: rgba(255, 255, 255, 0.2);

    /* Info Box */
    --info-bg: #fff3cd;
    --info-border: #ffeaa7;
    --info-text: #856404;

    /* Disabled State */
    --disabled-bg: #f8f9fa;
    --disabled-text: #6c757d;
    --disabled-border: #dee2e6;
    --label-color: #212529;

    /* Input Styles */
    --input-bg: #ffffff;
    --input-text: #212529;
    --input-border: #ced4da;
    --input-focus-border: #80bdff;
    --input-focus-shadow: rgba(0, 123, 255, 0.25);
    --timezone-text: #6c757d;
    --picker-filter: none;

    /* Equity Form Specific Colors */
    --equity-form-bg: #f9f9f9;
    --equity-panel-header-bg: #e9ecef;
    --equity-total-color: #2c5aa0;
    --equity-total-bg: #e8f4fd;
    --equity-shadow: rgba(0, 0, 0, 0.1);
    --equity-focus-shadow: rgba(44, 90, 160, 0.1);
}

/* Dark Theme */
[data-theme="dark"] {
    /* Background Colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #333333;
    --bg-accent: #2a2a2a;
    --bg-hover: #3a3a3a;
    --bg-even-row: #242424;
    --bg-hover-even: #353535;

    /* Text Colors */
    --text-primary: #f2f1f1;
    --text-secondary: #c0c0c0;
    --text-muted: #a0a0a0;
    --text-inverse: #fff;

    /* Border Colors */
    --border-primary: #4a9eff;
    --border-secondary: #555;
    --border-light: #404040;
    --border-table: #404040;

    /* Shadow Colors - darker shadows for dark theme */
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-primary: rgba(0, 123, 255, 0.4);
    --shadow-primary-hover: rgba(0, 123, 255, 0.6);
    --shadow-danger: rgba(220, 53, 69, 0.4);
    --shadow-danger-hover: rgba(220, 53, 69, 0.6);
    --shadow-secondary: rgba(108, 117, 125, 0.4);
    --shadow-secondary-hover: rgba(108, 117, 125, 0.6);

    /* Modal & Overlay */
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --modal-bg: #2d2d2d;

    /* Status Colors - adjusted for dark theme */
    --color-positive: #4ade80;
    --color-negative: #f87171;
    --color-error-bg: #442d32;
    --color-error-text: #f8a5b0;
    --color-error-border: #6b2c37;

    /* Table Header - slightly brighter in dark mode */
    --table-header-start: #4a9eff;
    --table-header-end: #2563eb;
    --table-header-border: rgba(255, 255, 255, 0.15);

    /* Disabled State */
    --disabled-bg: #2d3748;
    --disabled-text: #a0aec0;
    --disabled-border: #4a5568;
    --label-color: #e2e8f0;

    /* Info Box */
    --info-bg: #332701;
    --info-border: #664e02;
    --info-text: #ffdf7e;

    /* Input Styles */
    --input-bg: #2d3748;
    --input-text: #e2e8f0;
    --input-border: #4a5568;
    --input-focus-border: #63b3ed;
    --input-focus-shadow: rgba(99, 179, 237, 0.25);
    --timezone-text: #a0aec0;
    --picker-filter: invert(1);

    /* Equity Form Specific Colors for Dark Mode */
    --equity-form-bg: #2d2d2d;
    --equity-panel-header-bg: #3d3d3d;
    --equity-total-color: #4a9eff;
    --equity-total-bg: #1e3a5f;
    --equity-shadow: rgba(0, 0, 0, 0.4);
    --equity-focus-shadow: rgba(74, 158, 255, 0.2);
}

/* ========================================
   UPDATED STYLES USING VARIABLES
   ======================================== */

/* Base Styles */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

h1 {
    color: var(--text-primary);
}

/* Layout Components */
.container {
    display: flex;
    height: 100vh;
}

.navigation {
    background-color: var(--bg-tertiary);
    flex-shrink: 0;
    width: 200px;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
}

.content {
    background-color: var(--bg-primary);
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Input Fields */
.datetime-field input[type="date"],
.datetime-field input[type="time"],
input[type="number"] {
    background-color: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    border-radius: 4px;
}

.datetime-field input[type="date"]:focus,
.datetime-field input[type="time"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 2px var(--input-focus-shadow);
}

/* Navigation Buttons */
.button-container {
    flex-direction: column;
}

.button {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
    margin-bottom: 15px;
    padding: 10px 10px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    text-align: left;
    list-style-type: none;
    margin-left: -20px;
}

.button-container .button {
    cursor: default;
    user-select: none;
}

.button:hover {
    background-color: var(--bg-hover);
}

.button.active {
    background-color: var(--text-secondary);
}

/* Summary Boxes and Containers */
.summary-box,
.charts-container,
.trade-list-container,
#trade-list-container,
#trade-list-pnl-container {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    text-align: center;
    padding: 10px;
    border-radius: 5px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 5px;
}

/* Trade Tables */
.trade-table-scroll {
    border: 1px solid var(--border-table);
    background: var(--bg-primary);
    box-shadow: 0 2px 4px var(--shadow-light);
    max-height: 600px;
    min-height: 200px;
    overflow-y: auto;
    overflow-x: auto;
    width: 100%;
    margin-bottom: 20px;
    padding: 0;
    border-radius: 8px;
    box-sizing: border-box;
    /* Add this for consistency */
}

.trade-table-scroll table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    font-size: 14px;
}

.trade-table-scroll table thead {
    background: linear-gradient(135deg, var(--table-header-start) 0%, var(--table-header-end) 100%);
    z-index: 11;
}

.trade-table-scroll table th {
    background: linear-gradient(135deg, var(--table-header-start) 0%, var(--table-header-end) 100%);
    color: var(--text-inverse);
    border-right: 1px solid var(--table-header-border);
    box-shadow: 0 2px 4px var(--shadow-medium);
    position: sticky;
    top: 0;
    z-index: 12;
    border: none;
    box-sizing: border-box;
    margin: 0;
    padding: 12px 8px;
    font-weight: 600;
    text-align: center;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.trade-table-scroll table th:last-child {
    border-right: none;
}

.trade-table-scroll table td {
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    background-color: var(--bg-secondary);
    padding: 10px 8px;
    border: none;
    vertical-align: middle;
    transition: background-color 0.2s ease;
}


.trade-table-scroll table td:last-child {
    border-right: none;
}

.trade-table-scroll table tbody tr:hover {
    background-color: var(--bg-accent);
}

.trade-table-scroll table tbody tr:nth-child(even) {
    background-color: var(--bg-even-row);
}

.trade-table-scroll table tbody tr:nth-child(even):hover {
    background-color: var(--bg-hover-even);
}

/* Hide transaction table initially */
.transaction-table {
    display: none;
}

/* Buttons and Actions */
.trade-details-button {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    flex: 0 0 auto;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.trade-details-button:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.close-trade-button {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    flex: 0 0 auto;
    margin-left: auto;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.close-trade-button:hover {
    background: linear-gradient(135deg, #c82333 0%, #a02622 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.apply-filters,
.clear-filters {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 6px;
    width: 100px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.apply-filters {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
    padding: 8px 30px;
}

.apply-filters:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.clear-filters {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
    padding: 6px 12px;
}

.clear-filters:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

/* ACTION CELLS AND LAYOUT */
td.actions-cell {
    vertical-align: middle !important;
    height: 100%;
    padding: 5px 10px;
}

.actions-cell {
    display: flex;
    justify-content: center;
    vertical-align: middle !important;
    gap: 15px;
    padding: 5px 10px;
    white-space: nowrap;
}

/* Trade Detail, Notes and Tags */
.trade-details-container {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    display: flex;
    gap: 20px;
    border-radius: 8px;
    padding: 20px;
    flex-wrap: wrap;
    width: 100%;
    /* Ensure full width */
    box-sizing: border-box;
    /* Include padding/border in width calculation */
    /*margin-bottom: 20px; /* Match the margin from trade-table-scroll */
    position: relative;
    /* Add this for positioning separators */
}

/* Add separator lines between boxes */
.trade-details-container::before,
.trade-details-container::after {
    content: '';
    position: absolute;
    max-height: 180px;
    top: 60px;
    /* Start below the padding */
    bottom: 30px;
    /* End above the padding */
    width: 2px;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(0, 0, 0, 0.15) 10%,
            rgba(0, 0, 0, 0.3) 50%,
            rgba(0, 0, 0, 0.15) 90%,
            transparent 100%);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* Position first separator (between trade-details-box and trade-notes) */
.trade-details-container::before {
    left: calc(33.333% + 0px);
    /* Adjust based on flex distribution */
}

/* Position second separator (between trade-notes and trade-tags) */
.trade-details-container::after {
    left: calc(66.666% + 0px);
    /* Adjust based on flex distribution */
}

/* Hide separators when items wrap to new lines on smaller screens */
@media (max-width: 800px) {

    .trade-details-container::before,
    .trade-details-container::after {
        display: none;
    }
}

.trade-details-box,
.trade-notes,
.trade-tags {
    background-color: var(--bg-secondary);
    padding: 15px;
    flex: 1;
    min-width: 200px;
    margin-bottom: 20px;
}

.trade-details-box h4,
.trade-notes h4,
.trade-tags h4 {
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
}

.trade-details-item {
    margin-bottom: 8px;
}

.trade-details-item strong {
    color: var(--text-secondary);
}

.notes-tags-container {
    background-color: var(--bg-secondary);
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.notes-tags-container:has(.trade-notes:only-child) .trade-notes,
.notes-tags-container:has(.trade-tags:only-child) .trade-tags {
    max-width: 600px;
}

.tag-badge {
    display: inline-block;
    padding: 4px 12px;
    margin: 2px 4px 2px 0;
    border-radius: 16px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.tags-container {
    border: 2px solid var(--border-primary);
    background-color: var(--bg-secondary);
    margin: 10px 0;
    padding: 10px;
    border-radius: 1px;
}

.tags-container h4 {
    color: var(--text-primary);
    margin: 0 0 10px 0;
}

.tag-checkbox {
    display: inline-block;
    margin: 5px 10px 5px 0;
    white-space: nowrap;
}

.tag-checkbox input[type="checkbox"] {
    margin-right: 5px;
}

.tag-checkbox label {
    font-size: 0.9em;
    cursor: pointer;
}

.tag-description {
    color: var(--text-muted);
    font-size: 0.8em;
    font-style: italic;
}

/* Forms and Filters */

select:disabled,
input:disabled {
    background-color: var(--disabled-bg);
    color: var(--disabled-text);
    border-color: var(--disabled-border);
    opacity: 1;
    cursor: not-allowed;
}

label {
    color: var(--label-color);
}

.datetime-container {
    display: flex;
    gap: 40px;
    justify-content: flex-start;
    align-items: center;
}

.datetime-field {
    flex: 0;
}

.timezone-info {
    font-size: 0.9em;
    color: #666;
    margin-left: 0px;
}

.filter-container {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    align-items: flex-start;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

.filter-group input,
.filter-group select {
    border: 1px solid var(--border-secondary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 5px;
    border-radius: 3px;
}

.filter-buttons-group {
    margin-left: auto !important;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 110px;
}

/* Collapsible Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #007bff;
}

.section-title {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
}

.minimize-button {
    color: var(--border-primary);
    border: 2px solid var(--border-primary);
    background: transparent;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 0;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
}

.minimize-button:hover {
    color: var(--btn-primary-hover-start);
    border-color: var(--btn-primary-hover-start);
    background-color: rgba(0, 123, 255, 0.05);
}

.minimize-button:active {
    background-color: rgba(0, 123, 255, 0.1);
}

/* Collapsible content */
.collapsible-content {
    transition: all 0.3s ease-out;
    overflow: hidden;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.collapsible-content:not(.collapsed) {
    max-height: 5000px;
    /* Adjust based on your content - Increased from 1000px */
    opacity: 1;
}

/* Ensure summary-box and trade-list-container have relative positioning for the header */
.summary-box,
.trade-list-container,
#trade-list-container,
#trade-list-pnl-container {
    position: relative;
}

/* Adjust padding for containers with headers */
.summary-box.has-header,
.trade-list-container.has-header,
#trade-list-container.has-header,
#trade-list-pnl-container.has-header {
    padding-top: 15px;
}

/* Info Box Styles */
.close-trade-info {
    background-color: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-text);
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid;
}

/* Modals and Popups */
.modal {
    background-color: var(--modal-overlay);
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
}

.modal-content {
    background-color: var(--modal-bg);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    margin: 10% auto;
    padding: 20px;
    width: 350px;
    border-radius: 8px;
    text-align: center;
}

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

.close-modal {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--text-primary);
}

/* Backup Popup Styles */
.backup-popup-body {
    background-color: var(--bg-secondary);
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    font-size: 14px;
}

.popup-container {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 450px;
    margin: 0 auto;
}

.popup-header {
    border-bottom: 1px solid var(--border-secondary);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.popup-header h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.popup-container .form-group {
    margin-bottom: 15px;
}

.popup-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.popup-container input[type="text"] {
    border: 1px solid var(--border-secondary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.button-group {
    text-align: right;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.popup-container button {
    padding: 8px 16px;
    margin-left: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

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

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

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

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

.account-info {
    background-color: var(--bg-accent);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 13px;
}

.help-text {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 5px;
}

/* Utility Classes */
.user-info {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    position: fixed;
    bottom: 0;
    left: 0;
    width: 9%;
    padding: 10px;
    text-align: left;
    z-index: 1000;
}

.negative {
    color: var(--color-negative);
    font-weight: bold;
}

.positive {
    color: var(--color-positive);
    font-weight: bold;
}

#results-container {
    margin-top: 20px;
}

.no-results {
    color: var(--text-muted);
    padding: 20px;
    text-align: center;
    font-style: italic;
}

.error-message {
    background-color: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Edit Notes Modal Specific Styles */
#edit-notes-modal .modal-content {
    width: 400px;
    /* A bit wider for the textarea */
    max-width: 90%;
    text-align: left;
}

#edit-notes-modal h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 18px;
    border-bottom: 1px solid var(--border-secondary);
    padding-bottom: 10px;
}

#edit-notes-modal textarea {
    width: 100%;
    min-height: 150px;
    padding: 10px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    background-color: var(--input-bg);
    color: var(--input-text);
    box-sizing: border-box;
}

#edit-notes-modal textarea:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 2px var(--input-focus-shadow);
}

/* Delete Trade Button */
.delete-trade-button {
    background: linear-gradient(135deg, var(--btn-danger-start) 0%, var(--btn-danger-end) 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow-danger);
}

/* Edit Tags Button */
.edit-tags-button {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(23, 162, 184, 0.2);
}

/* Dropdown and Filter Styles */
.dropdown-multiselect .dropdown-list {
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: absolute;
    z-index: 1000;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
    width: 180px;
    display: none;
}

.dropdown-multiselect .dropdown-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    border: 1px solid #ccc;
    cursor: pointer;
    padding: 5px 10px;
    width: 180px;
    text-align: left;
}

#date-range {
    border: 1px solid var(--border-secondary);
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 200px;
    padding: 5px 10px;
    cursor: pointer;
}

/* Date range container styling */
.date-range-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-preset-group {
    display: flex;
    flex-direction: column;
}

.custom-date-group {
    display: flex;
    flex-direction: column;
}

/* ========================================
   TRANSACTION FORM STYLES
   ======================================== */

.form-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0;
}

.multileg-form-layout {
    max-width: 1600px;
}

.trade-input-container {
    flex: 2;
    min-width: 500px;
}


.notes-tags-panel {
    flex: 1;
    min-width: 350px;
    position: sticky;
    top: 20px;
}

.trade-input-panel,
.notes-tags-panel {
    background: var(--equity-form-bg);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--equity-shadow);
}

.trade-input-header,
.panel-header {
    background: var(--equity-panel-header-bg);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-secondary);
    border-radius: 8px 8px 0 0;
}

.trade-input-header h3,
.panel-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.trade-input-content,
.panel-content {
    padding: 20px;
}

.input-section {
    margin-bottom: 20px;
}

.input-table {
    width: 100%;
    border-collapse: separate;
}

.input-table tr {
    border-bottom: 1px solid var(--border-light);
}

.input-table tr:last-child {
    border-bottom: none;
}

#optionTradeTable td {
    padding: 10px;
}

.input-label {
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    padding: 12px 5px 12px 0;

    white-space: nowrap;
}

/* More specific targeting for the first labels in each row */
.input-table tr:first-child .input-label:first-of-type,
/* Date label */
.input-table tr:nth-child(2) .input-label:first-of-type,
/* Symbol label */
.input-table tr:nth-child(3) .input-label:first-of-type

/* Order Type label */
    {
    width: auto !important;
    /* Override the 5% width */
    padding-right: 5px !important;
    /* Reduce spacing */
    min-width: fit-content;
    /* Allow natural width */
}

/* Also target their adjacent input fields to reduce any extra spacing */
.input-table tr:first-child .input-field:first-of-type,
/* Date input field */
.input-table tr:nth-child(2) .input-field:first-of-type,
/* Symbol input field */
.input-table tr:nth-child(3) .input-field:first-of-type

/* Order Type input field */
    {
    padding-left: 0 !important;
    /* Remove left padding from input field */
}

.input-field {
    padding: 12px 0;
}

.input-control {
    width: 100%;
    max-width: 100px;
    padding: 8px 12px;
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.multileg-table-input-control,
.multileg-table-qty-input-control,
.multileg-table-commission-input-control {
    width: 100%;
    max-width: 100px;
    padding: 8px 12px;
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-left: 20px;
    margin-right: 20px;
}

.multileg-table-time-input-control {
    width: 100%;
    max-width: 100px;
    margin-left: 20px;
    margin-right: 20px;
    padding: 8px 12px;
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.multileg-table-button {
    width: auto;
    /* or set a specific width */
    padding: 8px 12px;
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-left: 20px;
    margin-right: 20px;
    cursor: pointer;
    /* shows it's clickable */
}

.multileg-table-button:hover {
    border-color: var(--border-primary, #007bff);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.input-control:focus {
    outline: none;
    border-color: var(--equity-total-color);
    box-shadow: 0 0 0 2px var(--equity-focus-shadow);
}

.input-control:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
}

.datetime-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.date-input,
.time-input {
    max-width: 140px;
}

.timezone-info {
    color: var(--timezone-text);
    font-size: 12px;
    white-space: nowrap;
}

.total-row {
    border-top: 2px solid var(--border-secondary);
    background: var(--bg-accent);
}

.total-row .input-label {
    font-weight: 700;
    color: var(--equity-total-color);
    font-size: 1.1em;
}

.total-display {
    font-weight: 700;
    font-size: 1.2em;
}

.total-value {
    color: var(--equity-total-color);
    font-family: monospace;
    font-size: 1.3em;
    padding: 8px 12px;
    background: var(--input-bg);
    border: 2px solid var(--equity-total-color);
    border-radius: 4px;
    display: inline-block;
    min-width: 120px;
    text-align: center;
    transition: all 0.3s ease;
}

.total-value.has-value {
    background: var(--equity-total-bg);
    box-shadow: 0 2px 4px var(--equity-focus-shadow);
}

.submit-section {
    border-top: 1px solid var(--border-light);
    padding-top: 20px;
    text-align: center;
}

.submit-button {
    background: var(--equity-total-color);
    color: var(--text-inverse);
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
}

.submit-button:hover {
    background: var(--btn-primary-hover-start);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.submit-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px var(--shadow-light);
}

/* NEW: Container for side-by-side notes and tags on forms */
.notes-tags-container-form {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
    /* Changed from flex-start to make children equal height */
}

.notes-tags-container-form .notes-section {
    flex: 2;
    /* Takes 2/3 of the space */
    min-width: 300px;
    display: flex;
    /* Add flex display to allow textarea to grow */
    flex-direction: column;
    /* Stack label and textarea vertically */
}

.notes-tags-container-form .tags-container {
    flex: 1;
    /* Takes 1/3 of the space */
    min-width: 250px;
}

/* Equity Form Notes and Tags Styling */
.notes-section {
    display: flex;
    flex-direction: column;

}

.notes-section label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.notes-section textarea {
    width: 99%;
    padding: 5px;
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
    flex-grow: 1;
    /* Allow textarea to fill available vertical space on both forms */
    background: var(--input-bg);
    color: var(--input-text);
}

.notes-section textarea:focus {
    outline: none;
    border-color: var(--equity-total-color);
    box-shadow: 0 0 0 2px var(--equity-focus-shadow);
}

.tags-container h4 {
    color: var(--text-secondary);
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 4px 0;
}

.tag-checkbox input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.tag-checkbox label {
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
}

.tag-description {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

/* Additions for import_transactions.php side-by-side layout and scrollable preview */

/* Container for input and preview sections */
.import-input-and-preview-container {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

/* Input section styling */
.import-input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 5px;
    min-width: 300px;
    max-width: 400px;

}

/* Preview section styling */
.import-preview-section {
    flex: 2;
    display: flex;
    flex-direction: column;
    padding: 5px;
    min-width: 400px;
    max-width: 1800px;
}

/* Scrollable preview table container */
.import-preview-table-container {
    max-height: 369px;
    overflow-y: auto;
    table-layout: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
}

.import-preview-table-container th,
.import-preview-table-container td {
    padding: 5px 10px;
    /* Increase padding for spacing */
    min-width: 10px;
    /* Minimum column width for readability */
}

/* Center Option Type (7th column) and Trade Type (10th column) */
.import-preview-table-container th:nth-child(9),
.import-preview-table-container td:nth-child(9),
.import-preview-table-container th:nth-child(10),
.import-preview-table-container td:nth-child(10) {
    text-align: center;
}

/* Ensure table headers are sticky */
.import-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--table-header-bg);
}

.charts-block {
    display: flex;
    justify-content: space-around;
    /* even spacing */
    align-items: center;
    gap: 20px;
    /* space between charts */
    margin-top: 20px;
}

.chart-box {
    flex: 1;
    /* all equal width */
    max-width: 300px;
    /* keeps them from stretching too big */
    text-align: center;
}

.chart-title {
    text-align: center;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.profit-chart-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    /* More rounded corners */
    flex: 1;
    /* all equal width */
    max-width: 500px;
    /* Adjusted for horizontal bar charts */
    text-align: center;
    padding: 15px;
    /* Add some internal spacing */
    margin: 10px;
    /* Add space between chart boxes */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Optional: subtle shadow */
}

/* Set a consistent minimum height for all horizontal bar charts */
#profitLongShortChart {
    min-height: 300px !important;
}

#profitOptionEquityChart {
    min-height: 300px !important;
}

#profitPutCallChart {
    min-height: 300px !important;
}

#profitSpreadTypeChart {
    min-height: 300px !important;
}

#profitStrategiesChart {
    min-height: 300px !important;
}

#timeframeDistributionChart {
    height: 300px !important;
}

#timeframePnLChart {
    min-height: 300px !important;
}

.timeframe-charts-wrapper {
    display: flex;
    flex-wrap: nowrap;
    /* Prevent wrapping to new line */
    gap: 20px;
    justify-content: center;
    /* Center the charts within the available space */
    width: 100%;
    /* Ensure it takes full width of its container */
}

/* NEW: Override for timeframe charts to allow them to be wider */
.timeframe-charts-wrapper .chart-box {
    max-width: 600px;
    /* Increased from 500px for better spacing */
    flex-grow: 1;
    /* Ensure they can grow to fill space */
}

/* Symbol Insights Styles */
.symbol-insights-wrapper {
    display: flex;
    justify-content: space-evenly;
    gap: 30px;
    padding: 20px 0;
    overflow-x: auto;
    min-width: 900px;
}

.symbol-table-container {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
}

.symbol-table-container h4 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 16px;
}

.toggle-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.instrument-toggle {
    display: inline-flex;
    background: var(--bg-tertiary);
    border-radius: 25px;
    padding: 3px;
    box-shadow: inset 0 2px 4px var(--shadow-light);
}

.toggle-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    min-width: 70px;
}

.toggle-btn:hover {
    color: var(--text-primary);
}

.toggle-btn.active {
    background: var(--bg-primary);
    color: var(--border-primary);
    box-shadow: 0 2px 4px var(--shadow-medium);
}

.symbol-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    box-shadow: 0 2px 4px var(--shadow-medium);
    border-radius: 8px;
    overflow: hidden;
}

.symbol-table thead {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-secondary);
}

.symbol-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Right-align numeric column headers */
.symbol-table th:nth-child(2),
.symbol-table th:nth-child(3) {
    text-align: right;
}

.symbol-table tbody tr {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
}

.symbol-table tbody tr:hover {
    background-color: var(--bg-hover);
}

.symbol-table tbody tr:last-child {
    border-bottom: none;
}

.symbol-table td {
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-primary);
}

.symbol-cell {
    font-weight: 600;
    color: var(--text-primary);
}

.value-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.value-cell.positive {
    color: var(--color-positive);
    font-weight: 600;
}

.value-cell.negative {
    color: var(--color-negative);
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .symbol-insights-wrapper {
        flex-direction: column;
        align-items: center;
        min-width: auto;
    }

    .symbol-table-container {
        max-width: 500px;
        width: 100%;
    }
}

/* End of Symbol Insights Styles */

/* NEW: Metric Selector Styles */
.metric-selector-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 20px;
    justify-content: center;
}

.metric-button {
    padding: 10px 20px;
    border: 1px solid var(--border-secondary);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.metric-button:hover {
    border-color: var(--border-primary);
    color: var(--border-primary);
}

.metric-button.active {
    background: var(--equity-total-color);
    color: var(--text-inverse);
    border-color: var(--equity-total-color);
}

/* User Preferences Form Specific Styles */

/* Default Account Settings - Two Column Layout */
.input-section h4.section-header {
    margin-bottom: 15px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-primary);
    padding-bottom: 8px;
}

/* Make the account settings table responsive with proper spacing */
.input-section table.input-table tr td.input-label {
    width: 140px;
    padding-right: 10px;
    white-space: nowrap;
}

.input-section table.input-table tr td.input-field {
    padding-left: 0;
}

/* Expand timezone and spread type fields */
#default_timezone {
    min-width: 300px;
    max-width: 350px;
}

#default_spreadtype {
    min-width: 150px;
    max-width: 200px;
}

/* Adjust brokerage account and color scheme fields */
#default_brokerage_account {
    min-width: 200px;
}

#color_scheme {
    min-width: 100px;
}

/* Filter Settings - Side by Side Layout */
.filter-preference-section {
    display: inline-block;
    width: 500px;
    vertical-align: top;
    margin-bottom: 20px;
}

.filter-preference-section:first-child {
    margin-right: 10%;
}

.filter-preference-section h5 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.filter-preference-section .account-checkbox-container {
    max-height: 150px;
    max-width: 300px;
}

/* Transaction Defaults - Tighter spacing */
.input-section table.input-table tr td.input-label {
    padding-right: 10px;
}

#default_equity_qty,
#default_equity_commission,
#default_option_qty,
#default_option_commission {
    max-width: 150px;
}

/* Sort Settings - Side by Side Layout */
.sort-section {
    display: inline-block;
    width: 48%;
    vertical-align: top;
    margin-bottom: 20px;
}

.sort-section:first-child {
    margin-right: 3%;
}

.sort-section h5 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 5px;
}

/* Tighter spacing for sort dropdowns */
.sort-section table.input-table tr td.input-label {
    width: 60px;
    padding-right: 10px;
}

.sort-section table.input-table tr td.input-field {
    padding-left: 0;
    padding-right: 10px;
}

.sort-section select.input-control {
    width: 100%;
    max-width: 180px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {

    .filter-preference-section,
    .sort-section {
        display: block;
        width: 100%;
        margin-right: 0;
    }

    .filter-preference-section:first-child,
    .sort-section:first-child {
        margin-right: 0;
        margin-bottom: 20px;
    }
}

/* User Management Form Specific Styles */
#userID,
#name,
#email {
    min-width: 250px;
    max-width: 300px;
}

/* Tighter spacing for user management form */
body:has(form[action*="user_management_form"]) .input-table tr td.input-label {
    width: 80px;
    padding-right: 8px;
}

body:has(form[action*="user_management_form"]) .input-table tr td.input-field {
    padding-left: 0;
}

/* ========================================
   SCHWAB INTEGRATION PAGE STYLES
   ======================================== */

/* Debug Console */
.debug-section {
    background-color: #1e1e1e;
    color: #00ff00;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid var(--border-primary);
}

.debug-section h3 {
    color: #ffff00;
    margin-top: 0;
    margin-bottom: 15px;
}

.debug-log {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Configuration Section */
.schwab-config-section {
    background-color: var(--info-bg);
    border: 2px solid var(--info-border);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.schwab-config-section h3 {
    color: var(--info-text);
    margin-top: 0;
    margin-bottom: 10px;
}

.schwab-config-section p {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.schwab-config-input {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
}

.schwab-config-input label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
}

.schwab-config-input input {
    padding: 8px 12px;
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
}

.schwab-config-input input:focus {
    outline: none;
    border-color: var(--equity-total-color);
    box-shadow: 0 0 0 2px var(--equity-focus-shadow);
}

/* Button Styles for Schwab Page */
.schwab-btn {
    background: var(--equity-total-color);
    color: var(--text-inverse);
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 5px;
}

.schwab-btn:hover {
    background: var(--btn-primary-hover-start);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.schwab-btn:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.schwab-btn-danger {
    background: linear-gradient(135deg, var(--btn-danger-start) 0%, var(--btn-danger-end) 100%);
    box-shadow: 0 2px 4px var(--shadow-danger);
}

.schwab-btn-danger:hover {
    background: linear-gradient(135deg, var(--btn-danger-hover-start) 0%, var(--btn-danger-hover-end) 100%);
    box-shadow: 0 4px 8px var(--shadow-danger-hover);
}

.schwab-btn-debug {
    background: #4caf50;
}

.schwab-btn-debug:hover {
    background: #45a049;
}

/* Status Messages */
.schwab-status {
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.schwab-status.success {
    background-color: var(--equity-total-bg);
    color: var(--equity-total-color);
}

.schwab-status.error {
    background-color: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
}

.schwab-status.info {
    background-color: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

.schwab-status.warning {
    background-color: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* Data Grid Layout */
.schwab-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.schwab-data-card {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-secondary);
    box-shadow: 0 2px 4px var(--shadow-light);
}

.schwab-data-card h4 {
    margin: 0 0 10px 0;
    color: var(--border-primary);
    font-size: 16px;
}

.schwab-data-card p {
    margin: 5px 0;
    color: var(--text-primary);
    font-size: 14px;
}

/* Quote Input Row */
.schwab-quote-input {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.schwab-quote-input input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--input-text);
    font-size: 14px;
}

.schwab-quote-input input:focus {
    outline: none;
    border-color: var(--equity-total-color);
    box-shadow: 0 0 0 2px var(--equity-focus-shadow);
}

/* Schwab Tables */
.schwab-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.schwab-table thead {
    background: linear-gradient(135deg, var(--table-header-start) 0%, var(--table-header-end) 100%);
}

.schwab-table th {
    padding: 12px 8px;
    text-align: left;
    color: var(--text-inverse);
    font-weight: 600;
    font-size: 13px;
    border-right: 1px solid var(--table-header-border);
}

.schwab-table th:last-child {
    border-right: none;
}

.schwab-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 14px;
}

.schwab-table tbody tr {
    background-color: var(--bg-secondary);
    transition: background-color 0.2s ease;
}

.schwab-table tbody tr:nth-child(even) {
    background-color: var(--bg-even-row);
}

.schwab-table tbody tr:hover {
    background-color: var(--bg-hover);
}

/* Loading State */
.schwab-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {

    .filter-preference-section,
    .sort-section {
        display: block;
        width: 100%;
        margin-right: 0;
    }

    .filter-preference-section:first-child,
    .sort-section:first-child {
        margin-right: 0;
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {

    #default_timezone,
    #default_spreadtype {
        min-width: 100%;
        max-width: 100%;
    }

    #userID,
    #name,
    #email {
        min-width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {

    #default_timezone,
    #default_spreadtype {
        min-width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 1200px) {
    .form-layout {
        flex-direction: column;
    }

    .notes-tags-panel {
        position: static;
    }

    .trade-input-container {
        min-width: auto;
    }

    .notes-tags-panel {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .notes-tags-container {
        flex-direction: column;
    }

    .trade-notes,
    .trade-tags {
        min-width: 100%;
    }

    .datetime-input-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .date-input,
    .time-input {
        max-width: none;
        width: 100%;
    }

    .input-control {
        max-width: none;
    }

    .input-table {
        font-size: 14px;
    }

    .input-label {
        width: 100%;
        padding-bottom: 4px;
    }

    .input-field {
        padding-top: 0;
    }

    .input-table tr {
        display: block;
        margin-bottom: 15px;
        border-bottom: none;
        padding-bottom: 15px;
        border-bottom: 1px solid var(--border-light);
    }

    .input-table td {
        display: block;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .import-input-and-preview-container {
        flex-direction: column;
    }

    .import-input-section,
    .import-preview-section {
        max-width: 100%;
        min-width: 100%;
    }
}

/* ========================================
   DARK MODE TOGGLE BUTTON
   ======================================== */
.theme-toggle {
    position: fixed;
    bottom: 60px;
    left: 10px;
    background: linear-gradient(135deg, var(--btn-secondary-start) 0%, var(--btn-secondary-end) 100%);
    color: var(--text-inverse);
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow-secondary);
    z-index: 1001;
    width: calc(9% - 20px);
    text-align: center;
}

.theme-toggle:hover {
    background: linear-gradient(135deg, var(--btn-secondary-hover-start) 0%, var(--btn-secondary-hover-end) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-secondary-hover);
}

/* Edit Tags Modal Specific Styles */
#edit-tags-modal .modal-content {
    width: 450px;
    max-width: 90%;
}

.tags-container-modal {
    max-height: 400px;
    overflow-y: auto;
    text-align: left;
    padding: 10px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
}

/* Smooth transition for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
/* Icon Buttons for Trade Actions */
.trade-details-button,
.edit-notes-button,
.edit-tags-button,
.close-trade-button {
    padding: 6px !important;
    width: 32px;
    height: 32px;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
}

.trade-details-button svg,
.edit-notes-button svg,
.edit-tags-button svg,
.close-trade-button svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* Define edit-notes-button if missing */
.edit-notes-button {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529; /* Dark text for yellow background */
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.2);
    margin: 2px;
    transition: all 0.2s ease;
}

.edit-notes-button:hover {
    background: linear-gradient(135deg, #e0a800 0%, #c69500 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}

/* Adjust actions cell gap */
.actions-cell {
    gap: 8px !important;
}

