/* Ruseler Pay styles. Modern refresh on top of Ruseler's brand palette.
   Source palette mirrors ruselercarrentals.com Elementor kit-4965. */

:root {
    /* Color (Ruseler kit, unchanged) */
    --color-bg: #F5F1EB;
    --color-bg-2: #efe9df;          /* subtle deeper cream for layered surfaces */
    --color-surface: #FFFFFF;
    --color-text: #1C1C1B;
    --color-text-strong: #0F0F0E;   /* slightly deeper ink for confident headings */
    --color-text-muted: #807d7a;    /* darker than Ruseler's #A5A19E for AA contrast on cream */
    --color-text-soft: #A5A19E;     /* Ruseler's actual muted, kept for hairlines + labels */
    --color-border: #DCD8D3;
    --color-divider: #ece6da;
    --color-accent-gold: #B99755;
    --color-accent-gold-deep: #9a7d44;
    --color-accent-peach: #FFBC7D;
    --color-error: #C40A1D;
    --color-error-bg: #fbe7ea;
    --color-success: #6b8a3a;
    --color-success-bg: #f0f3e6;
    --color-on-strong: #FFFFFF;
    --color-on-gold: #1C1C1B;

    /* Typography */
    --font-display: "Crimson Text", Georgia, "Times New Roman", serif;
    --font-sans: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-slab: "Roboto Slab", Georgia, serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;
    --font-size-display: 3rem;

    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.05;
    --line-height-heading: 1.15;
    --line-height-base: 1.5;

    --letter-spacing-tight: -0.02em;
    --letter-spacing-wide: 0.08em;
    --letter-spacing-wider: 0.14em;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Layout */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(28, 28, 27, 0.04);
    --shadow-sm: 0 4px 12px rgba(28, 28, 27, 0.06), 0 1px 2px rgba(28, 28, 27, 0.04);
    --shadow-md: 0 10px 30px rgba(28, 28, 27, 0.08), 0 2px 6px rgba(28, 28, 27, 0.04);
    --shadow-lg: 0 24px 48px rgba(28, 28, 27, 0.12), 0 4px 8px rgba(28, 28, 27, 0.06);
    --shadow-focus: 0 0 0 4px rgba(185, 151, 85, 0.25);

    --container-form: 32rem;
    --container-wide: 72rem;

    --transition-fast: 120ms cubic-bezier(0.2, 0, 0, 1);
    --transition-base: 180ms cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    /* Darker, near-uniform ink overlay on top of the brand car photo.
       Very mild bottom-weighted gradient for a touch of depth, but the
       overall tone is single-value rather than a strong wash. */
    background-color: var(--color-text-strong);
    background-image:
        linear-gradient(
            180deg,
            rgba(15, 15, 14, 0.62) 0%,
            rgba(15, 15, 14, 0.66) 100%
        ),
        url("bg.jpg");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Drop background-attachment: fixed on mobile (iOS perf bug + janky scroll). */
@media (max-width: 1024px) {
    body { background-attachment: scroll; }
}

/* Reduced motion / data-saver: skip the photo entirely. */
@media (prefers-reduced-data: reduce) {
    body { background-image: none; background-color: var(--color-bg); }
}

/* Subtle gold accent strip at the very top of the page */
body::before {
    content: "";
    display: block;
    height: 3px;
    background: linear-gradient(90deg,
        var(--color-accent-gold) 0%,
        var(--color-accent-peach) 50%,
        var(--color-accent-gold) 100%);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-heading);
    color: var(--color-text-strong);
    letter-spacing: var(--letter-spacing-tight);
}

a {
    color: var(--color-text-strong);
    text-decoration: none;
    text-underline-offset: 3px;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--color-accent-gold-deep);
    text-decoration: underline;
}

code { font-family: var(--font-mono); }

::selection {
    background: var(--color-accent-gold);
    color: var(--color-on-gold);
}

/* Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-10);
    background: var(--color-surface);
    box-shadow: var(--shadow-xs);
    position: relative;
    z-index: 1;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}
.brand:hover { text-decoration: none; }

.brand-logo {
    height: 2.75rem;
    width: auto;
    display: block;
}

.env-badge {
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-pill);
    letter-spacing: var(--letter-spacing-wider);
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.env-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.env-badge-sandbox {
    background: var(--color-error-bg);
    color: var(--color-error);
}

/* Header aside: groups env badge + language switcher on the right */
.header-aside {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px;
    background: var(--color-bg-2);
    border-radius: var(--radius-pill);
}

.lang-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    padding: var(--space-1) var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius-pill);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.lang-link:hover {
    color: var(--color-text-strong);
    text-decoration: none;
    background: transparent;
}

.lang-link.is-active {
    background: var(--color-text-strong);
    color: var(--color-on-strong);
}

.lang-link.is-active:hover {
    color: var(--color-on-strong);
}

.logout-link {
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.logout-link:hover {
    color: var(--color-error);
    text-decoration: none;
}

/* Login card sits a touch narrower and centered */
.card-login {
    max-width: 24rem;
}

/* Main + cards */
.page-main {
    flex: 1;
    padding: var(--space-10) var(--space-4);
    display: flex;
    justify-content: center;
    align-items: center; /* vertically center the card in the viewport */
}

.card {
    width: 100%;
    max-width: var(--container-form);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-10) var(--space-8);
    border: 1px solid rgba(220, 216, 211, 0.4);
}

.card-wide { max-width: var(--container-wide); }

.page-title {
    margin: 0 0 var(--space-3) 0;
    font-family: var(--font-display);
    font-size: var(--font-size-display);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-strong);
    letter-spacing: var(--letter-spacing-tight);
}

.page-subtitle {
    margin: 0 0 var(--space-10) 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    max-width: 32ch;
}

/* Form */
.form {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label {
    color: var(--color-text-strong);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wider);
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-regular);
    color: var(--color-text);
    background: var(--color-bg-2);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input::placeholder {
    color: var(--color-text-soft);
    font-weight: var(--font-weight-regular);
}

.form-input:hover { background: var(--color-divider); }

.form-input:focus {
    outline: none;
    background: var(--color-surface);
    border-color: var(--color-accent-gold);
    box-shadow: var(--shadow-focus);
}

/* Currency select + amount input as a combined control */
.amount-group {
    display: flex;
    width: 100%;
    background: var(--color-bg-2);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.amount-group:hover { background: var(--color-divider); }

.amount-group:focus-within {
    background: var(--color-surface);
    border-color: var(--color-accent-gold);
    box-shadow: var(--shadow-focus);
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    min-width: 5rem;
    padding: var(--space-4) var(--space-8) var(--space-4) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    color: var(--color-text-strong);
    background: transparent;
    border: none;
    border-right: 1px solid var(--color-border);
    border-radius: 0;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%231C1C1B' d='M6 8 0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    background-size: 10px;
}

.form-select:focus { outline: none; }

/* Fixed currency prefix (USD) on the amount field */
.amount-prefix {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    color: var(--color-text-strong);
    border-right: 1px solid var(--color-border);
    user-select: none;
}

.amount-group .form-input {
    flex: 1 1 auto;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.amount-group .form-input:focus {
    outline: none;
    box-shadow: none;
    background: transparent;
}

.form-hint {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-align: center;
    text-decoration: none;
    padding: var(--space-4) var(--space-8);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: background-color var(--transition-base),
                color var(--transition-base),
                border-color var(--transition-base),
                box-shadow var(--transition-base),
                transform var(--transition-fast);
}

.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-primary {
    color: var(--color-on-strong);
    background: var(--color-text-strong);
    border-color: var(--color-text-strong);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: #000;
    border-color: #000;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: var(--shadow-md), var(--shadow-focus);
}

.btn-secondary {
    color: var(--color-text-strong);
    background: var(--color-surface);
    border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--color-text-strong);
    background: var(--color-bg-2);
}

.btn-block {
    display: flex;
    width: 100%;
    margin-top: var(--space-6);
}

/* Result page */
.qr-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-8);
}

.qr-image {
    width: 100%;
    max-width: 16rem;
    height: auto;
    background: var(--color-surface);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* "Pay with Sentoo" badge under the QR */
.sentoo-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-8) 0;
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-2);
    border-radius: var(--radius-pill);
}

.sentoo-badge-text {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.sentoo-badge-logo {
    height: 1.25rem;
    width: auto;
    display: block;
}

.url-wrap {
    position: relative;
    margin-bottom: var(--space-8);
}

.url-block {
    display: block;
    padding: var(--space-4) var(--space-5);
    padding-right: 8rem;
    background: var(--color-bg-2);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    word-break: break-all;
    line-height: 1.5;
}

.url-wrap .copy-button {
    position: absolute;
    top: 50%;
    right: var(--space-2);
    transform: translateY(-50%);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-xs);
}

.meta {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) 2fr;
    gap: var(--space-4) var(--space-6);
    margin: 0 0 var(--space-8) 0;
    font-size: var(--font-size-sm);
    padding: var(--space-6) 0;
    border-top: 1px solid var(--color-divider);
    border-bottom: 1px solid var(--color-divider);
}

.meta dt {
    color: var(--color-text-muted);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
    letter-spacing: var(--letter-spacing-wider);
    text-transform: uppercase;
}

.meta dd {
    margin: 0;
    color: var(--color-text-strong);
    font-weight: var(--font-weight-regular);
}

.txn-id {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    word-break: break-all;
    color: var(--color-text-muted);
}

/* Alerts */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}

.alert::before {
    content: "";
    flex-shrink: 0;
    width: 4px;
    align-self: stretch;
    border-radius: var(--radius-pill);
    background: currentColor;
}

.alert-error {
    background: var(--color-error-bg);
    color: var(--color-error);
}

/* Debug details */
.debug {
    margin: var(--space-6) 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.debug summary {
    cursor: pointer;
    user-select: none;
    font-weight: var(--font-weight-medium);
    padding: var(--space-2) 0;
}

.debug .meta {
    margin-top: var(--space-3);
    padding-bottom: 0;
    border-bottom: none;
}

/* Recent table */
.table-wrap {
    overflow-x: auto;
    margin-bottom: var(--space-8);
    margin-left: calc(var(--space-8) * -1);
    margin-right: calc(var(--space-8) * -1);
    padding: 0 var(--space-8);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table thead th {
    text-align: left;
    color: var(--color-text-muted);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
    letter-spacing: var(--letter-spacing-wider);
    text-transform: uppercase;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.table tbody td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-divider);
    color: var(--color-text);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr {
    transition: background-color var(--transition-fast);
}

.table tbody tr:hover { background: var(--color-bg-2); }

.status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-pill);
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
}

.status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-ok,
.status-paid {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.status-error {
    background: var(--color-error-bg);
    color: var(--color-error);
}

/* Amber reads as "needs attention, not a failure", which fits both a payment
   in flight and one the customer started but abandoned. */
.status-pending,
.status-attempted {
    background: #fdf4e3;
    color: var(--color-accent-gold-deep);
}

.status-open,
.status-expired {
    background: var(--color-bg-2);
    color: var(--color-text-muted);
}

.row-link {
    color: var(--color-accent-gold-deep);
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    transition: color var(--transition-fast);
}

.row-link:hover { color: var(--color-text-strong); }

.empty {
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
    text-align: center;
    margin: var(--space-12) 0;
}

/* Return-page payment states */
.pay-state {
    text-align: center;
}

.pay-state .page-subtitle {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
}

.pay-state .btn-block {
    margin-top: var(--space-6);
}

.pay-state-contact {
    margin-top: var(--space-8);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-divider);
    text-align: center;
    font-size: var(--font-size-sm);
}

/* A slim status accent bar at the top of the card per state. */
.pay-state-success .page-title { color: var(--color-success); }
.pay-state-retry .page-title { color: var(--color-error); }
.pay-state-pending .page-title { color: var(--color-accent-gold-deep); }
.pay-state-expired .page-title { color: var(--color-text-muted); }

.muted { color: var(--color-text-muted); }

/* Footer (sits on top of the background image, so add a subtle backdrop
   so muted text stays readable wherever the photo gets dark). */
.page-footer {
    padding: var(--space-6) var(--space-10);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(220, 216, 211, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    letter-spacing: var(--letter-spacing-wide);
}

.footer-credits {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-link {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
    flex-shrink: 0;
    margin-left: var(--space-4);
}

.footer-link:hover {
    color: var(--color-text-strong);
}

.footer-credit-link {
    color: var(--color-text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--transition-fast);
}

.footer-credit-link:hover {
    color: var(--color-accent-gold-deep);
}

/* Mobile niceties */
@media (max-width: 640px) {
    .page-header { padding: var(--space-4) var(--space-5); }
    .page-footer { padding: var(--space-5); }
    .page-main { padding: var(--space-6) var(--space-3); }
    .card {
        padding: var(--space-6) var(--space-5);
        border-radius: var(--radius-md);
    }
    .page-title { font-size: var(--font-size-2xl); }
    .page-subtitle { font-size: var(--font-size-sm); margin-bottom: var(--space-6); }
    .meta {
        grid-template-columns: 1fr;
        gap: var(--space-1) 0;
    }
    .meta dt { margin-top: var(--space-3); }
    .meta dt:first-of-type { margin-top: 0; }
    .brand-logo { height: 2.25rem; }
    .url-block { padding-right: var(--space-5); }
    .url-wrap .copy-button {
        position: static;
        transform: none;
        margin-top: var(--space-2);
        width: 100%;
    }
    .table-wrap { margin-left: calc(var(--space-5) * -1); margin-right: calc(var(--space-5) * -1); padding: 0 var(--space-5); }
}
