@font-face {
    font-family: "Almarai";
    src: url("../fonts/almarai/Almarai-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: "Almarai";
    src: url("../fonts/almarai/Almarai-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: "Almarai";
    src: url("../fonts/almarai/Almarai-ExtraBold.ttf") format("truetype");
    font-weight: 800;
    font-style: normal;
}

:root,
[data-theme="dark"] {
    color-scheme: dark;
    --navy: #0d2a4c;
    --navy-light: #152a45;
    --navy-muted: #1e3a5f;
    --orange: #f45612;
    --orange-hover: #e04d10;
    --white: #ffffff;
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.55);
    --text-label: rgba(255, 255, 255, 0.85);
    --border: rgba(255, 255, 255, 0.12);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --input-bg: var(--navy);
    --logo-bg: var(--white);
    --pattern-a: rgba(30, 58, 95, 0.35);
    --pattern-b: rgba(30, 58, 95, 0.2);
    --glow: rgba(21, 42, 69, 0.9);
    --error: #ff6b6b;
    --success: #4ade80;
    --btn-secondary-bg: var(--navy-muted);
    --btn-secondary-text: var(--white);
    --btn-secondary-border: rgba(255, 255, 255, 0.2);
    --btn-secondary-hover-bg: var(--navy-light);
}

[data-theme="light"] {
    color-scheme: light;
    --navy: #eef2f7;
    --navy-light: #ffffff;
    --navy-muted: #e2e8f0;
    --orange: #f25822;
    --orange-hover: #de4f1e;
    --white: #ffffff;
    --text: #06294c;
    --text-muted: rgba(6, 41, 76, 0.55);
    --text-label: rgba(6, 41, 76, 0.88);
    --border: rgba(6, 41, 76, 0.12);
    --border-subtle: rgba(6, 41, 76, 0.06);
    --input-bg: #f8fafc;
    --logo-bg: #f8fafc;
    --pattern-a: rgba(6, 41, 76, 0.06);
    --pattern-b: rgba(6, 41, 76, 0.04);
    --glow: rgba(242, 88, 34, 0.08);
    --error: #dc2626;
    --success: #16a34a;
    --btn-secondary-bg: #ffffff;
    --btn-secondary-text: var(--orange);
    --btn-secondary-border: var(--orange);
    --btn-secondary-hover-bg: rgba(242, 88, 34, 0.08);
}

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

body {
    font-family: "Almarai", sans-serif;
    background: var(--navy);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.25s ease, color 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(135deg, transparent 49.5%, var(--pattern-a) 50%, transparent 50.5%),
        linear-gradient(45deg, transparent 49.5%, var(--pattern-b) 50%, transparent 50.5%);
    background-size: 80px 80px;
    opacity: 0.4;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    background: radial-gradient(ellipse 80% 60% at 50% 100%, var(--glow) 0%, transparent 70%);
    pointer-events: none;
}

.page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    animation: fadeUp 0.6s ease-out both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--orange);
}

.theme-toggle {
    position: fixed;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--navy-light);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme-toggle:hover {
    color: var(--orange);
    border-color: var(--orange);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.theme-toggle__icon {
    font-size: 1rem;
    line-height: 1;
}

[data-theme="dark"] .theme-toggle__label-light,
[data-theme="dark"] .theme-toggle__icon-light,
[data-theme="light"] .theme-toggle__label-dark,
[data-theme="light"] .theme-toggle__icon-dark {
    display: none;
}

.brand {
    text-align: center;
    margin-bottom: 2rem;
}

.brand--compact {
    margin-bottom: 1.5rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    text-align: right;
}

.brand-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border-right: 3px solid var(--orange);
    padding-right: 1rem;
}

.brand--compact .brand-logo {
    width: 52px;
    height: 52px;
}

.brand--compact .brand-ar {
    font-size: 1.75rem;
}

.brand--compact .brand-text {
    padding-right: 0.75rem;
}

.brand-ar {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.brand-en {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.heading {
    text-align: center;
    margin-bottom: 1.75rem;
}

.heading h1 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.heading p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--navy-light);
    padding: 1.35rem;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.messages {
    list-style: none;
    margin-bottom: 1rem;
}

.messages li {
    font-size: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.messages .error,
.messages .danger {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.35);
    color: #ffb4b4;
}

.messages .success {
    background: rgba(74, 222, 128, 0.1);
    border-color: rgba(74, 222, 128, 0.3);
    color: var(--success);
}

.messages .info,
.messages .warning {
    background: rgba(245, 130, 32, 0.1);
    border-color: rgba(245, 130, 32, 0.35);
    color: #ffc48a;
}

.payment-form .field {
    margin-bottom: 1.1rem;
}

.payment-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
    color: var(--text-label);
}

.payment-form input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.payment-form input::placeholder {
    color: var(--text-muted);
}

.payment-form input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.15);
}

.btn-submit {
    width: 100%;
    padding: 0.9rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
    background: var(--orange);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    margin-top: 0.25rem;
}

.btn-submit:hover {
    background: var(--orange-hover);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:focus-visible {
    outline: 2px solid var(--white);
    outline-offset: 2px;
}

.btn-submit-secondary {
    width: 100%;
    padding: 0.9rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--btn-secondary-text);
    background: var(--btn-secondary-bg);
    border: 1px solid var(--btn-secondary-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
    margin-top: 0.5rem;
}

.btn-submit-secondary:hover {
    background: var(--btn-secondary-hover-bg);
    transform: translateY(-1px);
}

[data-theme="light"] .btn-submit-secondary:hover {
    border-color: var(--orange-hover);
    color: var(--orange-hover);
}

.btn-submit-secondary:active {
    transform: translateY(0);
}

.btn-submit-secondary:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.qr-wrap {
    text-align: center;
}

.qr-frame {
    display: inline-block;
    background: var(--white);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.qr-frame img {
    display: block;
    max-width: 260px;
    width: 100%;
    height: auto;
}

.amount {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--orange);
    margin-bottom: 0.35rem;
}

.reference {
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
}

.token-box {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--input-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    margin-bottom: 1.25rem;
    word-break: break-all;
    text-align: center;
    direction: ltr;
}

.footer {
    text-align: center;
    margin-top: 2.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer span {
    display: inline-block;
    width: 40px;
    height: 2px;
    background: var(--orange);
    margin-bottom: 0.75rem;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.footer-logo {
    object-fit: contain;
    opacity: 0.85;
}
