/*
 * ROOT VARIABLES AND BOX-SIZING
 * ----------------------------------------------------
 */
:root {
    --bg-color: #f4f4f4;
    --bg-color2: white;
    --primary: #003366;
    --secondary: #009900;
    --accent: #ffcc00;
    --other-color: #cc0000;
    --txt-colorBg: #333;
    --txt-colorPrimary: white;
}

*,
*:after,
*:before {
    box-sizing: border-box;
}

/*
 * BASE STYLES
 * ----------------------------------------------------
 */
body {
    font-family: Arial, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    min-height: 100vh;
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    /* The main overflow protection */
    overflow-x: hidden;
}

.header {
    background-color: var(--primary);
    color: var(--txt-colorPrimary);
    text-align: center;
    padding: 20px 0;
}

nav {
    margin-top: 1.5rem;
    margin-left: 1.2rem;
    margin-bottom: 0.1rem;
}

.breadcrumb {
    margin-bottom: 0.2rem;
}

.fixed-header {
    width: 100%;
    position: sticky;
    top: 0;
    background-color: var(--bg-color2);
    z-index: 1;
    padding: 1px 1rem;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

.fixed-header p {
    margin-bottom: 0;
}

/*
 * CARD CONTAINER AND ITEM CARDS
 * ----------------------------------------------------
 */
.card-container {
    padding: 10px;
}

.item-card {
    display: grid;
    grid-template-rows: 1fr auto;
    width: 100%;
    margin: 5px auto;
    padding: 0.5rem;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
}

.ref-details {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-row: 1 / 2;
    gap: 0.5rem;
}

.section-L {
    text-align: left;
    justify-self: start;
    word-break: break-word;
    overflow-wrap: break-word;
}

.section-R {
    text-align: right;
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* MODIFIED: section-action for a non-wrapping single row with scrolling */
.section-action {
    grid-row: 2 / 3;
    display: flex;
    flex-wrap: nowrap; /* Prevents buttons from wrapping */
    justify-content: flex-start; /* Aligns buttons to the left */
    gap: 10px;
    border-top: #000 solid 1px;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    width: 100%;
    overflow-x: auto; /* **CRITICAL:** Enables horizontal scrolling */
    /* Optional: Hide the scrollbar for a cleaner look */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.section-action::-webkit-scrollbar {
    display: none;
}


/*
 * TYPOGRAPHY AND CONTENT STYLES
 * ----------------------------------------------------
 */
.transaction-Amount {
    margin-top: 1.3rem;
    white-space: nowrap;
}

strong, .strong {
    font-weight: 700;
}

.strong-one {
    font-weight: 700;
}

.small {
    color: #999;
    font-size: 0.875em;
}

/*
 * PAYMENT STATUS AND ENDORSEMENT BADGES
 * ----------------------------------------------------
 */
.payment-status {
    display: inline-block;
    border-radius: 1rem;
    padding: 0.05rem 0.6rem;
    text-align: center;
    font-size: 0.875em;
    margin-bottom: 0.25rem;
}

.endorse-status {
    display: inline-block;
    font-size: 0.875em;
    color: #4CAF50;
    margin-top: 0.25rem;
}
.endorse-status i {
    margin-right: 0.2rem;
}

/*
 * PAYMENT STATUS BADGES
 * ----------------------------------------------------
 */
.payment-status-successful {
    background-color: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.payment-status-failed, .payment-status-invalidated {
    background-color: rgba(244, 67, 54, 0.2);
    color: #F44336;
}

.payment-status-pending {
    background-color: rgba(255, 193, 7, 0.2);
    color: #FFC107;
}

/*
 * BUTTONS
 * ----------------------------------------------------
 * These styles are optimized to prevent buttons from growing or shrinking,
 * allowing them to maintain their natural width on a single line.
 */
.button {
    background-color: inherit;
    color: var(--primary);
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    line-height: normal;
    
    /* NEW: Flex properties for a non-wrapping layout */
    flex-grow: 0; /* Prevents buttons from growing */
    flex-shrink: 0; /* Prevents buttons from shrinking */
    flex-basis: auto; /* Buttons will take up their natural width */

    text-align: center;
    font-size: 0.9rem;
    white-space: nowrap;
}

.button:hover {
    background-color: #ebb800;
}

.button:active {
    background-color: var(--secondary);
}

/*
 * POPUP AND OVERLAY
 * ----------------------------------------------------
 */
.popup-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.close-popup {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
}

/*
 * MEDIA QUERIES FOR LARGER SCREENS (Tablets and Desktops)
 * ----------------------------------------------------
 * No significant changes are needed here since the mobile layout now handles the single-line requirement.
 */
@media (min-width: 768px) {
    .section-action {
        justify-content: space-evenly;
        gap: 20px;
    }

    .button {
        font-size: 1rem;
    }
}