/* public/assets/css/style.css
 *
 * Global styles for the Vult checkout page.
 * - Defines design tokens (colors, radii, shadows)
 * - Centers the main card on a soft background
 * - Styles form controls, currency pills, payment method cards, and result panel
 */

:root {
    --color-bg: #f5f7fb;
    --color-card-bg: #ffffff;
    --color-border: #e3e6f0;
    --color-border-strong: #ffb3b3;
    --color-text-main: #111827;
    --color-text-muted: #6b7280;
    --color-primary: #ff1a1a;
    --color-primary-soft: #ffe5e5;
    --color-cta: #111111;
    --color-cta-text: #ffffff;
    --color-warning: #f97316;
    --radius-lg: 1.25rem;
    --radius-md: 0.75rem;
    --radius-pill: 999px;
    --shadow-card: 0 24px 60px rgba(15, 23, 42, 0.12);
    --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.08);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

/* Basic reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font-main);
    background: radial-gradient(circle at top, #ffffff 0, var(--color-bg) 55%);
    color: var(--color-text-main);
}

/* Main wrapper */
.checkout-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
}

/* Header */
.checkout-header {
    text-align: center;
    margin-bottom: 24px;
}

.logo-wrap {
    margin-bottom: 16px;
}

.merchant-logo {
    width: 120px;
    height: auto;
    object-fit: contain;
}

.checkout-title-block {
    max-width: 640px;
    margin: 0 auto;
}

.checkout-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.checkout-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

/* Card */
.checkout-card {
    width: 100%;
    max-width: 720px;
    background: var(--color-card-bg);
    border-radius: 2rem;
    box-shadow: var(--shadow-card);
    padding: 32px 28px 28px;
}

/* Form */
.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-main);
}

/* Inputs */
.form-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 0.75rem;
    border: 1px solid var(--color-border);
    background-color: #f9fafb;
    font-size: 0.95rem;
    color: var(--color-text-main);
}

.form-input[readonly] {
    cursor: default;
}

.field-helper {
    margin: 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Amount display */
.amount-display {
    padding: 12px 14px;
    border-radius: 0.75rem;
    border: 1px solid var(--color-border);
    background-color: #f9fafb;
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.amount-value {
    display: inline-block;
}

/* Currency toggle pills */
.currency-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background-color: #f3f4f6;
    border-radius: var(--radius-pill);
    padding: 3px;
    gap: 3px;
}

.currency-pill {
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-muted);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.currency-pill.active {
    background-color: var(--color-primary);
    color: #ffffff;
}

/* Payment methods */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payment-method-card {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    background-color: #f9fafb;
    cursor: pointer;
    box-shadow: none;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.payment-method-card:hover {
    box-shadow: var(--shadow-soft);
    background-color: #ffffff;
}

.payment-method-card.active {
    border-color: var(--color-primary);
    background-color: #ffffff;
}

.pm-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background-color: #f3f4ff;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Simple icon colour variations */
.pm-icon-inapp {
    background: linear-gradient(135deg, var(--color-primary-soft), #ffffff);
}
.pm-icon-card {
    background: linear-gradient(135deg, #e0f2fe, #ffffff);
}
.pm-icon-momo {
    background: linear-gradient(135deg, #fef3c7, #ffffff);
}

.pm-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pm-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.pm-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.pm-tag-warning {
    font-size: 0.8rem;
    color: var(--color-warning);
    font-weight: 600;
}

.pm-radio-indicator {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
}

.payment-method-card.active .pm-radio-indicator {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

/* Pay button */
.pay-button {
    width: 100%;
    padding: 14px 16px;
    border-radius: 999px;
    border: none;
    background-color: var(--color-cta);
    color: var(--color-cta-text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
}

.pay-button:hover {
    background-color: #000000;
    transform: translateY(-1px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.pay-button:active {
    transform: translateY(0);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

/* Result section */
.result-section {
    margin-top: 16px;
    padding: 18px 16px;
    border-radius: 1.25rem;
    background-color: #f9fafb;
    border: 1px dashed var(--color-border);
}

.result-title {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
}

.result-text {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Footer */
.checkout-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.footer-security {
    margin: 0 0 4px;
}

.footer-copy {
    margin: 0 0 6px;
}

.footer-powered {
    display: flex;
    justify-content: center;
}

.powered-by-vult {
    height: 100px;
    width: 200px;
}

/* Misc */
.lock-icon {
    margin-right: 4px;
}

/* Responsive tweaks */
@media (max-width: 640px) {
    .checkout-card {
        padding: 22px 18px 18px;
        border-radius: 1.5rem;
    }

    .checkout-title {
        font-size: 1.6rem;
    }
}

/* =========================
   Result Panel / Animation
   ========================= */

.result-section {
    margin-top: 2rem;
    border-radius: 18px;
    background-color: #ffffff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    padding: 1.5rem 1.75rem;
    transition:
        max-height 0.35s ease,
        opacity 0.25s ease,
        transform 0.25s ease;
    max-height: 0;
    opacity: 0;
    transform: translateY(8px);
    overflow: hidden;
}

.result-section--visible {
    max-height: 700px; /* enough for QR + text */
    opacity: 1;
    transform: translateY(0);
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.result-text,
.result-caption {
    font-size: 0.875rem;
    color: #6b7280;
}

/* =========================
   Buttons for links/actions
   ========================= */

.primary-link-button,
.secondary-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.4rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.1s ease;
}

.primary-link-button {
    background-color: #111827; /* same family as Pay button */
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
}

.primary-link-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.45);
}

.secondary-link-button {
    background-color: #f9fafb;
    color: #111827;
    border-color: #e5e7eb;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.secondary-link-button:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

/* For "View receipt" button if you have one */
.receipt-button {
    margin-top: 1rem;
}

/* =========================
   MoMo code styling
   ========================= */

.momo-code-block {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background-color: #f9fafb;
    border: 1px dashed #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.momo-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    word-break: break-all;
}

.momo-help-text {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* =========================
   QR block
   ========================= */

.qr-block {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.qr-image {
    width: 200px;
    height: 200px;
    border-radius: 16px;
    background-color: #f9fafb;
    padding: 0.75rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

/* =========================
   Pay button loading state
   ========================= */

.pay-button.is-loading {
    position: relative;
    cursor: default;
    opacity: 0.9;
}

.pay-button.is-loading::after {
    content: "";
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffffff;
    animation: vult-spin 0.8s linear infinite;
}

@keyframes vult-spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* =========================
   Disabled state for controls
   ========================= */

.currency-toggle.is-disabled .currency-pill,
.payment-methods.is-disabled .payment-method-card {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

/* ============================== */
/* DISCOUNTED AMOUNT DISPLAY UI  */
/* ============================== */

.amount-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.amount-original {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9rem;
}

.amount-text {
    font-weight: 600;
    color: #111;
}

/* ===================================== */
/* IN-APP PAYMENT RESULT CUSTOM BUTTON   */
/* ===================================== */

.primary-link-button--inapp {
    background-color: #82d2e7 !important;  /* ADDED: custom in-app button color */
    color: #0a2a33 !important;             /* ADDED: readable dark text */
    border: none;
}

.result-block--centered {
    display: flex;               /* ADDED: center container */
    justify-content: center;     /* ADDED */
    margin-top: 10px;
    margin-bottom: 20px;
}

/* ===================================== */
/* ADDED: Back button / navigation link  */
/* ===================================== */

.checkout-back {
    margin-bottom: 12px;
}

.checkout-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--color-text-muted);
    background-color: #f3f4f6;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.1s ease;
}

.checkout-back-link:hover {
    background-color: #e5e7eb;
    color: var(--color-text-main);
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.checkout-back-icon {
    font-size: 0.95rem;
    line-height: 1;
}

/* ===================================== */
/* ADDED: Early-bird banner styles       */
/* ===================================== */

.early-bird-banner {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background-color: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 600;
}

.early-bird-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background-color: var(--color-primary);
}

.early-bird-countdown {
    font-weight: 500;
    color: var(--color-text-main);
}

/* Optional smaller font on mobile for banner */
@media (max-width: 640px) {
    .early-bird-banner {
        font-size: 0.75rem;
        padding: 5px 9px;
    }
}



/* =========================================================
   AWAITING PAYMENT / LOADING STATES
   ========================================================= */

/* Pay button base (defensive, in case not already defined) */
.pay-button {
    position: relative;
    transition: all 0.2s ease;
}

/* Loading state (Processing...) */
.pay-button.is-loading {
    cursor: wait;
    opacity: 0.85;
}

/* Awaiting payment state */
.pay-button.is-awaiting {
    cursor: not-allowed;
    opacity: 0.75;
    background: linear-gradient(
        90deg,
        #111827 0%,
        #1f2933 50%,
        #111827 100%
    );
    color: #f9fafb;
}

/* Optional subtle animated shimmer */
.pay-button.is-awaiting::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255,255,255,0.15) 50%,
        transparent 70%
    );
    animation: awaiting-shimmer 1.6s infinite;
    border-radius: inherit;
}

@keyframes awaiting-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* =========================================================
   RESULT SECTION – AWAITING BANNER
   ========================================================= */

.awaiting-banner {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px dashed rgba(15, 23, 42, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Spinner */
.awaiting-banner::before {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(17, 24, 39, 0.25);
    border-top-color: #111827;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.awaiting-banner .result-text {
    margin: 0;
    font-size: 0.9rem;
    color: #374151;
}

/* =========================================================
   DISABLED / SAFETY STATES
   ========================================================= */

button:disabled,
button[disabled] {
    pointer-events: none;
    filter: grayscale(0.2);
}

/* Prevent accidental interactions while awaiting */
.result-section--visible .primary-link-button {
    transition: opacity 0.15s ease;
}

/* =========================================================
   RECEIPT + FAILED PAGE PRINT SUPPORT
   ========================================================= */

@media print {
    body {
        background: #ffffff !important;
    }

    /* Hide interactive UI */
    button,
    .btn,
    .btn-outline,
    .btn-secondary,
    .btn-danger-outline,
    a[href^="javascript"],
    .receipt-actions {
        display: none !important;
    }

    /* Remove shadows & rounding for clean PDF */
    .receipt-card,
    .status-card {
        box-shadow: none !important;
        border-radius: 0 !important;
        max-width: 100% !important;
    }

    .page,
    .status-wrap {
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* =========================================================
   FAILED PAGE VISUAL CONSISTENCY (SAFE)
   ========================================================= */

.status-badge {
    font-weight: 700;
}

.btn-primary {
    background: #facc15;
    color: #111827;
}

.btn-primary:hover {
    filter: brightness(0.95);
}

.btn-secondary {
    background: rgba(17, 24, 39, 0.85);
    color: #f9fafb;
}

.btn-secondary:hover {
    background: rgba(17, 24, 39, 1);
}
