/* =====================================================
   CITIZEN WEALTH — TRANSACTIONS MODULE STYLES
   Executive Swiss Private Banking Aesthetic
   ===================================================== */

/* ---- Section Header ---- */
.tx-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.tx-heading {
    margin: 0;
    font-family: var(--font-display, Georgia, serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.tx-subheading {
    margin: 4px 0 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.tx-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

/* ---- Summary Strip ---- */
.tx-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.tx-summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tx-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: rgba(176, 141, 87, 0.4);
}

.tx-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.tx-summary-card .label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tx-summary-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.tx-summary-icon.sent {
    background: rgba(224, 93, 77, 0.12);
    color: var(--error);
}

.tx-summary-icon.received {
    background: rgba(75, 181, 132, 0.14);
    color: var(--success);
}

.tx-summary-icon.records {
    background: rgba(176, 141, 87, 0.14);
    color: var(--accent);
}

.tx-summary-icon.pending {
    background: rgba(229, 169, 60, 0.14);
    color: var(--warning);
}

.tx-summary-card .value {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.tx-summary-card .value.sent {
    color: var(--error);
}

.tx-summary-card .value.received {
    color: var(--success);
}

.tx-summary-card .value.pending-val {
    color: var(--warning);
}

.tx-summary-sub {
    font-size: 0.76rem;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* ---- Toolbar ---- */
.tx-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.tx-search-wrap {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.tx-search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.88rem;
    pointer-events: none;
}

.tx-search {
    width: 100%;
    height: 42px;
    padding: 0 38px 0 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.tx-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(176, 141, 87, 0.15);
}

.tx-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 0.8rem;
    transition: color 0.15s ease;
}

.tx-search-clear:hover {
    color: var(--error);
}

.tx-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tx-select-wrap {
    position: relative;
}

.tx-filter-select {
    height: 42px;
    padding: 0 32px 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238FA099' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.tx-filter-select:focus,
.tx-filter-select:hover {
    border-color: var(--accent);
}

/* ---- Table Container ---- */
.tx-card-container {
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.tx-table-wrap {
    overflow-x: auto;
    border-radius: 16px 16px 0 0;
}

.tx-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.tx-table thead th {
    background: var(--bg-tertiary);
    padding: 13px 18px;
    text-align: left;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

.tx-table thead th:hover {
    color: var(--text-primary);
}

.tx-table thead th .sort-icon {
    margin-left: 5px;
    opacity: 0.35;
    font-size: 0.72rem;
    transition: opacity 0.15s ease;
}

.tx-table thead th.sorted .sort-icon {
    opacity: 1;
    color: var(--accent);
}

.tx-table tbody tr.tx-row {
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

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

.tx-table tbody tr.tx-row:hover {
    background-color: var(--bg-secondary);
    box-shadow: inset 3px 0 0 var(--accent);
}

.tx-table td {
    padding: 15px 18px;
    vertical-align: middle;
    color: var(--text-primary);
}

/* ---- Type Cell ---- */
.tx-type-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tx-type-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.tx-type-icon.send {
    background: rgba(224, 93, 77, 0.12);
    color: var(--error);
    border-color: rgba(224, 93, 77, 0.2);
}

.tx-type-icon.receive {
    background: rgba(75, 181, 132, 0.14);
    color: var(--success);
    border-color: rgba(75, 181, 132, 0.2);
}

.tx-type-icon.transfer {
    background: rgba(176, 141, 87, 0.14);
    color: var(--accent);
    border-color: rgba(176, 141, 87, 0.2);
}

.tx-type-icon.other {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border);
}

.tx-type-meta {
    display: flex;
    flex-direction: column;
}

.tx-type-name {
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: capitalize;
    color: var(--text-primary);
}

/* ---- Description & Reference ---- */
.tx-desc-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tx-desc {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tx-ref {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid var(--border);
    width: fit-content;
}

.tx-ref span {
    opacity: 0.6;
    font-weight: bold;
}

/* ---- Counterparty ---- */
.tx-counterparty-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.84rem;
    color: var(--text-secondary);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tx-counterparty-avatar {
    color: var(--accent);
    font-size: 0.95rem;
    opacity: 0.8;
}

/* ---- Date & Time ---- */
.tx-date-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    white-space: nowrap;
}

.tx-date-main {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tx-date-time {
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---- Amount ---- */
.tx-amount-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.tx-amount {
    font-weight: 700;
    font-size: 0.96rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.tx-amount.debit {
    color: var(--error);
}

.tx-amount.credit {
    color: var(--success);
}

.tx-fee-tag {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---- Status Pill Badges ---- */
.tx-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.tx-status-pill .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.tx-status-completed {
    background: rgba(75, 181, 132, 0.12);
    color: var(--success);
    border: 1px solid rgba(75, 181, 132, 0.25);
}

.tx-status-completed .status-dot {
    background: var(--success);
    box-shadow: 0 0 6px rgba(75, 181, 132, 0.6);
}

.tx-status-pending {
    background: rgba(229, 169, 60, 0.14);
    color: var(--warning);
    border: 1px solid rgba(229, 169, 60, 0.25);
}

.tx-status-pending .status-dot {
    background: var(--warning);
    animation: txPulseDot 2s infinite ease-in-out;
}

@keyframes txPulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.5; }
}

.tx-status-processing {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.tx-status-processing .status-dot {
    background: #3b82f6;
    animation: txPulseDot 1.2s infinite ease-in-out;
}

.tx-status-failed,
.tx-status-rejected {
    background: rgba(224, 93, 77, 0.12);
    color: var(--error);
    border: 1px solid rgba(224, 93, 77, 0.25);
}

.tx-status-failed .status-dot,
.tx-status-rejected .status-dot {
    background: var(--error);
}

.tx-status-cancelled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.tx-status-cancelled .status-dot {
    background: var(--text-secondary);
}

/* ---- Empty / Loading States ---- */
.tx-empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-secondary);
}

.tx-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px dashed rgba(176, 141, 87, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--accent);
    font-size: 1.5rem;
}

.tx-empty h4 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tx-empty p {
    margin: 0 auto;
    max-width: 420px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.tx-loading {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.tx-loading i {
    margin-right: 8px;
    color: var(--accent);
}

/* ---- Pagination ---- */
.tx-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 12px;
}

.tx-page-btns {
    display: flex;
    gap: 6px;
}

.tx-page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
}

.tx-page-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--accent);
}

.tx-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.tx-page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--color-on-primary, #ffffff);
    font-weight: 700;
}

/* ---- Detail Drawer Modal ---- */
.tx-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 18, 15, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.tx-drawer-overlay.active {
    display: flex;
}

.tx-drawer {
    background: var(--card-bg);
    border: 1px solid rgba(176, 141, 87, 0.28);
    border-radius: 20px;
    padding: 26px 28px;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    position: relative;
    box-sizing: border-box;
    animation: txDrawerScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes txDrawerScale {
    from { transform: scale(0.96) translateY(12px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.tx-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.tx-drawer-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-display, Georgia, serif);
    letter-spacing: -0.01em;
}

.tx-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.tx-drawer-close:hover {
    background: rgba(224, 93, 77, 0.12);
    color: var(--error);
    border-color: rgba(224, 93, 77, 0.3);
}

.tx-drawer-hero {
    text-align: center;
    padding: 20px 16px;
    background: var(--bg-tertiary);
    border-radius: 14px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.tx-drawer-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin: 0 auto 10px;
    font-size: 1.15rem;
}

.tx-drawer-hero-amount {
    font-size: 1.85rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.tx-drawer-hero-amount.debit {
    color: var(--error);
}

.tx-drawer-hero-amount.credit {
    color: var(--success);
}

.tx-drawer-hero-label {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.tx-drawer-table {
    border-radius: 10px;
}

.tx-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.86rem;
    gap: 16px;
}

.tx-detail-row:last-child {
    border-bottom: none;
}

.tx-detail-row .dl {
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.tx-detail-row .dv {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.tx-detail-row .dv .mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.tx-copy-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tx-copy-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .tx-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tx-export-btn {
        width: 100%;
        justify-content: center;
    }

    .tx-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .tx-summary-card {
        padding: 14px 16px;
    }

    .tx-summary-card .value {
        font-size: 1.2rem;
    }

    .tx-table thead th:nth-child(3),
    .tx-table tbody td.tx-col-counterparty {
        display: none; /* Hide counterparty on mobile */
    }

    .tx-desc {
        max-width: 160px;
    }

    .tx-drawer-overlay {
        align-items: flex-end;
        padding: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .tx-drawer {
        border-radius: 24px 24px 0 0;
        border-bottom: none;
        border-left: none;
        border-right: none;
        max-height: calc(100dvh - 36px);
        max-height: calc(100dvh - 36px - env(safe-area-inset-top, 0px));
        padding: 22px 20px calc(48px + env(safe-area-inset-bottom, 24px));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        animation: txDrawerSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes txDrawerSlideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
}

@media (max-width: 480px) {
    .tx-summary {
        grid-template-columns: 1fr;
    }

    .tx-table thead th:nth-child(4),
    .tx-table tbody td.tx-col-date {
        display: none; /* Hide date on very small screens, view in drawer */
    }
}
