/* ==========================================================
   transactions.css — Transaction table redesigned,
                       toolbar, pagination
   ========================================================== */

/* ============ Transaction Table (redesigned) ============ */

.tx-card {
    overflow: visible;
}

/* Toolbar */
.tx-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-xl);
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.tx-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.tx-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.tx-filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    padding-right: 32px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    cursor: pointer;
    appearance: auto;
}

.tx-filter-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.tx-search-box {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
}

.tx-search-input {
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    width: 160px;
    outline: none;
}

.tx-search-input::placeholder {
    color: var(--text-muted);
}

.tx-search-btn {
    background: var(--bg-tertiary);
    border: none;
    border-left: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.tx-search-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* Table */
.tx-table {
    width: 100%;
    border-collapse: collapse;
}

.tx-table th,
.tx-table td {
    padding: 0.7rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

/* th styles unified in components.css */

.tx-table td {
    font-size: 0.88rem;
    color: var(--text-primary);
}

.tx-table tbody tr {
    transition: background var(--transition-fast);
}

.tx-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.tx-row-clickable {
    cursor: pointer;
}

.tx-table .text-right {
    text-align: right;
}

.tx-table .text-center {
    text-align: center;
}

.tx-table .mono {
    font-family: var(--font-mono);
    font-size: 0.84rem;
}

/* Sortable header */
.tx-sortable {
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.tx-sortable:hover {
    color: var(--text-secondary);
}

.tx-sortable.active {
    color: var(--accent-cyan);
}

.tx-sort-icon {
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

.tx-sortable.active .tx-sort-icon {
    opacity: 1;
}

.tx-sortable.active.asc .tx-sort-icon path:first-child {
    opacity: 1;
}

.tx-sortable.active.asc .tx-sort-icon path:last-child {
    opacity: 0.3;
}

/* Operation column */
.tx-op {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: capitalize;
}

.tx-op.buy {
    color: var(--accent-green);
}

.tx-op.sell {
    color: var(--accent-red);
}

.tx-op.dividend {
    color: var(--accent-blue-light);
}

/* Holding cell (name + symbol) */
.tx-holding-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tx-holding-name {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
}

.tx-holding-symbol {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Date cell */
.tx-date-cell {
    color: var(--text-secondary);
}

/* Profit cell */
.tx-profit-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.tx-profit-cell.positive .tx-profit-pct {
    color: var(--accent-green);
}

.tx-profit-cell.negative .tx-profit-pct {
    color: var(--accent-red);
}

.tx-profit-cell.positive .tx-profit-amt {
    color: var(--accent-green);
}

.tx-profit-cell.negative .tx-profit-amt {
    color: var(--accent-red);
}

.tx-profit-pct {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.tx-profit-amt {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    opacity: 0.85;
    white-space: nowrap;
}

.tx-profit-na {
    color: var(--text-muted);
}

/* Pagination */
.tx-pagination {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-xl);
    border-top: 1px solid var(--border-color);
}

.tx-page-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.82rem;
    cursor: pointer;
}

.tx-page-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.tx-page-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Keep old .tx-type for backward compat (used elsewhere) */
.tx-type {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.tx-type.buy {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.tx-type.sell {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.tx-type.dividend {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-blue-light);
}

/* Transaction table responsive */
@media (max-width: 900px) {
    .tx-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .tx-toolbar-left,
    .tx-toolbar-right {
        width: 100%;
    }

    .tx-toolbar-right {
        flex-wrap: wrap;
    }

    .tx-search-input {
        flex: 1;
        width: auto;
    }

    .tx-search-box {
        flex: 1;
    }

    .tx-table th,
    .tx-table td {
        padding: 10px 12px;
    }
}

@media (max-width: 640px) {
    .tx-table th,
    .tx-table td {
        padding: 8px 8px;
        font-size: 0.8rem;
    }

    .tx-holding-name {
        font-size: 0.8rem;
    }

    .tx-profit-pct {
        font-size: 0.78rem;
    }

    .tx-profit-amt {
        font-size: 0.7rem;
    }

    .tx-toolbar-right .btn-sm {
        font-size: 0;
        padding: 8px;
        min-width: unset;
    }

    .tx-toolbar-right .btn-sm svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    /* Hide less important columns on very small screens */
    .tx-table th:nth-child(6),
    .tx-table td:nth-child(6) {
        display: none;
    }

    .tx-table th,
    .tx-table td {
        padding: 6px 6px;
    }
}
