/* =====================================================================
   Grand Hypermarket - Registration Portal
   Brand tokens: change here to re-skin the whole portal.
   Each event can override --gr-theme with its own colour.
   ===================================================================== */
:root {
    --gr-red: #C8102E;
    --gr-red-dark: #9E0B23;
    --gr-ink: #1d1d1f;
    --gr-muted: #6b7280;
    --gr-bg: #f4f5f7;
    --gr-card-radius: 14px;
    --gr-theme: var(--gr-red);
}

html, body { height: 100%; }
body {
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--gr-bg);
    color: var(--gr-ink);
    display: flex; flex-direction: column;
}
form#form1 { display: flex; flex-direction: column; min-height: 100vh; }
.gr-main { flex: 1 0 auto; }

/* ---------- navbar / footer ----------
   White header so the full-colour Grand logo (red + sun yellow) shows correctly,
   with a red brand line underneath. */
.gr-navbar { background: #fff; border-bottom: 4px solid var(--gr-red); box-shadow: 0 2px 10px rgba(0,0,0,.06); padding-top: .35rem; padding-bottom: .35rem; }
.gr-navbar .navbar-brand { padding: 0; }
.gr-navbar .navbar-brand img { height: 50px; width: auto; }
.gr-navbar .gr-brand-sub { color: #4b5563; font-size: .9rem; font-weight: 500; border-left: 1px solid #e5e7eb; padding-left: .75rem; }
.gr-navbar .nav-link, .gr-navbar .navbar-text { color: #374151 !important; font-weight: 500; }
.gr-navbar .nav-link:hover { color: var(--gr-red) !important; }
.gr-navbar .btn-outline-light { color: var(--gr-red); border-color: var(--gr-red); }
.gr-navbar .btn-outline-light:hover { background: var(--gr-red); color: #fff; }
.gr-footer { background: #fff; border-top: 1px solid #e5e7eb; color: var(--gr-muted); font-size: .8rem; padding: 1rem 0; }

/* ---------- buttons / utilities ---------- */
.btn-grand { --bs-btn-color:#fff; --bs-btn-bg: var(--gr-theme); --bs-btn-border-color: var(--gr-theme);
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg: var(--gr-theme); --bs-btn-hover-border-color: var(--gr-theme);
    --bs-btn-active-bg: var(--gr-theme); --bs-btn-active-color:#fff; font-weight: 500; }
.btn-grand:hover { filter: brightness(.92); }
.bg-grand { background: var(--gr-red) !important; }
.gr-card { border: 0; border-radius: var(--gr-card-radius); box-shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04); }
.no-print { }

/* ---------- home hero & event cards ---------- */
.gr-hero { background: linear-gradient(135deg, var(--gr-red) 0%, var(--gr-red-dark) 100%); color: #fff; padding: 2.5rem 0; }
.gr-event-card { border: 0; border-radius: var(--gr-card-radius); overflow: hidden; box-shadow: 0 2px 8px rgba(16,24,40,.07); transition: transform .15s, box-shadow .15s; }
.gr-event-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16,24,40,.12); }
.gr-event-card .btn-grand { --gr-theme: inherit; }
.gr-event-card-banner { position: relative; aspect-ratio: 16/6; background: var(--gr-theme); }
.gr-event-card-banner img { width: 100%; height: 100%; object-fit: cover; }
.gr-event-card-banner .gr-state { position: absolute; top: .75rem; right: .75rem; }
.gr-banner-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.85); font-size: 2.5rem;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.18), transparent 40%), linear-gradient(135deg, var(--gr-theme), #1d1d1f 160%); }
.gr-meta li { display: flex; gap: .55rem; align-items: baseline; margin-bottom: .3rem; color: #374151; }
.gr-meta li i { width: 1rem; color: var(--gr-theme); }

/* ---------- registration form (Google-Forms style) ---------- */
.gr-form-container { max-width: 780px; }
.gr-banner { border-radius: var(--gr-card-radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.gr-banner img { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.gr-banner-lg { height: 180px; font-size: 2rem; text-align: center; }
.gr-banner-title { font-size: 1.1rem; font-weight: 600; color: #fff; padding: 0 1rem; }
.gr-title-card { border-top: 10px solid var(--gr-theme); }
.gr-type-badge { background: color-mix(in srgb, var(--gr-theme) 12%, white); color: var(--gr-theme); font-weight: 600; letter-spacing: .03em; }
.gr-description { color: #374151; line-height: 1.65; }
.gr-form-page .form-label { font-weight: 500; font-size: .92rem; margin-bottom: .3rem; }
.gr-form-page .form-control, .gr-form-page .form-select { padding: .65rem .85rem; border-radius: 10px; }
.gr-form-page .form-control:focus, .gr-form-page .form-select:focus, .gr-form-page .form-check-input:focus {
    border-color: var(--gr-theme); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--gr-theme) 20%, transparent); }
.gr-form-page .form-check-input:checked { background-color: var(--gr-theme); border-color: var(--gr-theme); }
.gr-field.gr-hidden-by-rule { display: none; }
.gr-has-error .invalid-feedback { display: block; }
.gr-has-error .form-check-label { color: var(--bs-form-invalid-color); }
.gr-preview { display: block; margin-top: .6rem; max-height: 140px; max-width: 100%; border-radius: 10px; border: 1px solid #e5e7eb; }
.gr-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.gr-btn-busy { display: inline-flex; align-items: center; }

/* ---------- optional photo gallery ---------- */
.gr-gallery-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; cursor: pointer;
    border: 2px dashed #d1d5db; border-radius: 12px; padding: 1.1rem; text-align: center; color: #4b5563; background: #fafafa; transition: all .15s; margin: 0; }
.gr-gallery-drop i { font-size: 1.7rem; color: var(--gr-theme); }
.gr-gallery-drop:hover, .gr-gallery-drop.gr-drag { border-color: var(--gr-theme); background: color-mix(in srgb, var(--gr-theme) 6%, white); }
.gr-gallery-drop-title { font-weight: 600; color: var(--gr-ink); }
.gr-gallery-drop-sub { font-size: .8rem; }
.gr-gallery-full .gr-gallery-drop { opacity: .55; pointer-events: none; }
.gr-gallery.is-invalid .gr-gallery-drop { border-color: var(--bs-form-invalid-border-color); }
.gr-gallery-input:focus-visible + .gr-gallery-grid, .gr-gallery-drop:focus-within { outline: 2px solid var(--gr-theme); }
.gr-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .6rem; margin-top: .6rem; }
.gr-gallery-grid:empty { display: none; }
.gr-gallery-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid #e5e7eb; background: #f3f4f6; }
.gr-gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gr-gallery-remove { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff;
    font-size: 1.1rem; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0; }
.gr-gallery-remove:hover { background: #dc2626; }
.gr-thumb-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.gr-mini-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #1d1d1f; color: #fff; padding: .6rem 1rem;
    border-radius: 10px; font-size: .88rem; opacity: 0; transition: all .25s; z-index: 2000; max-width: 90vw; }
.gr-mini-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- success / verify ---------- */
.gr-success-icon, .gr-verify-icon { width: 72px; height: 72px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 2rem; }
.gr-success-icon { background: #16a34a; box-shadow: 0 0 0 10px rgba(22,163,74,.12); animation: gr-pop .4s ease-out; }
@keyframes gr-pop { 0% { transform: scale(.4); opacity: 0; } 80% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ---------- digital badge (compact portrait card, prints on A6) ---------- */
.gr-badge {
    position: relative; width: 310px; background: #fff; border-radius: 18px; overflow: hidden;
    box-shadow: 0 18px 40px rgba(16,24,40,.18); display: flex; flex-direction: column; font-family: "Poppins", Arial, sans-serif;
}
.gr-badge-hole { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 50px; height: 8px; border-radius: 6px; background: rgba(255,255,255,.55); z-index: 2; }
.gr-badge-head { background: var(--gr-theme); color: #fff; padding: 22px 16px 26px; display: flex; align-items: center; gap: 12px; text-align: left;
    background-image: radial-gradient(circle at 90% 0%, rgba(255,255,255,.22), transparent 45%), radial-gradient(circle at 0% 100%, rgba(0,0,0,.18), transparent 50%); }
.gr-badge-logo { flex: 0 0 auto; display: inline-block; background: #fff; border-radius: 10px; padding: 4px 8px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.gr-badge-logo img { height: 34px; width: auto; display: block; }
.gr-badge-event { font-weight: 600; font-size: .92rem; line-height: 1.25; }
.gr-badge-role { align-self: center; margin-top: -13px; background: #1d1d1f; color: #fff; font-weight: 700; letter-spacing: .18em; font-size: .7rem; padding: .3rem 1rem; border-radius: 999px; z-index: 1; }
.gr-badge-body { text-align: center; padding: 10px 18px 2px; }
.gr-badge-photo { width: 104px; height: 104px; margin: 0 auto 8px; border-radius: 50%; padding: 4px; background: var(--gr-theme); }
.gr-badge-photo img, .gr-badge-initials { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid #fff; background: #f3f4f6; }
.gr-badge-initials { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 600; color: var(--gr-theme); }
.gr-badge-name { font-size: 1.3rem; font-weight: 700; line-height: 1.2; word-break: break-word; }
.gr-badge-category { display: inline-block; margin-top: 5px; color: var(--gr-theme); font-weight: 600; font-size: .85rem; border: 1.5px solid var(--gr-theme); border-radius: 999px; padding: .05rem .75rem; }
.gr-badge-info { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin: 10px 0 0; text-align: left; }
.gr-badge-info > div { background: #f9fafb; border-radius: 8px; padding: 4px 8px; min-width: 0; }
.gr-badge-info > div.wide { grid-column: 1 / -1; }
.gr-badge-info span { display: block; font-size: .58rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gr-muted); line-height: 1.3; }
.gr-badge-info strong { display: block; font-size: .8rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.gr-badge-details { margin: 8px 0 0; font-size: .74rem; text-align: left; }
.gr-badge-details > div { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; border-bottom: 1px dashed #e5e7eb; }
.gr-badge-details > div:last-child { border-bottom: 0; }
.gr-badge-details dt { flex: 0 0 52px; font-weight: 500; color: var(--gr-muted); margin: 0; font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; }
.gr-badge-details dd { flex: 1; margin: 0; font-weight: 600; line-height: 1.3; }
.gr-badge-codes { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 8px 12px 0; background: #f9fafb; border-radius: 12px; }
.gr-badge-qr { width: 78px; height: 78px; flex: 0 0 78px; }
.gr-badge-qr img, .gr-badge-qr canvas { width: 78px !important; height: 78px !important; }
.gr-badge-id { flex: 1; min-width: 0; text-align: center; }
.gr-badge-id-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gr-muted); }
.gr-badge-id-value { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; font-size: .98rem; }
#grBarcode { width: 100%; height: 38px; }
.gr-badge-foot { font-size: .66rem; color: var(--gr-muted); text-align: center; padding: 8px 16px 12px; line-height: 1.35; }
.gr-badge-cancelled { filter: grayscale(1); }
.gr-badge-stamp { position: absolute; top: 46%; left: 50%; transform: translate(-50%,-50%) rotate(-18deg); border: 4px solid #dc2626; color: #dc2626;
    font-weight: 800; font-size: 2rem; padding: .2rem 1rem; letter-spacing: .1em; background: rgba(255,255,255,.85); }

/* ---------- admin ---------- */
.gr-admin .gr-main { padding-bottom: 2rem; }
.gr-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gr-muted); background: #fafafa; font-weight: 600; }
.gr-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.gr-hidden-row td { background: #f9fafb; }
.gr-hidden-row .form-control, .gr-hidden-row .form-select { color: #6b7280; }
.gr-adv-row td { background: #fbfbfc; }
.gr-fields-table .form-control-sm, .gr-fields-table .form-select-sm { min-width: 70px; }
.gr-thumb { height: 64px; border-radius: 8px; border: 1px solid #e5e7eb; object-fit: cover; }
.gr-avatar-lg { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: #f3f4f6; font-size: 3rem; color: #9ca3af; }
.gr-stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gr-muted); }
.gr-stat-value { font-size: 1.8rem; font-weight: 700; }
.gr-admin-banner img { max-height: 120px; width: 100%; object-fit: cover; }

/* ---------- print: only the badge ---------- */
@media print {
    @page { size: A6 portrait; margin: 6mm; }
    body { background: #fff !important; }
    .no-print, .gr-navbar, .gr-footer { display: none !important; }
    .gr-main .container { padding: 0 !important; }
    .gr-badge { box-shadow: none; border: 1px solid #ddd; margin: 0 auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- loading screen (every submit) ---------- */
.gr-loader { position: fixed; inset: 0; z-index: 5000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
    background: rgba(255,255,255,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.gr-loader.show { opacity: 1; visibility: visible; }
.gr-loader-box { position: relative; width: 168px; height: 168px; }
.gr-loader-ring { position: absolute; inset: 0; border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(200,16,46,0) 0deg, #C8102E 140deg, #F5B301 260deg, rgba(245,179,1,0) 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
    animation: gr-spin 1.1s linear infinite; }
.gr-loader-ring2 { inset: 14px; opacity: .45; animation-duration: 1.8s; animation-direction: reverse;
    background: conic-gradient(from 90deg, rgba(245,179,1,0), #F5B301 200deg, rgba(245,179,1,0)); }
.gr-loader-plate { position: absolute; inset: 24px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 30px rgba(200,16,46,.18), inset 0 0 0 1px rgba(0,0,0,.04); animation: gr-breathe 1.6s ease-in-out infinite; }
.gr-loader-plate img { width: 78%; height: auto; }
.gr-loader-text { font-weight: 600; color: #374151; letter-spacing: .02em; }
.gr-loader-text::after { content: ""; display: inline-block; width: 1.2em; text-align: left; }
@keyframes gr-spin { to { transform: rotate(360deg); } }
@keyframes gr-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .gr-loader-ring, .gr-loader-plate { animation: none; } }

.gr-user-avatar { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; background: var(--gr-red); color: #fff; font-size: .75rem; font-weight: 700; align-items: center; justify-content: center; margin-right: 8px; vertical-align: middle; }
