/* ============================================================
   Utalika Puja Subscription — app.css
   Self-contained, framework-free stylesheet (no Bootstrap).
   Implements only the layout/component/utility classes the
   templates actually use, so the app stays fast and the strict
   'self' CSP / no-CDN policy holds.
   ============================================================ */

/* ── Design tokens ──────────────────────────────────────────── */
:root {
    --primary:      #3d52d5;
    --primary-dark: #2d3ba8;
    --primary-hover:#3446bb;
    --navy:         #1a1f36;
    --navy-2:       #2d3561;
    --body-bg:      #f4f6fb;
    --body-fg:      #212529;
    --muted:        #6c757d;
    --border:       #dee2e6;
    --input-border: #ced4da;
    --card-radius:  0.6rem;
    --radius:       0.375rem;
    --font:         'Segoe UI', system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono:         ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ── Reset / base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must always win — even over component display rules
   such as .btn { display: inline-block } — so JS can reliably show/hide
   elements (e.g. platform-specific pay buttons) via el.hidden. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 0.925rem;
    line-height: 1.5;
    color: var(--body-fg);
    background: var(--body-bg);
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, h5, h6 { margin: 0 0 .5rem; font-weight: 500; line-height: 1.2; }
p { margin: 0 0 1rem; }
ul, ol, dl { margin: 0 0 1rem; }
dt { font-weight: 700; }
dd { margin-left: 0; }

/* Form controls don't inherit fonts by default — normalize them. */
button, input, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; margin: 0; }

a { color: var(--primary); text-decoration: underline; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

code {
    font-family: var(--mono);
    font-size: .875em;
    color: #d63384;
    word-wrap: break-word;
}

svg { vertical-align: middle; }

/* ── Headings-as-classes (sizing) ───────────────────────────── */
.h4 { font-size: 1.5rem; font-weight: 500; }
.h5 { font-size: 1.25rem; font-weight: 500; }

/* ── Layout containers ──────────────────────────────────────── */
.container,
.container-fluid {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-right: .75rem;
    padding-left: .75rem;
}
/* Public/admin content is intentionally narrow. */
.puja-container { max-width: 760px; }

/* ── Flex grid (12 columns) ─────────────────────────────────── */
.row {
    --gutter-x: 0px;
    --gutter-y: 0px;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--gutter-y));
    margin-right: calc(-.5 * var(--gutter-x));
    margin-left: calc(-.5 * var(--gutter-x));
}
.row > * {
    box-sizing: border-box;
    flex-shrink: 0;
    width: 100%;
    margin-top: var(--gutter-y);
    padding-right: calc(.5 * var(--gutter-x));
    padding-left: calc(.5 * var(--gutter-x));
}
.g-2 { --gutter-x: .5rem; --gutter-y: .5rem; }
.g-3 { --gutter-x: 1rem;  --gutter-y: 1rem;  }

.col            { flex: 1 0 0%; width: auto; }
.col-4          { width: 33.333333%; }
.col-5          { width: 41.666667%; }
.col-6          { width: 50%; }
.col-7          { width: 58.333333%; }
.col-8          { width: 66.666667%; }
.col-12         { width: 100%; }
.row-cols-2 > * { width: 50%; }

@media (min-width: 768px) {
    .col-md      { flex: 1 0 0%; width: auto; }
    .col-md-auto { flex: 0 0 auto; width: auto; }
}
@media (min-width: 992px) {
    .col-lg-3 { width: 25%; }
    .col-lg-6 { width: 50%; }
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .125);
    border-radius: var(--card-radius);
}
.card-body { flex: 1 1 auto; padding: 1rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    padding: .375rem .75rem;
    font-size: 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--body-fg);
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 .25rem rgba(61, 82, 213, .3); }

.btn-primary {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover { color: #fff; background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { color: #fff; background: var(--primary); }

.btn-outline-secondary { color: var(--muted); border-color: var(--muted); }
.btn-outline-secondary:hover { color: #fff; background: var(--muted); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label { display: inline-block; margin-bottom: .35rem; font-size: .85rem; font-weight: 600; }
.form-text  { margin-top: .25rem; font-size: .8125rem; color: var(--muted); }

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: .375rem .75rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--body-fg);
    background-color: #fff;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    transition: border-color .15s ease, box-shadow .15s ease;
    appearance: none;
}
.form-select {
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 16px 12px;
}
.form-control:focus,
.form-select:focus {
    border-color: #97a3e8;
    outline: 0;
    box-shadow: 0 0 0 .2rem rgba(61, 82, 213, .18);
}
.form-control::placeholder { color: #9aa0a6; opacity: 1; }

/* Invalid state + feedback */
.form-control.is-invalid,
.form-select.is-invalid { border-color: #dc3545; }
.form-control.is-invalid:focus,
.form-select.is-invalid:focus { box-shadow: 0 0 0 .2rem rgba(220, 53, 69, .2); }
.invalid-feedback { display: none; width: 100%; margin-top: .25rem; font-size: .875em; color: #dc3545; }
.is-invalid ~ .invalid-feedback { display: block; }

/* ── Input groups ───────────────────────────────────────────── */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}
.input-group > .form-control { position: relative; flex: 1 1 auto; width: 1%; min-width: 0; }
.input-group-text {
    display: flex;
    align-items: center;
    padding: .375rem .75rem;
    font-size: 1rem;
    color: var(--body-fg);
    background-color: #e9ecef;
    border: 1px solid var(--input-border);
    white-space: nowrap;
}
/* Collapse shared borders and round only the outer edges. */
.input-group > :not(:first-child) { margin-left: -1px; }
.input-group > .form-control,
.input-group > .input-group-text { border-radius: 0; }
.input-group > :first-child { border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.input-group > .form-control { border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.input-group .invalid-feedback { margin-left: 0; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    position: relative;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
}
.alert-info    { color: #055160; background: #cff4fc; border-color: #b6effb; }
.alert-danger  { color: #842029; background: #f8d7da; border-color: #f5c2c7; }
.alert-success { color: #0f5132; background: #d1e7dd; border-color: #badbcc; }
.alert-warning { color: #664d03; background: #fff3cd; border-color: #ffecb5; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .35em .65em;
    font-size: .75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--radius);
}
.badge.rounded-pill { font-size: .7rem; }
.text-bg-success   { color: #fff; background: #198754; }
.text-bg-warning   { color: #000; background: #ffc107; }
.text-bg-secondary { color: #fff; background: #6c757d; }

/* ── List groups ────────────────────────────────────────────── */
.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
    border-radius: var(--radius);
}
.list-group-item {
    position: relative;
    display: block;
    padding: .5rem 1rem;
    color: var(--body-fg);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .125);
}
.list-group-item + .list-group-item { border-top-width: 0; }
.list-group-flush { border-radius: 0; }
.list-group-flush > .list-group-item { border-width: 0 0 1px; }
.list-group-flush > .list-group-item:last-child { border-bottom-width: 0; }
/* Long, unbreakable values (UPI ID, reference) must not force horizontal
   scroll on narrow screens — let flex children shrink and wrap. */
.list-group-item.d-flex { gap: .5rem; }
.list-group-item.d-flex > * { min-width: 0; overflow-wrap: anywhere; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
    vertical-align: top;
}
.table > thead { vertical-align: bottom; }
.table th, .table td {
    padding: .5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.table thead th {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
    font-weight: 600;
}
.table-hover tbody tr:hover { background: rgba(0, 0, 0, .03); }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; flex-wrap: wrap; padding-left: 0; list-style: none; margin: 0; }
.page-item { display: flex; align-items: center; }
.page-link {
    display: block;
    padding: .375rem .75rem;
    color: var(--primary);
    background: #fff;
    border: 1px solid var(--border);
    text-decoration: none;
}
.page-link:hover { background: #e9ecef; color: var(--primary-dark); }
.page-item + .page-item .page-link { margin-left: -1px; }
.page-item.disabled .page-link { color: var(--muted); pointer-events: none; background: #fff; }
.pagination-sm .page-link { padding: .25rem .5rem; font-size: .875rem; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: .5rem 0;
}
.navbar-brand {
    display: inline-flex;
    align-items: center;
    padding: .25rem 0;
    margin-right: 1rem;
    font-size: 1.25rem;
    text-decoration: none;
    color: #fff;
    white-space: nowrap;
}
.navbar-brand:hover { color: #fff; }
.navbar-nav {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin: 0;
    list-style: none;
}
.nav-item { display: block; }
.nav-link {
    display: block;
    padding: .5rem 0;
    color: #c8cfe8;
    text-decoration: none;
    background: transparent;
    border: 0;
}
.nav-link:hover { color: #fff; }
.navbar-text { padding: .5rem 0; color: #6b7499; }
.navbar-collapse { flex-basis: 100%; flex-grow: 1; align-items: center; }

.navbar-toggler {
    padding: .25rem .5rem;
    font-size: 1.25rem;
    line-height: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
}
.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.85)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

/* Collapse behaviour (mobile-first): hidden until toggled open. */
.collapse:not(.show) { display: none; }

@media (min-width: 992px) {
    .navbar-expand-lg { flex-wrap: nowrap; }
    .navbar-expand-lg .navbar-nav { flex-direction: row; align-items: center; }
    .navbar-expand-lg .nav-link { padding-right: .5rem; padding-left: .5rem; }
    .navbar-expand-lg .navbar-toggler { display: none; }
    .navbar-expand-lg .navbar-collapse { display: flex !important; flex-basis: auto; }
}

/* ── App-specific components ─────────────────────────────────── */
.puja-navbar { background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
.brand-mark { font-size: 1.5rem; line-height: 1; }
.brand-name { font-size: 1rem; }
.brand-sub  { font-size: .78rem; opacity: .85; }

.text-primary { color: var(--primary) !important; }

/* Summary tiles (admin dashboard) */
.tile-num   { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--navy); }
.tile-label { font-size: .78rem; color: var(--muted); }
.tile-warn  .tile-num { color: #997404; }
.tile-ok    .tile-num { color: #198754; }
.tile-money .tile-num { color: var(--primary); font-size: 1.3rem; }

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

/* Thanks / payment page */
.tick {
    width: 56px; height: 56px; margin: 0 auto .5rem;
    display: grid; place-items: center;
    background: #d1e7dd; color: #0f5132;
    border-radius: 50%; font-size: 1.6rem; font-weight: 700;
}
.summary dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.summary dd { margin: 2px 0 0; font-weight: 600; }
.amount { color: var(--primary); font-weight: 700; }
.qr {
    width: 240px; max-width: 78vw; aspect-ratio: 1 / 1;
    background: #fff; padding: 8px; border: 1px solid #e9ecef; border-radius: 12px;
}
.qr svg { width: 100%; height: 100%; display: block; }
.screenshot-thumb {
    max-width: 220px; max-height: 300px; width: auto; height: auto;
    border: 1px solid #e9ecef; border-radius: 8px;
}

/* Login / setup screens */
.amc-login-body {
    background: linear-gradient(135deg, #1a1f36 0%, #2d3561 50%, #1a1f36 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.amc-login-container { width: 100%; max-width: 420px; }
.amc-login-card { border-radius: 1rem; }
.login-icon {
    width: 60px; height: 60px; border-radius: 1rem;
    background: var(--primary); color: #fff; font-size: 1.8rem;
    display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.login-copyright { color: rgba(255, 255, 255, .45); }
.uppercase { text-transform: capitalize; }

/* ── Utilities ──────────────────────────────────────────────── */
/* Display */
.d-block { display: block !important; }
.d-flex  { display: flex !important; }
.d-grid  { display: grid !important; }

/* Flex helpers */
.flex-column            { flex-direction: column !important; }
.align-items-center     { align-items: center !important; }
.align-middle           { vertical-align: middle !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.gap-2 { gap: .5rem !important; }
.lh-sm { line-height: 1.25 !important; }

/* Sizing */
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* Text */
.text-center { text-align: center !important; }
.text-start  { text-align: left !important; }
.text-end    { text-align: right !important; }
.text-muted  { color: var(--muted) !important; }
.text-success { color: #198754 !important; }
.text-danger-emphasis { color: #b02a37 !important; }
.fw-normal   { font-weight: 400 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold     { font-weight: 700 !important; }
.small       { font-size: .875em !important; }

/* Borders / shape / shadow */
.border-0      { border: 0 !important; }
.rounded-pill  { border-radius: 50rem !important; }
.shadow-sm { box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075) !important; }
.shadow-lg { box-shadow: 0 1rem 3rem rgba(0, 0, 0, .175) !important; }

/* Margin */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .25rem !important; }
.mb-2 { margin-bottom: .5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-1 { margin-top: .25rem !important; }
.mt-2 { margin-top: .5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
.ms-auto { margin-left: auto !important; }

/* Padding */
.p-4  { padding: 1.5rem !important; }
.px-3 { padding-right: 1rem !important; padding-left: 1rem !important; }
.py-2 { padding-top: .5rem !important; padding-bottom: .5rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

@media (min-width: 576px) {
    .p-sm-5 { padding: 3rem !important; }
}
@media (min-width: 992px) {
    .px-lg-4 { padding-right: 1.5rem !important; padding-left: 1.5rem !important; }
    .ms-lg-2 { margin-left: .5rem !important; }
    .me-lg-2 { margin-right: .5rem !important; }
    .gap-lg-1 { gap: .25rem !important; }
    .align-items-lg-center { align-items: center !important; }
}
