body {
    background-color: #f4f4f4;
}

.navbar {
    background-color: #343a40;
    color: white;
    position: relative;
}

.navbar-title {
    font-size: 1.2rem;
    margin: auto;
}

#backButton {
    position: absolute;
    left: 10px;
}

/* Loading states */
.loader {
    text-align: center;
    width: 3rem;
    height: 3rem;
}

.loader-container {
    text-align: center;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.loader-text {
    margin-top: 0.5rem;
    font-weight: bold;
    color: #0d6efd;
}

/* Container layouts */
#app {
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    padding-top: 0.5rem;
}

/* No-card state */
.no-user-card {
    width: 100%;
    text-align: center;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.no-user-card img {
    max-width: 200px;
    height: auto;
    width: 50%;
}

.no-user-card h3 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 10px;
}

/* Order card button */
#order_card_btn {
    padding: 12px 24px;
    background-color: #007bff;
    color: white;
    font-size: 1.1rem;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: background-color 0.3s;
}

.btn-icon {
    font-size: 1.5rem;
}

.section-header {
    background-color: #ddd;
    padding: 10px;
    border-radius: 5px;
}

/* Carte bancaire style */
.card-container {
    perspective: 1000px;
    width: 320px;
    margin: auto;
}

.card-flip {
    position: relative;
    width: 100%;
    height: 200px;
    transform-style: preserve-3d;
    transition: transform 0.8s;
}

.card-flip.is-flipped {
    transform: rotateY(180deg);
}

.card-side {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card-front {
    background: linear-gradient(135deg, #1a1f71, #1e5799);
    color: #fff;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-back {
    background: #1e1e1e;
    color: #fff;
    padding: 15px;
    transform: rotateY(180deg);
}

.card-number {
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.card-holder {
    font-size: 0.9rem;
    text-transform: uppercase;
}

.card-expiry,
.card-cvv {
    font-size: 0.8rem;
}

.card-body {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Updated credit-card container - holds perspective and 3D context */
.credit-card {
    position: relative;
    width: 320px;
    height: 203px;
    perspective: 1000px;
    margin: 0 auto;
    background-color: transparent;
}

/* The card-flipper is the element that will rotate, including the background */
.card-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s;
}

/* When credit card has is-flipped class, rotate the flipper */
.credit-card.is-flipped .card-flipper {
    transform: rotateY(180deg);
}

/* Position both faces */
.card-info {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 15px;
    background-image: url('/static/images/card_blank.png');
    background-size: cover;
    background-position: center;
    pointer-events: auto;
    /* Ensure stable dimensions */
    box-sizing: border-box;
    padding: 20px;
    overflow: hidden;
    /* Prevent image overflow */
}

/* Front face (initially visible) */
.card-info.front {
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Back face (initially hidden because of backface-visibility and rotation) */
.card-info.back {
    transform: rotateY(180deg);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* When flipped, ensure back face is on top */
.credit-card.is-flipped .card-info.back {
    z-index: 3;
}

/* Buttons on card need to be explicitly clickable */
.card-info button,
.flip-button {
    pointer-events: auto !important;
}

/* Specific positioning for card elements */
.logo {
    position: absolute;
    top: 15px;
    right: 15px;
    left: auto;
    width: 50px;
    height: auto;
    z-index: 10;
}

/* Chip position - make it more stable */
.chip {
    position: absolute !important;
    top: 35% !important;
    /* Fixed position from top */
    left: 30px !important;
    width: 40px !important;
    height: 30px !important;
    object-fit: contain !important;
    z-index: 10 !important;
    transform: none !important;
    /* Remove any transform */
    transition: none !important;
    /* Remove transition effects */
}

/* Ensure chip container doesn't affect positioning */
.card-info.front .chip {
    transform: none !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

.balance {
    position: absolute !important;
    top: 15px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 1.2rem !important;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
    z-index: 999 !important;
    display: block !important;
    width: auto !important;
    text-align: center !important;
    padding: 5px !important;
    background: rgba(0, 0, 0, 0.2) !important;
    border-radius: 4px !important;
}

/* Magnetic strip position */
.magnetic-strip {
    position: absolute !important;
    top: 15% !important;
    /* Moved up from 20% to 15% */
    left: 0 !important;
    width: 100% !important;
    height: 40px !important;
    object-fit: cover !important;
    z-index: 10 !important;
    background-color: #000 !important;
}

/* Visa logo: bottom right */
.visa {
    position: absolute;
    bottom: 25px;
    right: 40px;
    width: 60px;
    height: auto;
    z-index: 10;
}

/* Valid/Unvalid image: just to the left of Visa, bottom right */
.valid,
.unvalid {
    position: absolute !important;
    bottom: 20px !important;
    right: 110px !important;
    width: 60px !important;
    max-height: 30px !important;
    aspect-ratio: 2 / 1 !important;
    object-fit: contain !important;
    padding: 0 !important;
    border-radius: 15px !important;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.08);
    z-index: 10 !important;
    transition: none !important;
}

.business-type {
    position: absolute;
    bottom: 10px;
    right: 15px;
    left: auto;
    width: 100px;
    height: auto;
    z-index: 10;
    /* Add margin-top if needed to avoid overlap with .visa */
}

/* Repositioned card elements */
.card-number {
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    text-align: center;
    width: 90%;
    /* Make it wider to fit all digits */
    white-space: nowrap;
    /* Prevent wrapping */
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.card-last-digits {
    position: absolute;
    bottom: 35px;
    left: 40px;
    font-size: 1.1rem;
    color: white;
    font-family: monospace;
    font-weight: 500;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    z-index: 10;
}

.valid-date {
    bottom: 30px;
    left: 30px;
}

.security-code {
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.hologram {
    width: 60px;
    height: 40px;
    background: linear-gradient(45deg, #c9d6ff, #e2e2e2);
    border-radius: 5px;
}

.cvv {
    padding: 10px;
    background-color: white;
    color: black;
    text-align: right;
    margin-top: 20px;
}

/* Removed hover effect to prevent flipping on hover */
/* .credit-card:hover {
    transform: rotateY(180deg);
} */

.icon-spacing {
    margin-right: 8px;
    /* Ajoute une marge à droite de l'icône */
}

/* Style for expiry date container - Value above Label */
.expiry-container {
    position: absolute;
    bottom: 15px;
    left: 25px;
    text-align: center;
    width: 60px;
    z-index: 10;
}

.expiry-value {
    font-size: 1rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.expiry-label {
    font-size: 0.7rem;
    opacity: 0.8;
    color: white;
}

/* Style for CVV container - Value above Label */
.cvv-container {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 60px;
    z-index: 10;
}

/* Shared height and vertical alignment for expiry/cvv values */
.expiry-value,
.cvv-display {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CVV Display area (acts as button) */
.cvv-display {
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 0;
    /* Remove padding to use fixed dimensions */
    margin-bottom: 3px;
    pointer-events: auto;
    /* Ensure consistent height and width */
    min-height: 28px;
    height: 28px;
    /* Fixed height */
    width: 50px;
    /* Fixed width */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* Center text/icon */
    box-sizing: border-box;
    /* Include padding/border in dimensions */
    color: white;
}

.cvv-display:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.cvv-label {
    font-size: 0.7rem;
    opacity: 0.8;
    color: white;
}

/* Center the flip button with fixed dimensions */
.flip-button {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 3;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    /* Prevent size changes on hover/click */
    box-sizing: border-box;
    width: 100px;
    /* Fixed width */
    height: 30px;
    /* Fixed height */
    justify-content: center;
}

/* Disable pointer events on the hidden side of the card */
.card-flipper:not(.is-flipped) .card-info.back {
    pointer-events: none;
}

.card-flipper.is-flipped .card-info.front {
    pointer-events: none;
}

/* Add the new rule for flipping based on the parent container */
.credit-card.is-flipped .card-flipper {
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
}

/* Set initial stacking order for card faces */
.card-info.front {
    z-index: 2;
}

.card-info.back {
    z-index: 1;
}

/* Swap stacking order when flipped (using the parent .credit-card ) */
.credit-card.is-flipped .card-flipper .card-info.front {
    z-index: 1;
}

.credit-card.is-flipped .card-flipper .card-info.back {
    z-index: 2;
}

/* Back logo - smaller than front logo */
.back-logo {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 30px;
    /* Smaller size */
    height: auto;
    z-index: 10;
}

/* Style for the copy button */
.copy-btn {
    transform: scale(0.5);
    /* Make it half size */
    /* Adjust margin if needed due to scaling */
    margin-left: 0;
    /* Reset margin */
    vertical-align: middle;
    /* Align vertically */
}

/* Container for card action buttons - explicit width and alignment */
.card-actions-container {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 10px;
    width: 320px;
    margin: 0 auto;
    /* Center the container */
    margin-bottom: 0.5rem;
}

/* Ensure consistent height and adjust text for card action buttons */
.card-action-btn {
    flex-grow: 1;
    flex-basis: 0;
    /* Force equal width distribution */
    min-height: 60px;
    padding: 8px 0;
}

.card-action-btn span {
    font-size: 0.9rem;
    /* Smaller text */
}

.card-action-btn i {
    font-size: 1.2rem;
    /* Adjust icon size if needed */
}

/* Transaction details */
.transaction-details-text {
    font-size: 1.2rem;
    color: #333;
}

/* Support link */
.support-link {
    text-decoration: none;
    color: inherit;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.w-100 {
    width: 100%;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-5 {
    margin-bottom: 3rem;
}

.pb-3 {
    padding-bottom: 1rem;
}

.pt-2 {
    padding-top: 0.5rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 1rem;
}

.p-4 {
    padding: 1.5rem;
}

.d-none {
    display: none;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-3 {
    gap: 1rem;
}

/* Enhanced and more specific styling for card-last-digits */
.card-info.front .card-last-digits,
.card-flipper .card-info.front .card-last-digits,
.credit-card .card-flipper .card-info.front .card-last-digits,
#user_card_find .card-info.front .card-last-digits,
#user_card_creating .card-info.front .card-last-digits,
div[id^="user_card_"] .card-info.front .card-last-digits {
    position: absolute !important;
    bottom: 20px !important;
    left: 25px !important;
    z-index: 999 !important;
    font-size: 1.1rem !important;
    color: black !important;
    font-weight: 500 !important;
    text-shadow: 0px 1px 2px rgba(255, 255, 255, 0.5) !important;
    display: block !important;
    transform: none !important;
    top: auto !important;
    right: auto !important;
}

/* Card states */
.card-view {
    transition: all 0.3s ease;
}

/* Scenario 1: No card (Enrollment needed) */
#user_card_none {
    text-align: center;
    padding: 2rem;
}

#user_card_none .card-message {
    color: #666;
    margin: 1rem 0;
}

#user_card_none .btn-primary {
    margin-top: 1rem;
}

/* Scenario 2: Card in issuance */
#user_card_creating {
    text-align: center;
    padding: 2rem;
}

#user_card_creating .card-message {
    color: #28a745;
    margin: 1rem 0;
}

#user_card_creating .spinner-border {
    margin: 1rem 0;
}

/* Scenario 3: Active card */
#user_card_find {
    padding: 1rem;
}

#user_card_find .card-last-digits {
    display: block;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
}

#user_card_find .flip-button {
    display: block;
    cursor: pointer;
}

/* Hide flip button and last digits in issuance state */
#user_card_creating .flip-button,
#user_card_creating .card-last-digits {
    display: none !important;
}

/* Card actions container */
.card-actions-container {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.card-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.card-action-btn:hover {
    transform: translateY(-2px);
}

/* Disable actions in issuance state */
#user_card_creating .card-actions-container {
    opacity: 0.5;
    pointer-events: none;
}

/* Ensure images don't overflow */
.card-info img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Make sure all text is visible */
.card-info * {
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Card number position on back */
.credit-card .card-flipper .card-info.back .card-number {
    position: absolute !important;
    top: 28% !important;
    /* Moved up from 35% to 28% */
    left: 55% !important;
    transform: translateX(-50%) !important;
    font-size: 1.2rem !important;
    width: 90% !important;
    text-align: center !important;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
    z-index: 999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 0 !important;
    background: transparent !important;
    gap: 5px !important;
}

.credit-card .card-flipper .card-info.back .card-number .copy-button {
    background: none !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    padding: 5px !important;
    margin-left: 2px !important;
    transition: opacity 0.3s !important;
    z-index: 1000 !important;
}

.credit-card .card-flipper .card-info.back .card-number .copy-button:hover {
    opacity: 0.7 !important;
}

.credit-card .card-flipper .card-info.back .card-number .copy-button i {
    font-size: 16px !important;
}

/* Hide card number on front */
.credit-card .card-flipper .card-info.front .card-number {
    display: none !important;
}

/* Ensure copy button is visible */
.credit-card .card-flipper .card-info.back .card-number .copy-btn {
    cursor: pointer !important;
    margin-left: 8px !important;
    width: 20px !important;
    height: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000 !important;
}

.credit-card .card-flipper .card-info.back .card-number .copy-btn i {
    font-size: 14px !important;
    color: white !important;
}

/* Controls explanation:
.logo         - Top right logo (Nova)
.chip         - Left, vertically centered chip
.balance      - Top center balance
.visa         - Bottom right Visa logo
.valid        - Bottom right, just left of Visa
.business-type- Bottom right or left, business type text
.magnetic-strip- Top of card back, black strip
.card-number  - Centered card number
.expiry-container - Expiry date, bottom left or right
.cvv-container- CVV, back of card, right or center
.flip-button  - Button to flip card
*/

/* Transaction Details Styles */
.transaction-details-container {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.transaction-header .card-title {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.transaction-amount-section {
    padding: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.transaction-amount-section h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8rem;
}

.transaction-amount-section h4 {
    margin: 10px 0 0;
    color: #7f8c8d;
    font-size: 1.4rem;
}

.transaction-details-section {
    margin-top: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: #7f8c8d;
    font-weight: 500;
}

.detail-value {
    color: #2c3e50;
    text-align: right;
}

/* Transaction List Styles */
.transaction-amount {
    font-weight: 600;
    color: #2c3e50;
    margin-top: 5px;
}

.badge {
    padding: 6px 12px;
    font-weight: 500;
    border: 2px solid transparent;
}

.badge.bg-warning {
    background-color: #fff3cd !important;
    color: #000000;
    border-color: #ffeeba;
}

.badge.bg-info {
    background-color: #d1ecf1 !important;
    color: #000000;
    border-color: #bee5eb;
}

.badge.bg-success {
    background-color: #72d066 !important;
    color: #000000;
    border-color: #c3e6cb;
}

.badge.bg-danger {
    background-color: #f8d7da !important;
    color: #000000;
    border-color: #f5c6cb;
}

.badge.bg-secondary {
    background-color: #e2e3e5 !important;
    color: #000000;
    border-color: #d6d8db;
}

.transaction-row {
    cursor: pointer;
    transition: background 0.2s;
}

.transaction-row:hover {
    background: #f0f4ff;
}

.settings,
.contact-support,
.tariff {
    cursor: pointer;
}

.word-wrap {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

#tx-merchant {
    max-width: 70%;
}

#tx-amount {
    white-space: nowrap;
}