/* ============================================= */
/* ANIMATIONS                                    */
/* ============================================= */

/* Pulse Animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(253, 126, 20, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(253, 126, 20, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(253, 126, 20, 0);
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Slide In Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Up Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================= */
/* TABLE BASE STYLES                             */
/* ============================================= */

/* Table Container */
.table-container {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: white;
    margin-bottom: 20px;
}

/* Editable Table Base */
.editable-table {
    margin-bottom: 0;
    font-size: 0.85rem;
    width: 100%;
}

.editable-table th,
.editable-table td {
    min-width: 60px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editable-table td {
    cursor: cell;
    vertical-align: middle;
    padding: 6px 4px;
    transition: background-color 0.2s ease;
    position: relative;
}

.editable-table td:hover {
    background-color: #f8f9fa !important;
}

.editable-table td[contenteditable="true"]:focus {
    background-color: #fff9c4 !important;
    outline: 2px solid #4dabf7;
    outline-offset: -2px;
}

/* ============================================= */
/* TABLE HEADER STYLES                           */
/* ============================================= */

.editable-table thead {
    border-bottom: 2px solid #dee2e6;
}

.editable-table thead th {
    text-align: center;
    vertical-align: middle;
    border: 1px solid #6c757d !important;
    font-weight: 600;
    color: #212529 !important;
    position: relative;
}

.editable-table thead tr:first-child th {
    background-color: #adb5bd !important;
    color: #212529 !important;
    border: 1px solid #6c757d !important;
    font-size: 0.9rem;
    padding: 8px 4px;
}

.editable-table thead tr:last-child th {
    background-color: #ced4da !important;
    color: #212529 !important;
    border: 1px solid #6c757d !important;
    font-size: 0.8rem;
    padding: 6px 3px;
}

/* Position Headers */
th:nth-child(16), /* Cur Price */
th:nth-child(17), /* Qty */
th:nth-child(18) { /* Amount */
    background-color: #f8f9fa;
    color: #198754;
    font-weight: 600;
}

/* ============================================= */
/* TABLE BODY STYLES                             */
/* ============================================= */

.editable-table tbody tr {
    transition: background-color 0.2s ease;
}

.editable-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.editable-table tbody tr:hover {
    background-color: #f0f8ff;
}

.editable-table tbody tr:last-child td {
    border-bottom: 1px solid #dee2e6;
}

/* ============================================= */
/* COLUMN WIDTHS                                 */
/* ============================================= */

/* Specific Column Widths */
.editable-table th:nth-child(1),
.editable-table td:nth-child(1) { min-width: 30px; max-width: 50px; text-align: center; } /* Item */

.editable-table th:nth-child(2),
.editable-table td:nth-child(2) { min-width: 55px; } /* Code */

.editable-table th:nth-child(3),
.editable-table td:nth-child(3) { min-width: 40px; max-width: 65px; } /* Currency */

.editable-table th:nth-child(4),
.editable-table td:nth-child(4) { min-width: 30px; max-width: 50px; text-align: center; } /* PB */

.editable-table th:nth-child(5),
.editable-table td:nth-child(5) { min-width: 50px; max-width: 70px; } /* Dir */

.editable-table th:nth-child(6),
.editable-table td:nth-child(6) { min-width: 20px; max-width: 40px; text-align: center; } /* Entry_Btn */

.editable-table th:nth-child(7),
.editable-table td:nth-child(7) { min-width: 100px; max-width: 160px; } /* Entry Datetime */

.editable-table th:nth-child(8),
.editable-table td:nth-child(8) { min-width: 40px; max-width: 60px; } /* SL */

.editable-table th:nth-child(9),
.editable-table td:nth-child(9) { min-width: 40px; max-width: 60px; } /* Price */

.editable-table th:nth-child(10),
.editable-table td:nth-child(10) { min-width: 40px; max-width: 60px; text-align: center; } /* Qty */

.editable-table th:nth-child(11),
.editable-table td:nth-child(11) { min-width: 40px; max-width: 60px; } /* TP */

.editable-table th:nth-child(12),
.editable-table td:nth-child(12) { min-width: 20px; max-width: 40px; } /* Exit Btn */

.editable-table th:nth-child(13),
.editable-table td:nth-child(13) { min-width: 100px; max-width: 160px; } /* Exit Datetime */

.editable-table th:nth-child(14),
.editable-table td:nth-child(14) { min-width: 40px; max-width: 60px; } /* Exit Price */

.editable-table th:nth-child(15),
.editable-table td:nth-child(15) { min-width: 40px; max-width: 50px; text-align: center; } /* Exit Qty */

.editable-table th:nth-child(16),
.editable-table td:nth-child(16) { min-width: 50px; max-width: 70px; } /* Current Price */

.editable-table th:nth-child(17),
.editable-table td:nth-child(17) { min-width: 40px; max-width: 60px; } /* Current Qty */

.editable-table th:nth-child(18),
.editable-table td:nth-child(18) { min-width: 70px; max-width: 90px; } /* Current Amount */

.editable-table th:nth-child(19),
.editable-table td:nth-child(19) { min-width: 50px; max-width: 70px; } /* Result */

.editable-table th:nth-child(20),
.editable-table td:nth-child(20) { min-width: 15px; max-width: 40px; } /* RiskRatio */

.editable-table th:nth-child(21),
.editable-table td:nth-child(21) { min-width: 60px; max-width: 90px; } /* Duration */

.editable-table th:nth-child(22),
.editable-table td:nth-child(22) { min-width: 50px; max-width: 70px; } /* Feature */

.editable-table th:nth-child(23),
.editable-table td:nth-child(23) { min-width: 80px; } /* Think */

.editable-table th:nth-child(24),
.editable-table td:nth-child(24) { min-width: 30px; max-width: 50px; } /* Has */

.editable-table th:nth-child(25),
.editable-table td:nth-child(25) { min-width: 70px; max-width: 90px; } /* Reason */

.editable-table th:nth-child(26),
.editable-table td:nth-child(26) { min-width: 30px; max-width: 60px; text-align: center; } /* (R) */

.editable-table th:nth-child(27),
.editable-table td:nth-child(27),
.editable-table th:nth-child(28),
.editable-table td:nth-child(28) { min-width: 40px; max-width: 50px; } /* Save, Del */

/* ============================================= */
/* BUTTON BASE STYLES                            */
/* ============================================= */

/* Table Button Base */
.btn-table {
    padding: 3px 8px;
    font-size: 0.75rem;
    margin: 1px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-table:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Button Group */
.btn-group-sm > .btn,
.btn-group-vertical > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ============================================= */
/* ACTION BUTTON STYLES                          */
/* ============================================= */

/* Save Button */
.btn-save {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.btn-save:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: white;
}

/* Delete Button */
.btn-delete {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-delete:hover {
    background-color: #c82333;
    border-color: #bd2130;
    color: white;
}

/* ============================================= */
/* ENTRY/EXIT BUTTON STYLES                      */
/* ============================================= */

/* Add Entry/Exit Buttons */
.btn-add-entry, .btn-add-exit {
    padding: 0.1rem 0.3rem !important;
    font-size: 0.8rem !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-add-entry i, .btn-add-exit i {
    font-size: 0.9rem !important;
    margin: 0 !important;
}

.btn-add-entry, .btn-add-exit {
    position: relative !important;
}

.entry-badge, .exit-badge {
    font-size: 0.5rem !important;
    padding: 0.1em 0.3em !important;
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    min-width: 15px;
    height: 15px;
}

.option-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Link Buttons */
.btn-entry-link, .btn-exit-link {
    background-color: #17a2b8 !important;
    border-color: #17a2b8 !important;
    color: white !important;
    font-weight: 500;
    width: 100%;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    text-align: center !important;
    min-height: 32px !important;
}

.btn-entry-link:hover, .btn-exit-link:hover {
    background-color: #138496 !important;
    border-color: #138496 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Link Button Saved State */
.btn-entry-link.btn-secondary, .btn-exit-link.btn-secondary {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
}

.btn-entry-link.btn-secondary:hover, .btn-exit-link.btn-secondary:hover {
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
    color: white !important;
}

/* ============================================= */
/* REMARK BUTTON STYLES                          */
/* ============================================= */

.btn-entry-remark, .btn-exit-remark {
    background-color: #6f42c1 !important;
    border-color: #6f42c1 !important;
    color: white !important;
    font-weight: 500;
    width: 100%;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    text-align: center !important;
    min-height: 32px !important;
}

.btn-entry-remark:hover, .btn-exit-remark:hover {
    background-color: #5a32a3 !important;
    border-color: #5a32a3 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Remark Button Saved State */
.btn-entry-remark.btn-secondary, .btn-exit-remark.btn-secondary {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
}

.btn-entry-remark.btn-secondary:hover, .btn-exit-remark.btn-secondary:hover {
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
    color: white !important;
}

/* ============================================= */
/* NOTE & FEATURE BUTTON STYLES                  */
/* ============================================= */

/* Note Buttons */
.btn-note-input {
    background-color: #6f42c1;
    border-color: #6f42c1;
    color: white;
    font-weight: 500;
}

.btn-note-input:hover {
    background-color: #5a32a3;
    border-color: #512da8;
    color: white;
}

.btn-note-edit {
    background-color: #20c997;
    border-color: #20c997;
    color: white;
}

.btn-note-edit:hover {
    background-color: #199d76;
    border-color: #179b73;
    color: white;
}

/* Feature Buttons */
.btn-feature-input {
    background-color: #6610f2;
    border-color: #6610f2;
    color: white;
    font-weight: 500;
}

.btn-feature-input:hover {
    background-color: #520dc2;
    border-color: #4a0bb5;
    color: white;
}

.btn-feature-edit {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.btn-feature-edit:hover {
    background-color: #0056b3;
    border-color: #004999;
    color: white;
}

/* ============================================= */
/* THINK & MISTAKE BUTTON STYLES                 */
/* ============================================= */

/* Conclusion Buttons */
.editable-table td .btn-think-input {
    background-color: #fd7e14;
    border-color: #fd7e14;
    color: white;
    font-weight: 500;
}

.editable-table td .btn-think-input:hover {
    background-color: #e06c10;
    border-color: #d4650f;
    color: white;
}

/* Mistake Reason Buttons */
.btn-mistake-reason-input {
    background-color: #6610f2;
    border-color: #6610f2;
    color: white;
    font-weight: 500;
}

.editable-table td .btn-info[data-column="mistake_reason"] {
    background-color: #007bff !important;
    border-color: #007bff !important;
    color: white !important;
}

.editable-table td .btn-info[data-column="mistake_reason"]:hover {
    background-color: #0056b3 !important;
    border-color: #004999 !important;
    color: white !important;
}

/* ============================================= */
/* INPUT & FORM STYLES                           */
/* ============================================= */

/* Date and Time Inputs */
.date-input, .time-input {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.8rem;
    width: 95%;
    height: 28px;
    background-color: white;
}

.date-input:focus, .time-input:focus {
    border-color: #4dabf7;
    outline: none;
    box-shadow: 0 0 0 2px rgba(77, 171, 247, 0.2);
}

.datetime-input {
    min-width: 160px;
    cursor: default;
    background-color: #f8f9fa;
    font-size: 0.875rem;
    color: #495057;
    font-weight: 500;
}

.datetime-input:read-only {
    border-color: #dee2e6;
    opacity: 0.9;
}

.datetime-input:focus {
    box-shadow: none;
    border-color: #dee2e6;
    background-color: #f8f9fa;
}

/* Dropdown Styles */
.result-select, .direction-select {
    min-width: 80px;
    cursor: pointer;
}

.direction-long {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724 !important;
    font-weight: bold;
}

.direction-short {
    background-color: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
    font-weight: bold;
}

/* Checkbox Styles */
td[style*="text-align: center"] .form-check {
    margin: 0 auto;
    display: inline-block;
    justify-content: center;
}

.mistake-any-checkbox:checked + label {
    font-weight: bold !important;
    color: #dc3545 !important;
}

.mistake-any-checkbox:not(:checked) + label {
    color: #198754 !important;
}

.mistake-any-checkbox + label {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.mistake-any-checkbox {
    cursor: pointer;
    transform: scale(1.2);
}

/* ============================================= */
/* SPECIAL DISPLAY STYLES                        */
/* ============================================= */

/* Contenteditable Price Fields */
[data-column="entry_price"]:focus,
[data-column="sl"]:focus,
[data-column="tp"]:focus,
[data-column="exit_price"]:focus {
    background-color: #fff3cd !important;
    outline: 2px solid #ffc107;
    border-radius: 3px;
}

/* Risk Ratio */
[data-column="risk_ratio"] {
    font-weight: bold;
    background-color: #f8f9fa !important;
}

/* Result Display */
.result-display {
    font-weight: bold;
    text-align: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    min-width: 60px;
}

.result-win {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.result-loss {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.result-flat {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
}

/* Duration Display */
.duration-display {
    font-family: monospace;
    text-align: center;
    padding: 0.25rem 0.5rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 80px;
}

/* Position Display */
.position-qty-display.text-success {
    color: #198754 !important;
    font-weight: bold;
}

.position-amount-display.text-success {
    color: #198754 !important;
    font-weight: bold;
}

.current-price-display {
    border: 1px solid #198754;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.current-price-display:hover {
    background-color: #e8f5e9 !important;
    border-color: #28a745;
}

.current-price-display.editing {
    background-color: #d4edda !important;
    border-color: #155724;
}

/* ============================================= */
/* VALIDATION STYLES                             */
/* ============================================= */

.invalid-input {
    border: 3px solid #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.valid-input {
    border: 2px solid #28a745 !important;
}

.invalid-input,
.valid-input {
    background-color: transparent !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

td[contenteditable="true"] {
    border: 1px solid #dee2e6;
}

td[contenteditable="true"].invalid-input {
    border: 3px solid #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

td[contenteditable="true"].valid-input {
    border: 2px solid #28a745 !important;
}

/* ============================================= */
/* MODAL BASE STYLES                             */
/* ============================================= */

/* Modal Containers */
.modal-entry-container {
    width: fit-content !important;
    min-width: 100% !important;
    overflow-x: visible !important;
    display: inline-block;
    background: #fafafa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.modal-exit-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: #fafafa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

/* Modal Sizes */
#entryModal .modal-content { min-width: 1000px; }
#exitModal .modal-content { min-width: 900px; }

/* ============================================= */
/* MODAL ENTRY/EXIT ITEM STYLES                  */
/* ============================================= */

/* Entry/Exit Items */
.entry-item-row, .exit-item-row {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #fffaf3;
    border-radius: 4px;
}

.entry-item-row:hover, .exit-item-row:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.entry-item-row input[readonly],
.exit-item-row input[readonly] {
    background-color: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #6c757d !important;
    cursor: not-allowed;
}

/* Modal Row Layout */
.entry-row,
.exit-row {
    display: flex;
    flex-wrap: nowrap;
    margin-bottom: 0.5rem;
}

/* ============================================= */
/* MODAL COLUMN WIDTHS                           */
/* ============================================= */

/* Column Widths for Entry Modal */
.modal-entry-container .entry-item-row .action-col { flex: 0 0 70px; max-width: 70px; }
.modal-entry-container .entry-item-row .link-col { flex: 0 0 85px; max-width: 85px; }
.modal-entry-container .entry-item-row .remark-col { flex: 0 0 85px; max-width: 85px; }
.modal-entry-container .entry-item-row .date-col { flex: 0 0 140px; max-width: 140px; }
.modal-entry-container .entry-item-row .time-col { flex: 0 0 120px; max-width: 120px; }
.modal-entry-container .entry-item-row .price-col { flex: 0 0 120px; max-width: 120px; }
.modal-entry-container .entry-item-row .sl-col { flex: 0 0 100px; max-width: 100px; }
.modal-entry-container .entry-item-row .tp-col { flex: 0 0 100px; max-width: 100px; }
.modal-entry-container .entry-item-row .qty-col { flex: 0 0 120px; max-width: 120px; }

/* Column Widths for Exit Modal */
.modal-exit-container .exit-item-row .action-col { flex: 0 0 70px; max-width: 70px; }
.modal-exit-container .exit-item-row .link-col { flex: 0 0 85px; max-width: 85px; }
.modal-exit-container .exit-item-row .date-col { flex: 0 0 140px; max-width: 140px; }
.modal-exit-container .exit-item-row .time-col { flex: 0 0 120px; max-width: 120px; }
.modal-exit-container .exit-item-row .price-col { flex: 0 0 120px; max-width: 120px; }
.modal-exit-container .exit-item-row .qty-col { flex: 0 0 120px; max-width: 120px; }

/* ============================================= */
/* MODAL OPTION FIELDS                           */
/* ============================================= */

/* Option Fields */
.modal-entry-container .entry-item-row .strike-col { flex: 0 0 140px; max-width: 140px; }
.modal-entry-container .entry-item-row .delta-col { flex: 0 0 140px; max-width: 140px; }
.modal-entry-container .entry-item-row .underlying-col { flex: 0 0 140px; max-width: 140px; }
.modal-entry-container .entry-item-row .contract-col { flex: 0 0 160px; max-width: 160px; }

/* ============================================= */
/* MODAL HISTORICAL DATA STYLES                  */
/* ============================================= */

/* Historical Data Styles */
.modal-entry-container .entry-item-row[data-is-historical="true"] .date-col,
.modal-entry-container .entry-item-row[data-is-historical="true"] .time-col,
.modal-entry-container .entry-item-row[data-is-historical="true"] .price-col,
.modal-entry-container .entry-item-row[data-is-historical="true"] .sl-col,
.modal-entry-container .entry-item-row[data-is-historical="true"] .tp-col,
.modal-entry-container .entry-item-row[data-is-historical="true"] .qty-col {
    flex: 0 0 140px !important;
    max-width: 140px !important;
}

/* Historical Record Label */
.historical-label {
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 3px;
}

.historical-label i {
    font-size: 0.6rem;
    margin-right: 3px;
}

/* ============================================= */
/* MODAL EDIT BUTTON STYLES                      */
/* ============================================= */

/* Edit Button Styles */
.btn-edit-entry, .btn-edit-exit {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-edit-entry:hover, .btn-edit-exit:hover {
    background-color: #6c757d;
    color: white;
}

input.editing {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

/* ============================================= */
/* MODAL SUMMARY STYLES                          */
/* ============================================= */

/* Modal Summary */
.modal-summary {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
}

.modal-summary strong {
    color: #212529 !important;
    font-size: 0.85rem;
}

.modal-summary .replaceable-qty,
.modal-summary .replaceable-price {
    color: #212529 !important;
    font-weight: 600;
}

.modal-summary span {
    font-weight: bold;
    color: #0d6efd;
}

/* ============================================= */
/* DIALOG STYLES                                 */
/* ============================================= */

/* Three Option Dialog */
.three-option-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.three-option-dialog > div {
    background: white;
    padding: 25px 30px;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 6px 25px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
}

/* Remark Options Dialog */
.remark-options-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.remark-options-dialog > div {
    background: white;
    padding: 25px 30px;
    border-radius: 12px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 6px 25px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
}

/* ============================================= */
/* DIALOG BUTTON STYLES                          */
/* ============================================= */

/* Button active state */
.go-url-btn:active,
.edit-btn:active,
.cancel-btn:active {
    transform: scale(0.95) !important;
}

.remark-edit-btn:active,
.remark-cancel-btn:active {
    transform: scale(0.95) !important;
}

/* ============================================= */
/* SCROLLBAR STYLES                              */
/* ============================================= */

/* URL preview scrollbar */
.three-option-dialog > div > div:nth-child(2) > div:nth-child(2)::-webkit-scrollbar {
    width: 6px;
}

.three-option-dialog > div > div:nth-child(2) > div:nth-child(2)::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.three-option-dialog > div > div:nth-child(2) > div:nth-child(2)::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.three-option-dialog > div > div:nth-child(2) > div:nth-child(2)::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Remark preview scrollbar */
.remark-options-dialog > div > div:nth-child(2) > div:nth-child(2)::-webkit-scrollbar {
    width: 6px;
}

.remark-options-dialog > div > div:nth-child(2) > div:nth-child(2)::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.remark-options-dialog > div > div:nth-child(2) > div:nth-child(2)::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.remark-options-dialog > div > div:nth-child(2) > div:nth-child(2)::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Modal Scrollbar */
.modal-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.modal-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* PB Scrollbar */
.pb-description-textarea::-webkit-scrollbar,
.pb-rule-value::-webkit-scrollbar {
    width: 4px;
}

.pb-description-textarea::-webkit-scrollbar-track,
.pb-rule-value::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.pb-description-textarea::-webkit-scrollbar-thumb,
.pb-rule-value::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.pb-description-textarea::-webkit-scrollbar-thumb:hover,
.pb-rule-value::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ============================================= */
/* PB POPUP MODAL STYLES                         */
/* ============================================= */

/* PB Popup Window */
.pb-popup-window {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2) !important;
    z-index: 99999 !important;
    min-width: 800px !important;
    max-width: 1300px !important;
    width: 85vw !important;
    height: auto !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
}

/* PB Popup Overlay */
.pb-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0,0,0,0.5) !important;
    z-index: 99998 !important;
}

/* PB Popup Header */
.pb-popup-header {
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pb-popup-title {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: 18px;
}

.pb-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* PB Popup Body */
.pb-popup-body {
    padding: 15px !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    overflow: visible !important;
    min-height: 0 !important;
}

.pb-list-container {
    flex: 1 !important;
    overflow-y: auto !important;
    border: 1px solid #e9ecef !important;
    border-top: none !important;
    border-radius: 0 0 6px 6px !important;
    background: #fff !important;
    min-height: 200px !important;
    max-height: 470px !important;
    transition: max-height 0.3s ease !important; /* Smooth transition */
}

.pb-list-container.expanded {
    max-height: 570px !important; /* Increased height when expanded */
    min-height: 250px !important;
}

/* ============================================= */
/* PB LIST STYLES                                */
/* ============================================= */

/* PB List Item Row */
.pb-list-item-row {
    display: flex !important;
    flex-wrap: nowrap; /* Changed from wrap to nowrap */
    align-items: stretch; /* Changed from center to stretch for better height matching */
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    width: 100%;
}

.pb-list-item-row:hover {
    background-color: #f8f9fa;
}

.pb-list-item-row.selected {
    background-color: #e7f1ff;
    border-left: 3px solid #0d6efd;
}

.pb-list-item-row:last-child {
    border-bottom: none;
}

.pb-list-item-row[style*="display: none"] {
    display: none !important;
}

/* PB Item Columns */
.pb-item-col {
    padding: 0 5px !important;
    font-size: 18px !important;
    display: flex;
    align-items: center;
}

/* Column Widths */
.pb-name-col {
    flex: 0 0 50px !important;
    min-width: 50px;
    max-width: 50px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-description-col {
    flex: 0 0 250px !important;
    min-width: 250px;
    max-width: 250px;
}

/* The description textarea - LEFT ALIGNED */
.pb-description-col .pb-description-textarea {
    text-align: left !important;
    direction: ltr;
    text-align-last: left;
    max-height: 40px !important;
    min-height: 32px !important;
    width: 100%;
    overflow-y: auto;
    padding: 3px 6px !important;
    border-radius: 4px;
    font-size: 18px !important;
    line-height: 1.3 !important;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    border: 1px solid #e0e0e0;
    background: #f9f9f9;
}

/* Add these new column styles */
.pb-sl-col {
    flex: 0 0 150px !important; /* Updated from 150px to 90px */
    min-width: 150px;
    max-width: 150px;
}

.pb-tp1-col {
    flex: 0 0 230px !important; /* Updated from 250px to 230px */
    min-width: 230px;
    max-width: 230px;
}

.pb-tp2-col {
    flex: 0 0 230px !important; /* Updated from 250px to 230px */
    min-width: 230px;
    max-width: 230px;
}

.pb-tp3-col {
    flex: 0 0 230px !important; /* Add this new class for TP3 */
    min-width: 230px;
    max-width: 230px;
}

/* Remove or update old date column style */
.pb-date-col {
    flex: 0 0 90px; /* This might conflict if you still have date column */
}

.pb-action-col {
    flex: 0 0 90px !important; /* Updated from 70px to 90px */
    min-width: 90px;
    max-width: 90px;
    justify-content: center; /* Changed from flex-end to center */
    gap: 4px;
}

.pb-rules-col {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Add these preview styles for the expandable boxes */
.pb-description-preview,
.pb-tp1-preview,
.pb-tp2-preview,
.pb-tp3-preview {
    width: 100% !important;
    max-height: 60px !important;
    min-height: 32px !important;
    padding: 3px 6px !important;
    font-size: 18px !important;
    text-align: left !important;
    line-height: 1.3 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    background: #f9f9f9 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    cursor: pointer !important;
    white-space: normal !important;
    word-break: break-word !important;
}

/* Stop Loss value styling */
.pb-sl-value {
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 14px !important;
    padding: 4px 8px !important;
}

/* Make sure all columns have consistent height */
.pb-name-col,
.pb-description-col,
.pb-sl-col,
.pb-tp1-col,
.pb-tp2-col,
.pb-tp3-col,
.pb-action-col {
    min-height: 36px;
    display: flex;
    align-items: center;
}

/* ============================================= */
/* PB TEXTAREA & VALUE STYLES                    */
/* ============================================= */

/* Textarea-style containers */
.pb-description-textarea,
.pb-rule-value {
    max-height: 40px !important;
    min-height: 32px !important;
    width: 100%;
    overflow-y: auto;
    padding: 3px 6px !important;
    border-radius: 4px;
    font-size: 18px !important;
    line-height: 1.3 !important;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
}

/* Specific styling for each rule type */
.pb-description-textarea {
    border: 1px solid #e0e0e0;
    background: #f9f9f9;
    text-align: left !important; /* Left aligned */
}

.pb-description-textarea:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.pb-sl-value {
    color: #212529;
    font-weight: 500;
    font-size: 18px;
}

.pb-tp1-value {
    color: #212529;
    font-weight: 500;
    font-size: 18px;
}

.pb-tp2-value {
    color: #212529;
    font-weight: 500;
    font-size: 18px;
}

/* Edit Modal Textarea */
.pb-edit-description-textarea {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.pb-edit-description-textarea:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ============================================= */
/* PB BUTTON STYLES                              */
/* ============================================= */

/* PB Button Base */
.pb-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    min-width: 100px;
}

.pb-btn-primary {
    background: #2196f3;
    color: white;
}

.pb-btn-primary:hover {
    background: #0d8bf2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.pb-btn-secondary {
    background: #6c757d;
    color: white;
}

.pb-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.pb-btn-outline {
    background: white;
    border: 1px solid #ddd;
    color: #333;
}

.pb-btn-outline:hover {
    background: #f5f5f5;
}

/* Edit Item Button */
.pb-edit-item-btn {
    padding: 2px 8px;
    font-size: 12px;
    border: 1px solid #0d6efd;
    color: #0d6efd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.pb-edit-item-btn:hover {
    background: #0d6efd;
    color: white;
    transform: translateY(-1px);
}

/* Remove Button */
.pb-remove-btn {
    background: none;
    border: 1px solid #dc3545;
    color: #dc3545;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    padding: 0;
}

.pb-remove-btn:hover {
    background: #dc3545;
    color: white;
}

/* Cancel Button */
#pb-cancel-btn {
    padding: 8px 20px;
    border: 1px solid #6c757d;
    color: #6c757d;
    background: white;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#pb-cancel-btn:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(108, 117, 125, 0.2);
}

/* ============================================= */
/* PB TEXT & BADGE STYLES                        */
/* ============================================= */

/* PB Name */
.pb-name {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

/* PB Description */
.pb-description {
    font-size: 18px;
    color: #666;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 2px 4px;
}

/* For empty description */
.pb-description .text-muted {
    font-style: italic;
    color: #adb5bd !important;
}

/* PB Rules Badges */
.pb-rule-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 70px;
    justify-content: center;
}

.pb-sl-badge {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.pb-tp1-badge {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.pb-tp2-badge {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.pb-empty-badge {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

/* PB Date Badge */
.pb-date-badge {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ============================================= */
/* PB FORM STYLES                                */
/* ============================================= */

/* Search Input */
.pb-search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.pb-search-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Form Section */
.pb-form-section {
    margin-top: 25px;
    border-top: 1px solid #eee;
    padding-top: 25px;
}

.pb-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.pb-form-col {
    flex: 1;
}

/* Input Groups */
.pb-input-group {
    margin-bottom: 20px;
}

.pb-input-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.pb-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.pb-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Rules Input Row */
.pb-rules-input-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.pb-rule-input-group {
    flex: 1;
}

.pb-rule-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.pb-rule-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

/* ============================================= */
/* PB ADD SECTION STYLES                         */
/* ============================================= */

/* Add Button Styles */
.pb-add-section {
    margin-bottom: 20px;
    padding: 0 !important;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    overflow: visible !important;
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
}

.pb-add-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px !important;
    background: #f8f9fa;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
    min-height: 60px;
    height: 60px;
    box-sizing: border-box;
}

/* 当表单展开时，添加底部边框 */
.pb-add-section .pb-advanced-form.active ~ .pb-add-header {
    border-bottom: 1px solid #dee2e6;
}

.pb-add-title {
    font-weight: 600;
    color: #0d6efd;
    font-size: 16px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* Add Toggle Button */
.pb-add-toggle-btn {
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px !important;
    justify-content: center;
    height: 36px;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: visible;
}

.pb-add-toggle-btn:hover {
    background: #0b5ed7;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.pb-add-toggle-btn.active {
    background: #6c757d;
}

.pb-add-toggle-btn.active:hover {
    background: #5a6268;
}

/* 添加图标动画 */
.pb-add-toggle-btn i {
    transition: transform 0.3s ease;
}

.pb-add-toggle-btn.active i {
    transform: rotate(45deg);
}

/* 添加表单容器的hover效果 */
.pb-add-section:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.1);
}

/* ============================================= */
/* PB ADVANCED FORM STYLES                       */
/* ============================================= */

/* Ensure advanced form is initially hidden */
.pb-advanced-form {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 20px;
    transition: all 0.3s ease;
    transform: translateY(-10px);
    visibility: hidden;
    background: white;
}

.pb-advanced-form.active {
    max-height: 500px;
    opacity: 1;
    padding: 20px !important;
    transform: translateY(0);
    visibility: visible;
    border-top: 1px solid #dee2e6;
    background: white;
    overflow-y: auto;
    margin: 0;
    border-radius: 0 0 6px 6px;
}

/* 表单展开时改变整个部分的背景色 */
.pb-add-section .pb-advanced-form.active {
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
}

/* Form Field Groups */
.pb-form-field-group {
    margin-bottom: 15px;
}

.pb-form-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
    white-space: nowrap;
}

.pb-form-field-group input,
.pb-form-field-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.pb-form-field-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* 必填字段的星号 */
.pb-form-field-group label[for*="pb-add-name-input"]:after {
    content: " *";
    color: #dc3545;
}

/* Trading Rules Grid */
.pb-rules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    animation: fadeInUp 0.4s ease;
    animation-fill-mode: both;
}

.pb-rules-grid > div {
    display: flex;
    flex-direction: column;
}

.pb-rules-grid label {
    font-size: 12px;
    margin-bottom: 4px;
    color: #6c757d;
}

/* Form Actions */
.pb-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    animation: fadeInUp 0.5s ease;
    animation-fill-mode: both;
}

.pb-btn-add {
    background: #198754;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
}

.pb-btn-add:hover {
    background: #157347;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(25, 135, 84, 0.3);
}

.pb-btn-add:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pb-btn-cancel-add {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}

.pb-btn-cancel-add:hover {
    background: #5a6268;
}

/* Success/Error Messages */
.pb-form-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 14px;
    display: none;
    animation: fadeInUp 0.3s ease;
}

.pb-form-message.active {
    display: block;
}

.pb-form-message.success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.pb-form-message.error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

/* 添加表单元素延迟动画 */
.pb-advanced-form.active .pb-form-field-group:nth-child(1) {
    animation-delay: 0.1s;
}

.pb-advanced-form.active .pb-form-field-group:nth-child(2) {
    animation-delay: 0.2s;
}

.pb-advanced-form.active .pb-rules-grid {
    animation-delay: 0.3s;
}

.pb-advanced-form.active .pb-form-actions {
    animation-delay: 0.4s;
}

/* ============================================= */
/* PB LIST HEADERS                               */
/* ============================================= */

.pb-list-headers {
    display: flex;
    padding: 10px;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-bottom: 2px solid #0d6efd;
    font-weight: 700;
    font-size: 13px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pb-header-col {
    display: flex;
    align-items: center;
    padding: 0 8px;
    overflow: hidden;
}

/* Match column widths with data columns */
.pb-header-col:nth-child(1) {
    flex: 0 0 100px;
    min-width: 50px;
    max-width: 50px;
}

.pb-header-col:nth-child(2) {
    flex: 1 1 200px;
    min-width: 150px;
    max-width: 250px;
}

.pb-header-col:nth-child(3) {
    flex: 0 0 90px;
    min-width: 150px;
    max-width: 150px;
}

.pb-header-col:nth-child(4) {
    flex: 0 0 90px;
    min-width: 150px;
    max-width: 230px;
}

.pb-header-col:nth-child(5) {
    flex: 0 0 90px;
    min-width: 150px;
    max-width: 230px;
}

.pb-header-col:nth-child(6) {
    flex: 0 0 90px;
    min-width: 90px;
    max-width: 230px;
}

.pb-header-col:nth-child(7) {
    flex: 0 0 120px;
    min-width: 90px;
    max-width: 90px;
    justify-content: center;
}

/* Icon indicators for headers */
.pb-header-col:first-child::before {
    content: "📘";
    margin-right: 6px;
    font-size: 12px;
}

.pb-header-col:nth-child(2)::before {
    content: "📝";
    margin-right: 6px;
    font-size: 12px;
}

.pb-header-col:nth-child(3)::before {
    content: "🔻";
    margin-right: 6px;
    font-size: 12px;
    color: #dc3545;
}

.pb-header-col:nth-child(4)::before {
    content: "🔼";
    margin-right: 6px;
    font-size: 12px;
    color: #198754;
}

.pb-header-col:nth-child(5)::before {
    content: "⏫";
    margin-right: 6px;
    font-size: 12px;
    color: #0d6efd;
}

.pb-header-col:nth-child(6)::before {
    content: "📅";
    margin-right: 6px;
    font-size: 12px;
    color: #6c757d;
}

.pb-header-col:nth-child(7)::before {
    content: "⚙️";
    margin-right: 6px;
    font-size: 12px;
    color: #6c757d;
}

/* ============================================= */
/* PB CELL STYLES                                */
/* ============================================= */

/* Cell Styles */
.pb-cell {
    cursor: pointer;
    transition: background 0.2s;
    min-width: 150px;
    padding: 8px 12px;
}

.pb-cell:hover {
    background: #f0f8ff;
}

.pb-cell.empty {
    color: #888;
    font-style: italic;
}

.pb-cell.filled {
    color: #333;
    font-weight: 500;
    background: #f8f9fa;
    border-radius: 4px;
}

/* PB Cell Content - show condensed info */
.pb-cell-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pb-cell-name {
    font-weight: 600;
    font-size: 13px;
}

.pb-cell-rules {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.pb-cell-rule {
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 2px;
    background: #e9ecef;
    color: #495057;
}

/* ============================================= */
/* PB FOOTER STYLES                              */
/* ============================================= */

/* Simple Footer Styling */
.pb-popup-footer {
    padding: 10px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    min-height: 60px;
    max-height: 60px;
    height: 60px;
}

/* ============================================= */
/* PB MISC STYLES                                */
/* ============================================= */

/* Empty Message */
.pb-empty-message {
    color: #888;
    font-style: italic;
    padding: 30px;
    text-align: center;
    font-size: 14px;
}

/* Remove the Simple Form toggle styles */
.pb-form-toggle,
.pb-toggle-switch,
.pb-quick-add-form {
    display: none !important;
}

.pb-quick-add-form .form-group {
    margin-bottom: 0;
}

/* Full Add Form - Expanded layout */
.pb-full-add-form {
    display: none;
}

.pb-full-add-form.active {
    display: block;
}

/* Toggle Switch for Simple/Advanced */
.pb-form-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.pb-toggle-label {
    font-size: 13px;
    color: #6c757d;
}

.pb-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.pb-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pb-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.pb-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .pb-toggle-slider {
    background-color: #0d6efd;
}

input:checked + .pb-toggle-slider:before {
    transform: translateX(26px);
}

/* Quick Add Input Styles */
.pb-quick-add-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    min-height: 36px;
}

.pb-quick-add-input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.pb-quick-add-label {
    font-size: 12px;
    color: #495057;
    font-weight: 500;
    margin-bottom: 4px;
    display: block;
}

/* 表单输入框的焦点状态 */
.pb-quick-add-input:focus,
.pb-edit-description-textarea:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ============================================= */
/* UTILITY STYLES                                */
/* ============================================= */

/* Edit Status Indicator */
.edit-status {
    font-size: 0.7rem;
    margin-left: 5px;
    font-style: italic;
}

.edit-status.text-warning {
    color: #ffc107;
    font-weight: bold;
}

.edit-status.text-success {
    color: #198754;
    font-weight: bold;
}

.edit-status.text-muted {
    color: #6c757d;
}

/* Form Labels */
.form-label.small {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    color: #495057;
}

/* ============================================= */
/* RESPONSIVE STYLES                             */
/* ============================================= */

/* General Responsive */
@media (max-width: 768px) {
    .table-container {
        border-radius: 4px;
    }

    .editable-table {
        font-size: 0.8rem;
    }

    .editable-table th,
    .editable-table td {
        padding: 4px 3px;
        min-width: 50px;
    }

    .btn-table {
        padding: 2px 6px;
        font-size: 0.7rem;
    }

    #entryModal .modal-content {
        min-width: 1000px;
    }

    #exitModal .modal-content {
        min-width: 700px;
    }

    .modal-entry-container .entry-item-row .date-col,
    .modal-exit-container .exit-item-row .date-col {
        flex: 0 0 120px;
        max-width: 120px;
    }

    .modal-entry-container .entry-item-row[data-is-historical="true"] .date-col,
    .modal-entry-container .entry-item-row[data-is-historical="true"] .time-col,
    .modal-entry-container .entry-item-row[data-is-historical="true"] .price-col,
    .modal-entry-container .entry-item-row[data-is-historical="true"] .sl-col,
    .modal-entry-container .entry-item-row[data-is-historical="true"] .tp-col,
    .modal-entry-container .entry-item-row[data-is-historical="true"] .qty-col {
        flex: 0 0 130px !important;
        max-width: 130px !important;
    }
}

/* Dialog Responsive */
@media (max-width: 550px) {
    .three-option-dialog > div {
        width: 90% !important;
        padding: 20px 25px !important;
    }
}

@media (max-width: 500px) {
    .remark-options-dialog > div {
        width: 90% !important;
        padding: 20px 25px !important;
    }

    .remark-edit-btn,
    .remark-cancel-btn {
        width: 110px !important;
        height: 38px !important;
        font-size: 13px !important;
    }
}

@media (max-width: 480px) {
    .three-option-dialog > div {
        padding: 18px 22px !important;
    }

    .go-url-btn {
        width: 140px !important;
        height: 38px !important;
        font-size: 13px !important;
    }

    .edit-btn,
    .cancel-btn {
        width: 75px !important;
        height: 28px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 400px) {
    .remark-options-dialog > div {
        padding: 18px 22px !important;
    }

    .remark-edit-btn,
    .remark-cancel-btn {
        width: 100px !important;
        height: 36px !important;
        font-size: 12px !important;
    }
}

/* PB Popup Responsive */
@media (max-height: 800px) {
    .pb-popup-window {
        max-height: 85vh !important;
    }

    .pb-list-container {
        max-height: 250px !important;
    }
}

@media (max-height: 600px) {
    .pb-popup-window {
        max-height: 90vh !important;
    }

    .pb-list-container {
        max-height: 200px !important;
    }

    .pb-list-item-row {
        min-height: 35px !important;
    }
}

@media (max-width: 1200px) {
    .pb-popup-window {
        min-width: 700px !important;
        max-width: 900px !important;
        width: 90vw !important;
    }

    .pb-description-col {
        min-width: 150px;
        max-width: 150px;
        flex: 1 0 150px;
    }

    .pb-rules-col {
        min-width: 250px;
        max-width: 250px;
        flex: 0 0 250px;
    }

    .pb-rules-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pb-advanced-form.active {
        max-height: 600px;
    }

    .pb-quick-add-form {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .pb-popup-window {
        min-width: 600px !important;
        max-width: 700px !important;
        width: 95vw !important;
    }

    .pb-list-item-row {
        flex-wrap: wrap;
        padding: 10px;
    }

    .pb-description-col {
        min-width: 100%;
        max-width: 100%;
        flex: 1 0 100%;
        margin: 5px 0;
        white-space: normal;
    }

    .pb-rules-col {
        min-width: 100%;
        max-width: 100%;
        flex: 1 0 100%;
        margin: 5px 0;
    }

    .pb-quick-add-form {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .pb-rules-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .pb-form-actions {
        flex-direction: column;
    }

    .pb-btn-add {
        width: 100%;
    }

    .pb-advanced-form.active {
        max-height: 700px;
        padding: 15px;
    }

    .pb-add-toggle-btn {
        min-width: 100px;
        padding: 6px 12px;
        font-size: 13px;
    }

    .pb-quick-add-form {
        grid-template-columns: 1fr;
    }

    .pb-form-actions {
        flex-direction: column;
    }

    .pb-btn-add,
    .pb-btn-cancel-add {
        width: 100%;
    }
}

/* ============================================= */
/* PRINT STYLES                                  */
/* ============================================= */

@media print {
    .table-container {
        box-shadow: none;
        border: 1px solid #000;
    }

    .editable-table thead th {
        background-color: #ddd !important;
        color: #000 !important;
    }

    .btn-table {
        display: none;
    }

    .editable-table td:nth-child(7)::after {
        content: "Option Data";
        font-style: italic;
        color: #6c757d;
    }
}

.description-toggle:checked + .pb-description-expandable {
    -webkit-line-clamp: unset !important;
    max-height: none !important;
    overflow: visible !important;
}

.pb-description-expandable:hover {
    background: #f0f0f0 !important;
}

