/* =======================================================================
   Public loyalty sign-up page — mirrors the Gift Card lookup layout.
   ======================================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
    display: flex;
    padding: 20px;
}

/* Environment banner: pin across the top instead of joining the centered flex */
.bg-danger.col-12 { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; }

/* margin: auto centers the wrapper both ways but, unlike align-items/justify-content
   center on the body, collapses to 0 when the content is taller than the viewport —
   otherwise the overflow is pushed above the top edge where it can't be scrolled to. */
.ca-page-wrapper { width: 100%; max-width: 480px; margin: auto; }

.ca-logo { text-align: center; margin-bottom: 24px; }
.ca-logo img { max-height: 80px; max-width: 320px; object-fit: contain; }
.ca-logo-header { display: block; font-size: 1.1rem; margin-top: 8px; font-weight: 600; color: #111827; }
.ca-logo-header:empty { display: none; }

.ca-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.ca-card-header { padding: 28px 32px 0; text-align: center; }
.ca-card-header h1 { font-size: 1.5rem; font-weight: 700; color: #1a1a2e; margin: 0; }
.ca-card-header h1:empty { display: none; }
.ca-card-header p { font-size: 0.9rem; color: #6b7280; margin-top: 6px; }
.ca-card-header p:empty { display: none; }

.ca-card-body { padding: 28px 32px 32px; }

/* ─── Form ──────────────────────────────────────────────────────────────── */
.ca-field { display: flex; flex-direction: column; margin-bottom: 14px; }

.ca-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.ca-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
    color: #1a1a2e;
    background: #fff;
}
.ca-input:focus { border-color: #334155; }
.ca-input::placeholder { color: #9ca3af; }

.ca-select { appearance: auto; }

.ca-field-error { margin-top: 5px; font-size: 0.8rem; color: #dc2626; }

.ca-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    color: #374151;
    margin: 4px 0 14px;
    cursor: pointer;
}
.ca-check input { margin-top: 3px; flex-shrink: 0; }

.ca-btn {
    width: 100%;
    padding: 13px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: #334155;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    white-space: nowrap;
    margin-top: 6px;
}
.ca-btn:hover { opacity: 0.9; }
.ca-btn:active { transform: scale(0.99); }
.ca-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ca-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ca-spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes ca-spin { to { transform: rotate(360deg); } }

.ca-error {
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.875rem;
    text-align: center;
}

/* ─── Footer + links ────────────────────────────────────────────────────── */
.ca-footer { text-align: center; margin-top: 24px; font-size: 0.85rem; color: #6b7280; }
.ca-footer:empty { display: none; }

.ca-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin-top: 10px;
}
.ca-footer-links:empty { display: none; }
.ca-footer-link { font-size: 0.8rem; color: #334155; text-decoration: underline; }
.ca-footer-sep { font-size: 0.8rem; color: #9ca3af; user-select: none; }

/* ─── Results ───────────────────────────────────────────────────────────── */
.ca-results { text-align: center; }
.ca-success-message { font-size: 1rem; color: #111827; white-space: pre-line; margin-bottom: 4px; }
.ca-detail-row { margin-top: 14px; }
.ca-detail-label { font-size: 0.8rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }
.ca-detail-value { font-size: 1.1rem; font-weight: 700; color: #1a1a2e; }
.ca-barcode { display: block; max-width: 100%; height: auto; margin: 10px auto 0; }
.ca-qr { display: flex; justify-content: center; margin: 10px 0 0; line-height: 0; }
.ca-qr img, .ca-qr canvas { display: block; padding: 8px; background: #fff; border-radius: 4px; }

/* ─── Language picker (matches the loyalty points / gift card lookup) ─────── */
.ca-lang-select { min-width: 140px; width: auto; }

.d-none { display: none !important; }

@media (max-width: 500px) {
    .ca-card-body { padding: 20px; }
}
