:root {
    --bg-dark: #0a0e17;
    --bg-gradient-1: #111827;
    --bg-gradient-2: #0f172a;
    --card-bg: rgba(17, 24, 45, 0.85);
    --card-border: rgba(56, 92, 168, 0.2);
    --card-border-hover: rgba(56, 92, 168, 0.4);
    --accent-primary: #38bdf8;
    --accent-secondary: #f472b6;
    --accent-tertiary: #a78bfa;
    --text-primary: #cbd1d7;
    --text-secondary: #aebdd1;
    --text-muted: #9faabb;
    --success: #34d399;
    --error: #fb7185;
    --warning: #fbbf24;
    /* --input-bg: rgba(15, 23, 42, 0.6); */
    --input-bg: rgb(35 45 67 / 60%);
    --input-border: rgba(71, 85, 105, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-glow: 0 0 60px rgba(56, 189, 248, 0.06);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-dark);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(56, 189, 248, 0.10), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(164, 123, 250, 0.08), transparent),
        linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-gradient-1) 40%, var(--bg-gradient-2) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Card ──────────────────────────────────────── */
.card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.4),
        var(--shadow-glow);
    padding: 32px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ────────────────────────────────────── */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    flex: 1;
    line-height: 1.25;
}

.logo {
    width: 60px;
    height: auto;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.25));
    transition: transform 0.25s ease;
}

.logo:hover {
    transform: scale(1.08);
}

/* ── Typography ────────────────────────────────── */
.subtitle {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--warning);
    line-height: 1.6;
}

.subtitle strong, .subtitle b {
    color: var(--accent-primary);
    font-weight: 600;
}

.subtitle-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.subtitle-link:hover {
    color: var(--accent-secondary);
}

/* ── Messages ──────────────────────────────────── */
.message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 3px solid;
    animation: fadeSlide 0.25s ease;
}

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message.success {
    background: rgba(52, 211, 153, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.message.error {
    background: rgba(251, 113, 133, 0.1);
    color: var(--error);
    border-color: var(--error);
}

.message.warning,
.message.info {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning);
    border-color: var(--warning);
}

.message.show {
    display: block;
}

/* ── Spinner ───────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ── Form ──────────────────────────────────────── */
form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

label {
    display: block;
    font-weight: 600;
    margin: 12px 0 1px;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

input,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: 15px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

option {
    background: rgba(85, 87, 87, 0.06);
    border: 1px solid rgba(85, 87, 87, 0.15);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 8px;
    color: #000;
}

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

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

input:hover:not(:focus),
select:hover:not(:focus) {
    border-color: rgba(56, 189, 248, 0.35);
}

/* ── Email Warning / Pay Now ───────────────────── */
.email-warning {
    color: var(--error);
    font-size: 13px;
    margin-top: 6px;
    display: none;
    line-height: 1.5;
}

.email-warning.show {
    display: block;
    animation: fadeSlide 0.25s ease;
}

.pay-now-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: var(--bg-dark);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.pay-now-btn:hover {
    opacity: 0.85;
}

/* ── Amount Display ────────────────────────────── */
.amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    margin-top: 12px;
    background: rgba(56, 189, 248, 0.06);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: var(--radius-md);
    font-size: 15px;
}

.amount div {
    color: var(--text-secondary);
    font-weight: 500;
}

.amount span,
#amountDisplay {
    font-weight: 800;
    color: var(--accent-primary);
    font-size: 18px;
    letter-spacing: -0.3px;
}

/* ── Buttons ───────────────────────────────────── */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}

button.btn,
form .btn {
    width: 100%;
    margin-top: 16px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-tertiary) 100%);
    color: var(--bg-dark);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.25);
}

button.btn:hover,
form .btn:hover {
    box-shadow: 0 8px 30px rgba(56, 189, 248, 0.35);
    transform: translateY(-1px);
}

button.btn:active,
form .btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(56, 189, 248, 0.2);
}

button:disabled,
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

#payBtn {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-tertiary) 100%);
    color: var(--bg-dark);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.25);
}

#payBtn:hover {
    box-shadow: 0 8px 30px rgba(56, 189, 248, 0.35);
    transform: translateY(-1px);
}

#payBtn:active {
    transform: translateY(0);
}

#payBtn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: var(--bg-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--input-border);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.05);
}

/* ── Radio / Checkbox ──────────────────────────── */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--accent-primary);
    -webkit-appearance: auto;
    appearance: auto;
}

.cme-option {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(56, 189, 248, 0.06);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: var(--radius-md);
}

.cme-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.cme-label:has(input:disabled) {
    text-decoration: line-through;
    opacity: 0.6;
}

.cme-note {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Spinner ───────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(56, 189, 248, 0.2);
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
}

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

/* ── Loading State ─────────────────────────────── */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Back Link ─────────────────────────────────── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.2s ease;
}

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

/* ── Tables (result / details) ─────────────────── */
.result-table,
.details-table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
}

.result-table tr,
.details-table tr {
    border-bottom: 1px solid rgba(71, 85, 105, 0.25);
}

.result-table tr:last-child,
.details-table tr:last-child {
    border-bottom: none;
}

.result-table th,
.details-table th {
    text-align: left;
    padding: 10px 8px 10px 0;
    font-weight: 600;
    width: 38%;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.result-table td,
.details-table td {
    padding: 10px 0;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    word-break: break-word;
}

/* ── Status Badge ──────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.status-paid {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.status-pending {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

/* ── Thank You Page ────────────────────────────── */
.success-icon {
    width: 52px;
    height: 52px;
    background: rgba(52, 211, 153, 0.12);
    border: 2px solid rgba(52, 211, 153, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.success-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--success);
}

.highlight {
    background: rgba(251, 191, 36, 0.08);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--warning);
    margin: 20px 0;
}

.highlight-label {
    font-size: 10px;
    color: var(--warning);
    font-weight: 700;
    margin-bottom: 1px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.highlight-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    word-break: break-all;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.actions .btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 12px;
    margin-top: 0;
}

.note {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(56, 189, 248, 0.06);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    border: 1px solid rgba(56, 189, 248, 0.1);
}

/* ── Mobile Responsive ─────────────────────────── */
@media (max-width: 640px) {
    body {
        padding: 10px;
        justify-content: flex-start;
        padding-top: 20px;
    }

    .card {
        padding: 24px 20px;
        border-radius: var(--radius-lg);
        max-width: 100%;
        box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.35),
            var(--shadow-glow);
    }

    .header-row {
        margin-bottom: 16px;
        gap: 10px;
    }

    h1 {
        font-size: 19px;
    }

    .logo {
        width: 54px;
    }

    .subtitle {
        font-size: 13px;
        margin-bottom: 12px;
    }

    label {
        font-size: 11px;
        margin: 10px 0 0px;
    }

    input,
    select {
        padding: 11px 12px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        border-radius: var(--radius-sm);
    }

    .amount {
        padding: 12px 14px;
        font-size: 14px;
    }

    .amount span,
    #amountDisplay {
        font-size: 16px;
    }

    button,
    .btn {
        font-size: 13px;
        padding: 12px 16px;
    }

    .message {
        font-size: 13px;
        padding: 10px 14px;
    }

    .result-table th,
    .details-table th {
        font-size: 11px;
        padding: 8px 6px 8px 0;
    }

    .result-table td,
    .details-table td {
        font-size: 13px;
        padding: 8px 0;
    }

    .actions {
        flex-direction: column;
        gap: 8px;
    }

    .actions .btn {
        width: 100%;
    }

    .highlight {
        padding: 12px;
    }

    .highlight-value {
        font-size: 12px;
    }

    .note {
        font-size: 11px;
        padding: 10px 12px;
    }

    .success-icon {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 360px) {
    .card {
        padding: 20px 16px;
    }

    h1 {
        font-size: 17px;
    }

    .header-row {
        gap: 8px;
    }

    .logo {
        width: 54px;
    }
}

/* ── Footer ────────────────────────────────────── */
.footer {
    text-align: center;
    margin-top: 32px;
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--accent-secondary);
}

/* ── Print ─────────────────────────────────────── */
@media print {
    body {
        background: white;
        color: #000;
        padding: 8px;
    }

    .card {
        background: white;
        border: 1px solid #ddd;
        box-shadow: none;
        padding: 20px;
    }

    .actions, .note, .back-link, .footer {
        display: none !important;
    }

    h1, .subtitle, th, td, .highlight-value {
        color: #000 !important;
    }

    th {
        color: #555 !important;
    }
}
