/* Transaction Modal */
.transaction-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transaction-modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 16px;
    width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
}

.modal-header h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

/* Metrics Settings Modal */
.metrics-settings-modal {
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.metrics-settings-modal .modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.metrics-settings-modal .modal-header h3 {
    flex: 1;
}

.metrics-total-badge {
    background: rgba(124, 195, 228, 0.15);
    color: #7cc3e4;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.metrics-settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 !important;
}

.metrics-category {
    border-bottom: 1px solid #333;
}

.metrics-category:last-child {
    border-bottom: none;
}

.metrics-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.metrics-category-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.metrics-category-arrow {
    color: #666;
    font-size: 10px;
    transition: transform 0.2s;
}

.metrics-category-arrow.collapsed {
    transform: rotate(-90deg);
}

.metrics-category-title {
    font-weight: 500;
    color: #fff;
    flex: 1;
    font-size: 14px;
}

.metrics-category-count {
    background: #333;
    color: #888;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.metrics-category-content {
    padding: 0 20px 15px 20px;
}

.metrics-category-content.collapsed {
    display: none;
}

.metrics-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #2a2a2a;
}

.metrics-checkbox-item:last-child {
    border-bottom: none;
}

.metrics-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #7cc3e4;
    cursor: pointer;
}

.metrics-checkbox-item label {
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    flex: 1;
}

.metrics-checkbox-item:hover label {
    color: #fff;
}

.metrics-settings-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #333;
}

.metrics-settings-modal .btn-secondary {
    background: transparent;
    border: 1px solid #444;
    color: #999;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.metrics-settings-modal .btn-secondary:hover {
    border-color: #7cc3e4;
    color: #7cc3e4;
}

.metrics-settings-modal .btn-primary {
    background: #7cc3e4;
    border: none;
    color: #000;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.metrics-settings-modal .btn-primary:hover {
    background: #9dd4ed;
}

/* Metrics Reorder Mode */
#metricsReorderBtn.active {
    background: rgba(124, 195, 228, 0.25);
    color: #7cc3e4;
}

.metrics-reorder-active .stock-detail-metric-item {
    cursor: grab;
    position: relative;
    padding-left: 24px;
    transition: background 0.15s, transform 0.15s;
    border: 1px solid transparent;
    border-radius: 6px;
}

.metrics-reorder-active .stock-detail-metric-item::before {
    content: '\2807';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    font-size: 14px;
    line-height: 1;
}

.metrics-reorder-active .stock-detail-metric-item:hover {
    background: rgba(124, 195, 228, 0.08);
    border-color: #333;
}

.metrics-reorder-active .stock-detail-metric-item.dragging {
    opacity: 0.3;
    border: 1px dashed #555;
}

.metrics-reorder-active .stock-detail-metric-item.drag-over-before {
    border-top: 2px solid #7cc3e4;
    margin-top: -1px;
}

.metrics-reorder-active .stock-detail-metric-item.drag-over-after {
    border-bottom: 2px solid #7cc3e4;
    margin-bottom: -1px;
}

/* Universal Confirmation Modal */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.confirm-modal.hidden { display: none; }
.confirm-modal .modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}
.confirm-modal-content {
    position: relative;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: modalSlideIn 0.2s ease-out;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.confirm-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.confirm-modal-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.confirm-modal-icon.info {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}
.confirm-modal-title {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 12px;
}
.confirm-modal-message {
    color: #999;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 24px;
}
.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.confirm-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}
.confirm-btn.cancel {
    background: #333;
    border: 1px solid #444;
    color: #ccc;
}
.confirm-btn.cancel:hover {
    background: #444;
    color: #fff;
}
.confirm-btn.danger {
    background: #ef4444;
    border: none;
    color: #fff;
}
.confirm-btn.danger:hover {
    background: #dc2626;
}
.confirm-btn.primary {
    background: #8b5cf6;
    border: none;
    color: #fff;
}
.confirm-btn.primary:hover {
    background: #7c3aed;
}
.confirm-btn.warning {
    background: #f59e0b;
    border: none;
    color: #000;
}
.confirm-btn.warning:hover {
    background: #d97706;
}

.modal-search {
    padding: 20px 24px 20px;
}

.search-input {
    width: 100%;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

.transaction-tabs {
    display: flex;
    padding: 20px 24px 0;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    padding: 8px 16px;
    background: #333;
    border: none;
    border-radius: 6px;
    color: #ccc;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #79d3d3;
    color: #111;
}

.transaction-form {
    padding: 20px 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #ccc;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #ccc;
    font-size: 14px;
    margin-bottom: 0 !important;
}

.cash-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    color: #8b5cf6;
    font-size: 20px;
    transition: opacity 0.2s;
    padding: 4px;
    min-width: 28px;
    text-align: center;
}

.cash-checkbox:not(:checked) + .checkmark {
    opacity: 0.3;
}

.cash-balance {
    color: #888;
    font-size: 12px;
    margin-left: auto;
}

.form-select,
.amount-input,
.price-input,
.datetime-input {
    width: 100%;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
}

.form-select:focus,
.amount-input:focus,
.price-input:focus,
.datetime-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

.amount-input-group,
.price-input-group {
    display: flex;
    align-items: center;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    padding-right: 16px;
}

.amount-input-group:focus-within,
.price-input-group:focus-within {
    border-color: #8b5cf6;
}

.sell-all-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 8px;
    transition: background 0.2s;
}

.sell-all-btn:hover {
    background: #dc2626;
}

.note-input {
    width: 100%;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
}

.note-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

.note-input::placeholder {
    color: #666;
}

.note-group.hidden {
    display: none;
}

.note-icon {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.note-icon:hover {
    opacity: 1;
}

.note-icon.has-note {
    opacity: 0.9;
}

/* Transaction Note Modal */
.note-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.note-modal.hidden {
    display: none;
}

.note-modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.note-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
}

.note-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #fff;
}

.note-modal-body {
    padding: 20px;
}

.note-modal-textarea {
    width: 100%;
    min-height: 150px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.note-modal-textarea:focus {
    outline: none;
    border-color: #8b5cf6;
}

.note-modal-textarea::placeholder {
    color: #666;
}

.note-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #333;
}

.note-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.note-modal-btn.cancel {
    background: #333;
    color: #ccc;
}

.note-modal-btn.cancel:hover {
    background: #444;
}

.note-modal-btn.save {
    background: #8b5cf6;
    color: #fff;
}

.note-modal-btn.save:hover {
    background: #7c3aed;
}

/* Pre-filled ticker display in transaction modal */
.prefilled-ticker-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.prefilled-ticker-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.prefilled-ticker-symbol {
    font-size: 18px;
    font-weight: 600;
    color: #8b5cf6;
}

.prefilled-ticker-name {
    font-size: 14px;
    color: #888;
}

.prefilled-ticker-change {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.prefilled-ticker-change:hover {
    border-color: #666;
    color: #fff;
}

.amount-input,
.price-input {
    border: none;
    background: transparent;
    padding: 12px 16px;
}

.amount-currency,
.price-currency {
    color: #999;
    font-size: 12px;
    font-weight: 600;
}

.currency-select {
    background: #2a2a2a;
    border: none;
    color: #999;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 50px;
}

.currency-select:focus {
    outline: none;
    background: #333;
}

.price-options {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.price-option-btn {
    padding: 6px 12px;
    background: #333;
    border: 1px solid #444;
    border-radius: 6px;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.price-option-btn.active {
    background: #79d3d3;
    border-color: #79d3d3;
    color: #111;
}

.total-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px 16px;
}

.total-amount-input {
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    background: transparent;
    border: none;
    outline: none;
    flex: 1;
    min-width: 0;
    font-family: inherit;
}

.total-amount-input::placeholder {
    color: #666;
}

.total-amount-input::-webkit-inner-spin-button,
.total-amount-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.total-currency {
    color: #999;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #2a2a2a;
}

.action-btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.action-btn.secondary {
    background: #333;
    color: #ccc;
    flex: 1;
}

.action-btn.secondary:hover {
    background: #444;
}

.action-btn.primary {
    background: #79d3d3;
    color: #111;
    flex: 2;
    font-weight: 600;
}

.action-btn.primary:hover {
    background: #5fbfbf;
}

