/* =========================================================
   PAYMENTS INDEX
   Page-specific stylesheet
========================================================= */


/* =========================================================
   PAGE
========================================================= */

.payment-page {
    width: 100%;

    display: grid;

    gap: 18px;

    color: #172b45;
}

.payment-page * {
    box-sizing: border-box;
}


/* =========================================================
   PAGE HEADING
========================================================= */

.payment-heading {
    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    gap: 15px;
}

.payment-heading h2 {
    margin: 0;

    color: #1d3557;

    font-size: 21px;
    line-height: 1.3;

    font-weight: 900;

    letter-spacing: -.25px;
}

.payment-heading p {
    margin: 5px 0 0;

    color: #8b98aa;

    font-size: 11px;
    line-height: 1.5;
}


/* =========================================================
   STATISTICS
========================================================= */

.stats-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;
}

.stat-card {
    position: relative;

    min-width: 0;

    padding: 18px;

    background: #ffffff;

    border: 1px solid #e3eaf4;

    border-radius: 15px;

    box-shadow:
        0 6px 20px rgba(31, 52, 80, .025);

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease;
}



.stat-card:hover {
    transform: translateY(-2px);

    border-color: #d6e2ef;

    box-shadow:
        0 10px 28px rgba(31, 52, 80, .07);
}

.stat-label {
    color: #8997aa;

    font-size: 9px;
    line-height: 1.4;

    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: .55px;
}

.stat-value {
    margin-top: 7px;

    color: #253b55;

    font-size: 24px;
    line-height: 1.15;

    font-weight: 900;

    letter-spacing: -.3px;
}

.stat-description {
    margin-top: 5px;

    color: #9aa6b6;

    font-size: 9px;
    line-height: 1.4;
}

.stat-green .stat-value {
    color: #198754;
}

.stat-orange .stat-value {
    color: #b7791f;
}

.stat-red .stat-value {
    color: #dc3545;
}


/* =========================================================
   TOTAL PAYMENT CARD
========================================================= */

.total-card {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding: 20px 22px;

    background:
        linear-gradient(
            135deg,
            #1769e0,
            #3d8cff
        );

    border-radius: 15px;

    color: #ffffff;

    box-shadow:
        0 8px 25px rgba(23, 105, 224, .12);
}

.total-label {
    color: rgba(255,255,255,.88);

    font-size: 10px;

    line-height: 1.4;

    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: .5px;
}

.total-value {
    margin-top: 5px;

    color: #ffffff;

    font-size: 27px;

    line-height: 1.15;

    font-weight: 900;

    letter-spacing: -.4px;
}

.total-icon {
    font-size: 28px;

    line-height: 1;
}


/* =========================================================
   FILTER CARD
========================================================= */

.filter-card {
    width: 100%;

    padding: 18px;

    background: #ffffff;

    border: 1px solid #e3eaf4;

    border-radius: 15px;

    box-shadow:
        0 6px 22px rgba(31, 52, 80, .03);
}

.filter-title {
    margin-bottom: 13px;

    color: #273b59;

    font-size: 13px;

    line-height: 1.3;

    font-weight: 900;
}

.filter-form {
    display: grid;

    grid-template-columns:
        minmax(220px, 2fr)
        minmax(150px, 1fr)
        minmax(150px, 1fr)
        auto
        auto;

    gap: 10px;

    align-items: end;
}


/* =========================================================
   FILTER FIELDS
========================================================= */

.field {
    min-width: 0;
}

.field label {
    display: block;

    margin-bottom: 6px;

    color: #8b98aa;

    font-size: 9px;

    line-height: 1.3;

    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: .45px;
}

.field input,
.field select {
    width: 100%;

    height: 40px;

    min-height: 40px;

    padding: 0 11px;

    border: 1px solid #dfe6ee;

    border-radius: 8px;

    background: #ffffff;

    color: #344966;

    outline: none;

    font-family: inherit;

    font-size: 11px;

    line-height: 1.2;

    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        background-color .18s ease;
}

.field input::placeholder {
    color: #a0acba;
}

.field input:focus,
.field select:focus {
    background: #ffffff;

    border-color: #1769e0;

    box-shadow:
        0 0 0 3px
        rgba(23, 105, 224, .08);
}


/* =========================================================
   COMMON BUTTONS
========================================================= */

.search-btn,
.reset-btn,
.manual-btn,
.view-btn,
.loan-link {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    box-sizing: border-box;

    height: 40px;

    min-height: 40px;

    padding: 0 14px;

    border-radius: 8px;

    font-family: inherit;

    font-size: 10px;

    line-height: 1;

    font-weight: 800;

    text-decoration: none;

    white-space: nowrap;

    cursor: pointer;
}


/* =========================================================
   SEARCH BUTTON
========================================================= */

.search-btn {
    border: 0;

    background: #1769e0;

    color: #ffffff;

    transition:
        background-color .18s ease,
        transform .18s ease,
        box-shadow .18s ease;
}

.search-btn:hover {
    background: #0f5bc7;

    transform: translateY(-1px);

    box-shadow:
        0 5px 12px
        rgba(23, 105, 224, .16);
}

.search-btn:active {
    transform: translateY(0);
}


/* =========================================================
   RESET BUTTON
========================================================= */

.reset-btn {
    border: 1px solid #dfe6ee;

    background: #ffffff;

    color: #64748b;

    transition:
        background-color .18s ease,
        border-color .18s ease,
        color .18s ease;
}

.reset-btn:hover {
    background: #f8fafc;

    border-color: #d5e0ec;

    color: #1769e0;
}


/* =========================================================
   TABLE CARD
========================================================= */

.table-card {
    width: 100%;

    background: #ffffff;

    border: 1px solid #e3eaf4;

    border-radius: 15px;

    overflow: hidden;

    box-shadow:
        0 7px 25px
        rgba(31, 52, 80, .035);
}


/* =========================================================
   TABLE HEADER
========================================================= */

.table-head {
    min-height: 60px;

    padding: 0 20px;

    border-bottom: 1px solid #edf1f6;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 15px;
}

.table-head h3 {
    margin: 0;

    color: #273b59;

    font-size: 14px;

    line-height: 1.3;

    font-weight: 900;
}

.table-head p {
    margin: 4px 0 0;

    color: #9aa6b6;

    font-size: 9px;

    line-height: 1.4;
}

.table-actions {
    display: flex;

    align-items: center;

    gap: 10px;
}

.result-count {
    color: #8b98aa;

    font-size: 10px;

    line-height: 1.3;

    white-space: nowrap;
}


/* =========================================================
   MANUAL PAYMENT BUTTON
========================================================= */

.manual-btn {
    border: 0;

    background: #1769e0;

    color: #ffffff;

    transition:
        background-color .18s ease,
        transform .18s ease,
        box-shadow .18s ease;
}

.manual-btn:hover {
    background: #1259bd;

    transform: translateY(-1px);

    box-shadow:
        0 5px 12px
        rgba(23, 105, 224, .15);
}


/* =========================================================
   TABLE WRAPPER
========================================================= */

.table-wrap {
    width: 100%;

    overflow: hidden;
}

.payments-table-scroll {
    width: 100%;

    overflow-x: auto;

    overflow-y: hidden;

    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;

    scrollbar-color:
        #b8c0cc
        #f1f3f6;
}

.payments-table-scroll::-webkit-scrollbar {
    height: 7px;
}

.payments-table-scroll::-webkit-scrollbar-track {
    background: #f1f3f6;

    border-radius: 10px;
}

.payments-table-scroll::-webkit-scrollbar-thumb {
    background: #b8c0cc;

    border-radius: 10px;
}

.payments-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #8d98a8;
}


/* =========================================================
   PAYMENTS TABLE
========================================================= */

.payments-table-scroll table {
    width: 100%;

    min-width: 1100px;

    margin: 0;

    border-collapse: collapse;

    border-spacing: 0;

    table-layout: auto;
}

.payments-table-scroll th {
    padding: 13px 15px;

    background: #f8fafc;

    border-bottom: 1px solid #e9eef4;

    color: #718198;

    font-family: inherit;

    font-size: 9px;

    line-height: 1.3;

    font-weight: 900;

    text-align: left;

    text-transform: uppercase;

    letter-spacing: .5px;

    white-space: nowrap;
}

.payments-table-scroll td {
    padding: 15px 15px;

    border-bottom: 1px solid #edf1f6;

    color: #344966;

    font-family: inherit;

    font-size: 11px;

    line-height: 1.45;

    vertical-align: middle;

    white-space: nowrap;
}

.payments-table-scroll tbody tr {
    transition:
        background-color .15s ease;
}

.payments-table-scroll tbody tr:hover {
    background: #fbfdff;
}

.payments-table-scroll tbody tr:last-child td {
    border-bottom: 0;
}


/* =========================================================
   CLIENT
========================================================= */

.client-name {
    display: block;

    color: #273b59;

    font-size: 12px;

    line-height: 1.4;

    font-weight: 800;
}

.client-sub {
    display: block;

    margin-top: 3px;

    color: #8b98aa;

    font-size: 10px;

    line-height: 1.4;
}


/* =========================================================
   LOAN / EMI
========================================================= */

.loan-number {
    display: block;

    color: #1769e0;

    font-size: 12px;

    line-height: 1.4;

    font-weight: 800;
}

.emi-number {
    display: block;

    margin-top: 3px;

    color: #64748b;

    font-size: 10px;

    line-height: 1.4;
}


/* =========================================================
   PAYMENT ID
========================================================= */

.payments-table-scroll td:nth-child(3) div {
    font-size: 10px !important;

    line-height: 1.4;
}

.payments-table-scroll td:nth-child(3) div:first-child {
    color: #53667d;

    font-family: monospace;
}


/* =========================================================
   AMOUNT
========================================================= */

.amount {
    color: #253b55;

    font-size: 12px;

    line-height: 1.4;

    font-weight: 900;

    white-space: nowrap;
}


/* =========================================================
   METHOD
========================================================= */

.method {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-height: 28px;

    padding: 0 9px;

    border-radius: 8px;

    background: #f4f7fa;

    color: #53667d;

    font-size: 9px;

    line-height: 1;

    font-weight: 800;

    text-transform: capitalize;

    white-space: nowrap;
}


/* =========================================================
   STATUS BADGES
========================================================= */

.badge {
    display: inline-flex;

    align-items: center;

    gap: 5px;

    min-height: 27px;

    padding: 0 9px;

    border-radius: 20px;

    font-size: 9px;

    line-height: 1;

    font-weight: 900;

    text-transform: uppercase;

    white-space: nowrap;
}

.badge-paid {
    background: #eaf8ef;

    color: #287646;
}

.badge-pending {
    background: #fff7e8;

    color: #b7791f;
}

.badge-failed {
    background: #fff1f2;

    color: #be123c;
}

.badge-gray {
    background: #f1f5f9;

    color: #64748b;
}


/* =========================================================
   ACTION BUTTONS
========================================================= */

.view-btn,
.loan-link {
    height: 32px;

    min-height: 32px;

    padding: 0 11px;

    font-size: 10px;

    border-radius: 8px;

    transition:
        background-color .18s ease,
        border-color .18s ease,
        color .18s ease,
        transform .18s ease;
}

.view-btn {
    background: #eaf2ff;

    border: 1px solid #dce7f5;

    color: #1769e0;
}

.view-btn:hover {
    background: #1769e0;

    border-color: #1769e0;

    color: #ffffff;

    transform: translateY(-1px);
}

.loan-link {
    margin-left: 5px;

    background: #f0fdf4;

    border: 1px solid #d9f0df;

    color: #198754;
}

.loan-link:hover {
    background: #198754;

    border-color: #198754;

    color: #ffffff;

    transform: translateY(-1px);
}


/* =========================================================
   EMPTY STATE
========================================================= */

.empty {
    padding: 55px 20px;

    text-align: center;

    color: #9aa6b6;

    font-size: 11px;

    line-height: 1.5;
}


/* =========================================================
   PAGINATION
========================================================= */

.pagination-area {
    min-height: 64px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding: 12px 18px;

    box-sizing: border-box;

    background: #ffffff;

    border-top: 1px solid #edf1f6;
}

.pagination-info {
    flex: 0 0 auto;

    color: #8997aa;

    font-size: 11px;

    line-height: 1.4;

    white-space: nowrap;
}

.pagination-links {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 5px;

    flex: 0 0 auto;
}

.pagination-btn {
    width: 34px;

    min-width: 34px;

    height: 34px;

    min-height: 34px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    box-sizing: border-box;

    margin: 0;

    padding: 0;

    border: 1px solid #dfe6ef;

    border-radius: 8px;

    background: #ffffff;

    color: #64748b;

    font-family: inherit;

    font-size: 12px;

    line-height: 1;

    font-weight: 700;

    text-decoration: none;

    white-space: nowrap;

    cursor: pointer;

    transition:
        background-color .18s ease,
        border-color .18s ease,
        color .18s ease,
        transform .18s ease;
}

.pagination-btn:hover {
    background: #f4f8fd;

    border-color: #cfddeb;

    color: #1769e0;

    transform: translateY(-1px);
}

.pagination-btn.active {
    background: #1769e0;

    border-color: #1769e0;

    color: #ffffff;

    font-weight: 800;

    cursor: default;
}

.pagination-btn.disabled {
    background: #f8fafc;

    border-color: #edf1f5;

    color: #b7c0cb;

    cursor: default;
}

.pagination-btn.disabled:hover {
    background: #f8fafc;

    border-color: #edf1f5;

    color: #b7c0cb;

    transform: none;
}


/* =========================================================
   MANUAL PAYMENT MODAL
========================================================= */

.modal-overlay {
    display: none;

    position: fixed;

    inset: 0;

    z-index: 99999;

    padding: 18px;

    align-items: center;

    justify-content: center;

    background: rgba(5, 18, 35, .58);

    backdrop-filter: blur(3px);

    -webkit-backdrop-filter: blur(3px);
}

.modal {
    width: 100%;

    max-width: 520px;

    max-height: calc(100vh - 36px);

    background: #ffffff;

    border-radius: 16px;

    overflow: hidden;

    box-shadow:
        0 25px 70px
        rgba(0, 0, 0, .22);
}

.modal-header {
    padding: 18px 20px;

    border-bottom: 1px solid #edf1f6;

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 15px;

    background: #ffffff;
}

.modal-header h3 {
    margin: 0;

    color: #273b59;

    font-size: 15px;

    line-height: 1.3;

    font-weight: 900;
}

.modal-header p {
    margin: 4px 0 0;

    color: #9aa6b6;

    font-size: 9px;

    line-height: 1.4;
}

.modal-close {
    width: 32px;

    height: 32px;

    flex: 0 0 32px;

    border: 0;

    border-radius: 8px;

    background: #f4f7fa;

    color: #64748b;

    font-size: 19px;

    line-height: 1;

    cursor: pointer;

    transition:
        background-color .18s ease,
        color .18s ease;
}

.modal-close:hover {
    background: #eaf2ff;

    color: #1769e0;
}

.modal-body {
    padding: 20px;

    display: grid;

    gap: 12px;

    max-height: calc(100vh - 130px);

    overflow-y: auto;
}

.form-group label {
    display: block;

    margin-bottom: 6px;

    color: #63758c;

    font-size: 9px;

    line-height: 1.3;

    font-weight: 800;
}

.form-control {
    width: 100%;

    height: 40px;

    min-height: 40px;

    padding: 0 11px;

    border: 1px solid #dfe6ee;

    border-radius: 8px;

    background: #ffffff;

    color: #344966;

    outline: none;

    font-family: inherit;

    font-size: 11px;

    line-height: 1.2;

    transition:
        border-color .18s ease,
        box-shadow .18s ease;
}

.form-control:focus {
    border-color: #1769e0;

    box-shadow:
        0 0 0 3px
        rgba(23, 105, 224, .08);
}

textarea.form-control {
    height: 85px;

    min-height: 85px;

    padding: 10px;

    resize: vertical;

    line-height: 1.5;
}

.modal-info {
    padding: 11px;

    border-radius: 8px;

    background: #f1f6ff;

    color: #63758c;

    font-size: 9px;

    line-height: 1.5;
}

.modal-actions {
    display: flex;

    gap: 9px;

    margin-top: 4px;
}

.modal-actions button {
    flex: 1;
}

.cancel-btn,
.save-btn {
    height: 40px;

    min-height: 40px;

    border-radius: 8px;

    font-family: inherit;

    font-size: 10px;

    line-height: 1;

    font-weight: 800;

    cursor: pointer;
}

.cancel-btn {
    border: 1px solid #dfe6ee;

    background: #f5f7fa;

    color: #53667d;
}

.cancel-btn:hover {
    background: #eef2f6;
}

.save-btn {
    border: 0;

    background: #1769e0;

    color: #ffffff;
}

.save-btn:hover {
    background: #1259bd;
}


/* =========================================================
   LARGE TABLET
========================================================= */

@media (max-width: 1000px) {

    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .filter-form {
        grid-template-columns:
            1fr 1fr;
    }

    .search-btn,
    .reset-btn {
        width: 100%;
    }

}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 800px) {

    .payment-heading h2 {
        font-size: 20px;
    }

    .payments-table-scroll table {
        min-width: 1080px;
    }

    .payments-table-scroll th {
        padding: 12px 14px;

        font-size: 9px;
    }

    .payments-table-scroll td {
        padding: 14px;

        font-size: 11px;
    }

    .client-name,
    .loan-number {
        font-size: 11px;
    }

    .client-sub,
    .emi-number {
        font-size: 9px;
    }

    .amount {
        font-size: 12px;
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {

    .payment-page {
        gap: 14px;
    }

    .payment-heading {
        flex-direction: column;

        align-items: flex-start;
    }

    .payment-heading h2 {
        font-size: 19px;
    }

    .payment-heading p {
        font-size: 10px;
    }


    /* Statistics */

    .stats-grid {
        grid-template-columns: 1fr;

        gap: 10px;
    }

    .stat-card {
        padding: 16px;

        border-radius: 14px;
    }

    .stat-value {
        font-size: 23px;
    }


    /* Total */

    .total-card {
        padding: 18px;

        border-radius: 14px;
    }

    .total-label {
        font-size: 9px;
    }

    .total-value {
        font-size: 24px;
    }

    .total-icon {
        font-size: 24px;
    }


    /* Filter */

    .filter-card {
        padding: 15px;

        border-radius: 14px;
    }

    .filter-title {
        font-size: 12px;
    }

    .filter-form {
        grid-template-columns: 1fr;

        gap: 10px;
    }

    .field input,
    .field select {
        height: 40px;

        font-size: 11px;
    }

    .search-btn,
    .reset-btn {
        width: 100%;

        height: 40px;
    }


    /* Table */

    .table-card {
        border-radius: 14px;
    }

    .table-head {
        min-height: 57px;

        padding: 11px 15px;

        align-items: flex-start;

        flex-direction: column;

        justify-content: center;

        gap: 5px;
    }

    .table-head h3 {
        font-size: 13px;
    }

    .table-head p {
        font-size: 9px;
    }

    .table-actions {
        width: 100%;

        justify-content: space-between;
    }

    .manual-btn {
        width: 100%;
    }

    .payments-table-scroll table {
        min-width: 1050px;
    }

    .payments-table-scroll th {
        padding: 11px 12px;

        font-size: 8px;
    }

    .payments-table-scroll td {
        padding: 13px 12px;

        font-size: 10px;
    }

    .client-name {
        font-size: 11px;
    }

    .client-sub {
        font-size: 9px;
    }

    .loan-number {
        font-size: 11px;
    }

    .emi-number {
        font-size: 9px;
    }

    .amount {
        font-size: 11px;
    }

    .method {
        min-height: 27px;

        padding: 0 8px;

        font-size: 8px;
    }

    .badge {
        min-height: 26px;

        padding: 0 8px;

        font-size: 8px;
    }

    .view-btn,
    .loan-link {
        height: 31px;

        min-height: 31px;

        padding: 0 10px;

        font-size: 9px;
    }


    /* Pagination */

    .pagination-area {
        min-height: auto;

        flex-direction: column;

        align-items: flex-start;

        justify-content: center;

        gap: 10px;

        padding: 12px;
    }

    .pagination-info {
        width: 100%;

        font-size: 10px;
    }

    .pagination-links {
        width: 100%;

        justify-content: flex-start;

        gap: 4px;

        overflow-x: auto;

        overflow-y: hidden;

        padding-bottom: 2px;

        scrollbar-width: none;

        -webkit-overflow-scrolling: touch;
    }

    .pagination-links::-webkit-scrollbar {
        display: none;
    }

    .pagination-btn {
        width: 32px;

        min-width: 32px;

        height: 32px;

        min-height: 32px;

        border-radius: 7px;

        font-size: 11px;
    }


    /* Modal */

    .modal-overlay {
        padding: 10px;

        align-items: flex-end;
    }

    .modal {
        max-height: calc(100vh - 20px);

        border-radius:
            16px 16px 12px 12px;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;

        max-height: calc(100vh - 110px);
    }

}


/* =========================================================
   VERY SMALL MOBILE
========================================================= */

@media (max-width: 420px) {

    .payment-page {
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 22px;
    }

    .total-card {
        padding: 16px;
    }

    .total-value {
        font-size: 23px;
    }

    .filter-card {
        padding: 14px;
    }

    .payments-table-scroll table {
        min-width: 1020px;
    }

    .payments-table-scroll th {
        padding: 10px 11px;

        font-size: 8px;
    }

    .payments-table-scroll td {
        padding: 12px 11px;

        font-size: 10px;
    }

    .client-name,
    .loan-number {
        font-size: 10px;
    }

    .client-sub,
    .emi-number {
        font-size: 8px;
    }

    .amount {
        font-size: 11px;
    }

    .method,
    .badge {
        font-size: 7.5px;
    }

    .view-btn,
    .loan-link {
        font-size: 8px;

        padding: 0 9px;
    }

    .pagination-btn {
        width: 30px;

        min-width: 30px;

        height: 30px;

        min-height: 30px;

        font-size: 10px;
    }

}


/* =========================================================
   ACCESSIBILITY
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .stat-card,
    .search-btn,
    .reset-btn,
    .manual-btn,
    .view-btn,
    .loan-link,
    .pagination-btn,
    .modal-close {
        transition: none;
    }

    .stat-card:hover,
    .search-btn:hover,
    .manual-btn:hover,
    .view-btn:hover,
    .loan-link:hover,
    .pagination-btn:hover {
        transform: none;
    }

}