/* ==========================================================================
   Transactions Page Styles - Modular & Maintainable
   ========================================================================== */

/* Overview Header */
.tx-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tx-overview-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tx-overview-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.tx-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.tx-date-pill:hover {
    background-color: #eff6ff;
}

.tx-date-pill svg {
    transition: transform 0.2s ease;
}

/* --------------------------------------------------------------------------
   Overview Range Dropdown Menu
   -------------------------------------------------------------------------- */
.tx-dropdown-wrap {
    position: relative;
    display: inline-block;
}

.tx-date-pill[aria-expanded="true"] .tx-chevron {
    transform: rotate(180deg);
}

.tx-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.tx-dropdown-menu.show {
    display: flex;
    animation: txDropdownFadeIn 0.15s ease-out;
}

@keyframes txDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tx-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    background: transparent;
    border: none;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.tx-dropdown-item:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.tx-dropdown-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   KPI Overview Grid (First box width = Sum of rest two boxes)
   Grid track: 2fr 1fr 1fr -> Box 1 (2fr) equals Box 2 (1fr) + Box 3 (1fr)
   -------------------------------------------------------------------------- */
.tx-overview-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.tx-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tx-kpi-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.tx-kpi-label-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tx-kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.1px;
}

.tx-kpi-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: help;
    transition: color 0.15s ease;
}

.tx-kpi-info-icon:hover {
    color: #475569;
}

/* Custom Razorpay-Style Tooltip Popup for KPI Info Icons */
.tx-tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tx-tooltip-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: 260px;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 400;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 100;
    pointer-events: none;
    text-align: left;
}

.tx-tooltip-arrow {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    border-left: 1px solid #e2e8f0;
}

.tx-tooltip-wrap:hover .tx-tooltip-popup,
.tx-tooltip-wrap:focus-within .tx-tooltip-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.tx-kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.6px;
    line-height: 1.15;
    margin: 10px 0 6px;
}

/* Secondary cards have slightly proportional font size */
.tx-kpi-card-sub .tx-kpi-value {
    font-size: 26px;
}

.tx-kpi-subtext {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
    .tx-overview-grid {
        grid-template-columns: 1fr 1fr;
    }
    .tx-card-hero {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .tx-overview-grid {
        grid-template-columns: 1fr;
    }
    .tx-card-hero {
        grid-column: span 1;
    }
    .tx-kpi-value {
        font-size: 26px;
    }
    .tx-kpi-card-sub .tx-kpi-value {
        font-size: 24px;
    }
}


/* --------------------------------------------------------------------------
   Primary Tabs (Payments)
   -------------------------------------------------------------------------- */
.tx-primary-tabs {
    display: flex;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.tx-tab-item {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    padding: 8px 4px 12px;
    border-bottom: 2px solid #0f172a;
    text-decoration: none;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: default;
}

/* --------------------------------------------------------------------------
   Table White Card Container
   -------------------------------------------------------------------------- */
.tx-table-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    margin-bottom: 40px;
}

/* --------------------------------------------------------------------------
   Filter Toolbar (Sub-tabs + Date Filter & Search in line)
   -------------------------------------------------------------------------- */
.tx-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.tx-rail-pills {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.tx-rail-pill {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tx-rail-pill:hover:not(.active) {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.5);
}

.tx-rail-pill.active {
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
    border-color: #0f172a;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
}

.tx-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tx-date-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.tx-date-input-wrap:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.tx-date-input-wrap:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.tx-date-input {
    border: none;
    outline: none;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: #0f172a;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

/* Hide duplicate native icon and stretch clickable area across the entire wrapper */
.tx-date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.tx-search-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    min-width: 240px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tx-search-box:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.tx-search-input {
    border: none;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    color: #0f172a;
    width: 100%;
    background: transparent;
}

.tx-search-input::placeholder {
    color: #94a3b8;
}

.tx-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 33px;
    height: 33px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.tx-refresh-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.tx-refresh-btn:focus-visible {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.tx-refresh-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.tx-refresh-btn.spinning svg {
    animation: txSpin 0.75s linear infinite;
}

@keyframes txSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------------------
   Table Meta Counter
   -------------------------------------------------------------------------- */
.tx-table-meta {
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: #fafbfc;
    border-bottom: 1px solid #f1f5f9;
}

/* --------------------------------------------------------------------------
   Data Table
   -------------------------------------------------------------------------- */
.tx-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.tx-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.tx-table th {
    padding: 11px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.35px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
    height: 44px;
    box-sizing: border-box;
}

.tx-table td {
    padding: 8px 20px;
    font-size: 13.5px;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    white-space: nowrap;
    box-sizing: border-box;
    height: 52px;
}

.tx-table tbody tr {
    height: 52px;
    transition: background-color 0.12s ease;
}

.tx-table tbody tr:hover {
    background-color: #f8fafc;
}

.tx-table tbody tr:last-child td {
    border-bottom: 1px solid #e2e8f0;
}

/* Token Cell & Order ID Subtext */
.tx-token-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.tx-token-badge {
    display: inline-flex;
    align-items: center;
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.25;
}

.tx-order-subid {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    letter-spacing: 0.1px;
    line-height: 1.1;
}

/* Status Badges */
.tx-badge-paid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    color: #224E1D;
    border: 1.5px solid #224E1D;
    border-radius: 4px;
    padding: 2px 5px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(34, 78, 29, 0.04);
}

.tx-badge-pending {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 2px 6px;
}

.tx-badge-failed {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: #b91c1c;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 2px 6px;
}

/* Payment Method Badges */
.tx-badge-method {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    line-height: 1.2;
}

.tx-badge-method-cash {
    color: #1e293b;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    font-weight: 700;
}

.tx-badge-method-online {
    color: #4338ca;
    background: #e0e7ff;
    border: 1px solid #c7d2fe;
}

.tx-badge-method-other {
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.tx-empty-state {
    padding: 48px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

/* Typography Helpers for Table Cells */
.tx-amount {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.tx-phone {
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    letter-spacing: 0.2px;
}

.tx-created-at {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tx-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .tx-rail-pills {
        width: 100%;
        justify-content: stretch;
    }

    .tx-rail-pill {
        flex: 1;
        text-align: center;
    }

    .tx-toolbar-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .tx-date-input-wrap,
    .tx-search-box {
        width: 100%;
        min-width: 0;
    }
}

/* --------------------------------------------------------------------------
   Skeleton Loaders (Smooth Shimmer Wave)
   -------------------------------------------------------------------------- */
.tx-skeleton {
    display: inline-block;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: txSkeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
    vertical-align: middle;
}

@keyframes txSkeletonShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* KPI Skeletons */
.tx-skeleton-kpi-val {
    height: 32px;
    border-radius: 8px;
    margin: 6px 0;
}

.tx-skeleton-kpi-sub {
    height: 14px;
    border-radius: 4px;
}

/* Table Row Skeletons */
.tx-skeleton-row td {
    padding: 8px 20px;
    height: 52px;
    box-sizing: border-box;
    vertical-align: middle;
    border-bottom: 1px solid #e2e8f0;
}

.tx-skeleton-badge {
    width: 42px;
    height: 18px;
    border-radius: 4px;
    margin-bottom: 2px;
}

.tx-skeleton-subid {
    width: 52px;
    height: 11px;
    border-radius: 3px;
}

.tx-skeleton-phone {
    width: 120px;
    height: 14px;
    border-radius: 4px;
}

.tx-skeleton-amount {
    width: 65px;
    height: 15px;
    border-radius: 4px;
}

.tx-skeleton-status {
    width: 48px;
    height: 17px;
    border-radius: 4px;
}

.tx-skeleton-date {
    width: 125px;
    height: 13px;
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Table Pagination Bar (Clean, Responsive)
   -------------------------------------------------------------------------- */
.tx-pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 20px;
    background: #ffffff;
    border-top: none;
}

.tx-pagination-info {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.tx-pagination-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tx-pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tx-pagination-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.tx-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8fafc;
}

.tx-page-indicator {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    padding: 0 4px;
    min-width: 75px;
    text-align: center;
}

@media (max-width: 600px) {
    .tx-pagination-wrap {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
