/* ==========================================================================
   BD Mobile Payment Gateway - Premium Modal Stylesheet
   ========================================================================== */

:root {
    --bd-overlay-bg: rgba(15, 23, 42, 0.8);
    --bd-modal-bg: #ffffff;
    --bd-modal-text: #0f172a;
    --bd-modal-muted: #64748b;
    --bd-modal-border: #e2e8f0;
    --bd-modal-card-bg: #f8fafc;
    --bd-modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --bd-font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bd-theme-color: #0f172a; /* Dynamic variable overriden by database setting */
    --method-theme-color: #0f172a; /* Dynamic brand accent color */
}

/* Dark Mode adaptation */
@media (prefers-color-scheme: dark) {
    :root {
        --bd-overlay-bg: rgba(2, 6, 23, 0.85);
        --bd-modal-bg: #0f172a;
        --bd-modal-text: #f8fafc;
        --bd-modal-muted: #94a3b8;
        --bd-modal-border: #1e293b;
        --bd-modal-card-bg: #1e293b;
        --bd-modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }
}

/* 1. Modal Overlay Shell */
.bd-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bd-overlay-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.bd-modal-overlay.bd-modal-active {
    opacity: 1;
    visibility: visible;
}

/* 2. Modal Window */
.bd-modal-window {
    position: relative;
    background-color: var(--bd-modal-bg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    margin: 20px;
    border-radius: 24px;
    border: 1px solid var(--bd-modal-border);
    box-shadow: var(--bd-modal-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: var(--bd-font-stack);
    color: var(--bd-modal-text);
}

.bd-modal-overlay.bd-modal-active .bd-modal-window {
    transform: scale(1) translateY(0);
}

/* Top Close Button */
.bd-modal-close-trigger {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--bd-modal-card-bg);
    border: 1px solid var(--bd-modal-border);
    font-size: 20px;
    line-height: 1;
    color: var(--bd-modal-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s, color 0.25s, transform 0.2s;
    z-index: 100;
}

.bd-modal-close-trigger:hover {
    background-color: var(--bd-modal-border);
    color: var(--bd-modal-text);
    transform: rotate(90deg);
}

/* Scroll wrapper body */
.bd-modal-body-scroll {
    overflow-y: auto;
    padding: 32px;
    box-sizing: border-box;
}

/* Step screens toggle system */
.bd-modal-step {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bd-modal-step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Titles and labels */
.bd-store-logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    min-height: 48px;
    align-items: center;
}

.bd-summary-logo {
    max-height: 52px;
    object-fit: contain;
}

.bd-step-title {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin: 0 0 6px 0;
    color: var(--bd-modal-text);
    letter-spacing: -0.02em;
}

.bd-step-subtitle {
    font-size: 13px;
    color: var(--bd-modal-muted);
    text-align: center;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* Summary Details Card */
.bd-summary-card {
    background-color: var(--bd-modal-card-bg);
    border: 1px solid var(--bd-modal-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bd-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px dashed var(--bd-modal-border);
    padding-bottom: 10px;
}

.bd-summary-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.bd-summary-label {
    font-size: 12px;
    color: var(--bd-modal-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.bd-summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--bd-modal-text);
    text-align: right;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.font-dense {
    max-width: 60%;
    word-break: break-all;
    font-size: 13px;
}

.font-total {
    font-size: 18px;
    font-weight: 800;
    color: var(--bd-theme-color);
}

/* Premium Buttons */
.bd-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background-color: var(--bd-theme-color);
    color: #ffffff !important;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.25s, transform 0.15s, opacity 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.bd-btn-primary:hover {
    filter: brightness(1.15);
}

.bd-btn-primary:active {
    transform: scale(0.98);
}

.bd-btn-primary:disabled {
    background-color: var(--bd-modal-border) !important;
    color: var(--bd-modal-muted) !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.bd-btn-back-arrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--bd-modal-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
    margin-bottom: 16px;
    margin-left: -8px;
}

.bd-btn-back-arrow:hover {
    background-color: var(--bd-modal-card-bg);
    color: var(--bd-modal-text);
}

/* Method Grid Selectors */
.bd-methods-selector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.bd-method-selection-card {
    position: relative;
    background-color: var(--bd-modal-card-bg);
    border: 2px solid var(--bd-modal-border);
    border-radius: 16px;
    padding: 24px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.bd-method-selection-card:hover {
    transform: translateY(-3px);
    border-color: var(--bd-modal-muted);
}

.bd-method-selection-card.active {
    border-color: var(--method-color);
    background-color: rgba(15, 23, 42, 0.02);
}

/* Checked indicators on cards */
.bd-card-checkbox-circle {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bd-modal-border);
    background-color: #fff;
    transition: border-color 0.2s, background-color 0.2s;
}

.bd-method-selection-card.active .bd-card-checkbox-circle {
    border-color: var(--method-color);
    background-color: var(--method-color);
    box-shadow: inset 0 0 0 2px #fff;
}

.bd-method-selection-logo {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    padding: 2px;
}

.bd-method-selection-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.bd-method-selection-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--bd-modal-text);
}

/* ==========================================================================
   DYNAMIC PAYMENT INTERFACE DETAIL STYLE
   ========================================================================== */
.bd-payment-interface-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bd-interface-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--bd-modal-border);
    padding-bottom: 16px;
    margin-bottom: 4px;
}

.bd-interface-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--bd-modal-border);
    background-color: #fff;
    padding: 2px;
}

.bd-interface-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bd-interface-method-label {
    font-size: 12px;
    color: var(--bd-modal-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.bd-interface-amount {
    font-size: 18px;
    font-weight: 800;
    color: var(--bd-modal-text);
}

/* Detail Rows */
.bd-interface-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bd-modal-card-bg);
    border: 1px solid var(--bd-modal-border);
    border-radius: 14px;
    padding: 14px 16px;
    box-sizing: border-box;
}

.bd-detail-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bd-detail-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bd-modal-muted);
    font-weight: 700;
}

.bd-detail-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--bd-modal-text);
}

.bd-currency-label {
    font-size: 11px;
    color: var(--bd-modal-muted);
}

/* Copy Buttons */
.bd-btn-copy-action {
    background-color: var(--bd-modal-border);
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--bd-modal-text);
    transition: all 0.25s ease;
}

.bd-btn-copy-action:hover {
    background-color: var(--bd-modal-muted);
    color: #fff;
}

.bd-btn-copy-action.copied {
    background-color: #22c55e !important;
    color: #ffffff !important;
}

/* Instructions card */
.bd-interface-instructions-box {
    background-color: var(--bd-modal-card-bg);
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid var(--method-theme-color);
}

.bd-instructions-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--bd-modal-muted);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 8px;
}

.bd-instructions-text {
    font-size: 12px;
    line-height: 1.6;
    color: var(--bd-modal-muted);
}

.bd-interface-image-box {
    display: flex;
    justify-content: center;
    border: 1px dashed var(--bd-modal-border);
    padding: 12px;
    border-radius: 12px;
    background: #fff;
}

.bd-qr-image {
    max-height: 150px;
    object-fit: contain;
}

/* ==========================================================================
   COUNTDOWN AND LOADER SPINNER
   ========================================================================== */
.bd-countdown-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0;
    box-sizing: border-box;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bd-countdown-wrapper.bd-fade-out {
    opacity: 0;
    transform: scale(0.95);
    height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

.bd-countdown-spinner-circle {
    position: relative;
    width: 64px;
    height: 64px;
}

.bd-spinner-ring-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.bd-ring-track {
    fill: none;
    stroke: var(--bd-modal-border);
    stroke-width: 3;
}

.bd-ring-fill {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke: var(--method-theme-color);
    transition: stroke-dasharray 0.1s linear;
}

.bd-spinner-timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 800;
    color: var(--bd-modal-text);
}

.bd-waiting-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--bd-modal-muted);
    margin: 0;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   TRANSACTION INPUT FORM (FADE-IN / SLIDE-UP ANIMATION)
   ========================================================================== */
.bd-verification-inputs-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.bd-verification-inputs-wrapper.active {
    transform: translateY(0);
    opacity: 1;
}

.bd-hidden-anim {
    display: none;
}

.bd-form-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.bd-field-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--bd-modal-text);
}

.bd-field-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--bd-modal-border);
    border-radius: 12px;
    background-color: var(--bd-modal-bg);
    color: var(--bd-modal-text);
    font-size: 16px;
    font-weight: 700;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.25s, box-shadow 0.25s;
    text-transform: uppercase;
}

.bd-field-input:focus {
    border-color: var(--method-theme-color);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.bd-field-help-text {
    font-size: 11px;
    color: var(--bd-modal-muted);
    line-height: 1.4;
}

/* Verify submit and loader animation */
.bd-btn-verify {
    background-color: var(--method-theme-color) !important;
}

.bd-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: bd-spin-anim 0.8s linear infinite;
}

@keyframes bd-spin-anim {
    to { transform: rotate(360deg); }
}

/* Error box styling */
.bd-error-banner {
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
}

/* Helpers */
.bd-hidden {
    display: none !important;
}

/* ==========================================================================
   SUCCESS SPLASH ANIMATION
   ========================================================================== */
#bd-step-success {
    text-align: center;
    padding: 30px 10px;
}

.bd-success-graphic {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.bd-success-checkmark {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #22c55e;
    stroke-miterlimit: 10;
    box-shadow: inset 0 0 0 #22c55e;
    animation: fill-checkmark-anim .4s ease-in-out .4s forwards, scale-checkmark-anim .3s ease-in-out .9s alternate forwards;
}

.bd-success-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #22c55e;
    fill: none;
    animation: stroke-circle-anim 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.bd-success-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke-check-anim 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

.bd-success-header {
    font-size: 20px;
    font-weight: 800;
    color: #22c55e;
    margin: 0 0 8px 0;
}

.bd-success-para {
    font-size: 13px;
    color: var(--bd-modal-muted);
    line-height: 1.5;
    margin: 0;
}

@keyframes stroke-circle-anim {
    100% { stroke-dashoffset: 0; }
}

@keyframes stroke-check-anim {
    100% { stroke-dashoffset: 0; }
}

@keyframes fill-checkmark-anim {
    100% { box-shadow: inset 0 0 0 40px rgba(34, 197, 94, 0.1); }
}

@keyframes scale-checkmark-anim {
    0% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
    100% { transform: scale3d(1, 1, 1); }
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.bd-toast {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background-color: #0f172a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 20px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: opacity 0.25s, transform 0.25s;
    opacity: 1;
    pointer-events: none;
    white-space: nowrap;
}

.bd-toast-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
}
