/* AP Teachers DA Arrears Bill Status */

:root {
    --navy-900: #071a33;
    --navy-800: #0b2545;
    --navy-700: #13315c;
    --teal-600: #0f766e;
    --teal-500: #14958a;
    --teal-300: #5fd3c6;
    --teal-50:  #e6f6f4;
    --bg:       #f6f7f4;
    --card:     #ffffff;
    --text:     #1a2433;
    --muted:    #4f5d70;
    --border:   #dde3ea;
    --focus:    #f5b700;

    --paid-bg:    #e3f4e8; --paid-fg:    #145c2c; --paid-bd:    #9fd5b0;
    --pending-bg: #fff3d6; --pending-fg: #7a4b00; --pending-bd: #f0c96a;
    --failed-bg:  #fde4e4; --failed-fg:  #9b1c1c; --failed-bd:  #f1a7a7;
    --neutral-bg: #eef1f5; --neutral-fg: #354256; --neutral-bd: #c9d1dc;

    --radius: 14px;
    --shadow: 0 1px 2px rgba(11, 37, 69, .06), 0 8px 28px rgba(11, 37, 69, .08);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
    --font-te: "Noto Sans Telugu", "Nirmala UI", "Gautami", "Mandali", var(--font);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scrollbar-color: var(--teal-500) #e3e8ee;
}

/* Coloured page scrollbar (Chrome, Edge, Safari) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: #e3e8ee; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--teal-500), var(--navy-700));
    border: 2px solid #e3e8ee;
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--teal-300), var(--teal-600)); }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

[hidden] { display: none !important; }

.container {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 16px;
}

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute;
    left: 16px; top: -60px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--focus);
    color: #000;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* ---------- Background decoration ---------- */
.bg-decor {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(1200px 420px at 50% -120px, rgba(19, 49, 92, .10), transparent 70%),
        var(--bg);
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .35;
    animation: drift 26s ease-in-out infinite alternate;
}
.orb-1 { width: 420px; height: 420px; background: #9fe3d9; top: 120px; left: -140px; }
.orb-2 { width: 360px; height: 360px; background: #b9c9e6; top: 360px; right: -120px; animation-duration: 32s; animation-delay: -8s; }
.orb-3 { width: 280px; height: 280px; background: #ccefe9; bottom: -80px; left: 40%; animation-duration: 38s; animation-delay: -16s; }
.grid-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(11, 37, 69, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(11, 37, 69, .035) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, transparent 70%);
            mask-image: linear-gradient(to bottom, #000 0, transparent 70%);
}
@keyframes drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(40px, -30px) scale(1.08); }
    100% { transform: translate(-30px, 30px) scale(.95); }
}

/* ---------- Header ---------- */
.site-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(120deg, var(--navy-900), var(--navy-800) 55%, var(--navy-700));
    color: #fff;
    border-bottom: 3px solid var(--teal-500);
}
.site-header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(95, 211, 198, .16) 50%, transparent 70%);
    background-size: 250% 100%;
    animation: sheen 9s linear infinite;
    pointer-events: none;
}
@keyframes sheen {
    from { background-position: 120% 0; }
    to   { background-position: -120% 0; }
}
.header-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 12px;
    min-height: 64px;
    padding-top: 10px;
    padding-bottom: 10px;
    text-align: center;
}
.brand { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; }
.brand-text { overflow-wrap: anywhere; }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-mark rect { fill: rgba(255, 255, 255, .1); stroke: rgba(255, 255, 255, .25); }
.brand-mark .cap { fill: var(--teal-300); }
.brand-mark .band, .brand-mark .tassel { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.brand-text { font-size: 1.15rem; font-weight: 700; letter-spacing: .02em; }

.demo-pill {
    position: absolute;
    right: 16px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--navy-900);
    background: var(--teal-300);
}

/* ---------- Main ---------- */
.main { flex: 1; padding-top: 40px; padding-bottom: 48px; }

.hero { text-align: center; margin-bottom: 24px; }
.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 1.1rem + 2vw, 2.35rem);
    line-height: 1.2;
    color: var(--navy-800);
    letter-spacing: -.01em;
}
.subtitle {
    margin: 0 auto;
    max-width: 640px;
    font-family: var(--font-te);
    font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
    color: var(--muted);
}

/* ---------- Search card ---------- */
.search-card {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 4px solid var(--teal-500);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: fade-up .5s ease-out both;
}
@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.demo-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: .92rem;
    color: var(--navy-800);
    background: var(--teal-50);
    border: 1px dashed var(--teal-500);
}
.demo-tag {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #fff;
    background: var(--teal-600);
}
.link-button {
    padding: 0 2px;
    font: inherit;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 700;
    color: var(--teal-600);
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

.field-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--navy-800);
}
.search-row { display: flex; gap: 10px; }
.search-row input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 10px 14px;
    font: inherit;
    font-size: 1.05rem;
    letter-spacing: .04em;
    color: var(--text);
    background: #fff;
    border: 1.5px solid #9aa7b8;
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}
.search-row input::placeholder { color: #6b7789; letter-spacing: 0; }
.search-row input:hover { border-color: var(--navy-700); }
.search-row input:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(20, 149, 138, .2); }
.search-row input[aria-invalid="true"] { border-color: var(--failed-fg); }

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 20px;
    font: inherit;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--teal-600), var(--navy-700));
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .12s, box-shadow .15s, filter .15s;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 16px rgba(15, 118, 110, .3); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { cursor: progress; filter: saturate(.6); }
.btn-primary .spinner { display: none; }
.btn-primary.is-busy .spinner { display: inline-block; }

.field-help { margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.field-error {
    margin: 6px 0 0;
    font-size: .92rem;
    font-weight: 600;
    color: var(--failed-fg);
}
.field-error::before { content: "⚠ "; }

.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.spinner-dark { border-color: rgba(15, 118, 110, .25); border-top-color: var(--teal-600); display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 12px 14px;
    font-weight: 600;
    color: var(--navy-800);
    background: #f3f6f9;
    border-radius: 10px;
}

.message {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    border-left: 4px solid;
    font-weight: 500;
}
.message-empty { color: var(--navy-800); background: #f1f4f8; border-color: var(--navy-700); }
.message-error { color: var(--failed-fg); background: var(--failed-bg); border-color: var(--failed-fg); }

/* ---------- Results ---------- */
.results {
    max-width: 1160px;
    margin: 32px auto 0;
    outline: none;
}
.results.is-visible { animation: fade-slide .4s ease-out both; }
@keyframes fade-slide {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}
.results h2 {
    margin: 0 0 14px;
    font-size: 1.35rem;
    color: var(--navy-800);
}

.summary {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.summary-item {
    min-width: 0;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.summary-label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}
.summary-value {
    display: block;
    margin-top: 2px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy-900);
    overflow-wrap: anywhere;
}
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .03em; }

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.bills-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
    font-size: .92rem;
}
.bills-table th, .bills-table td {
    padding: 11px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}
.bills-table th {
    position: sticky;
    top: 0;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #fff;
    background: var(--navy-800);
    white-space: nowrap;
}
.bills-table tbody tr:nth-child(even) { background: #f9fafb; }
.bills-table tbody tr:hover { background: var(--teal-50); }
.bills-table tbody tr:last-child td { border-bottom: 0; }
.bills-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bills-table td.net { font-weight: 700; color: var(--navy-900); }
.bills-table td.nowrap { white-space: nowrap; }
.bills-table td.name { min-width: 200px; }
.bills-table .badge { white-space: nowrap; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: break-word;
}
.badge::before { margin-right: 4px; }
.badge-paid    { color: var(--paid-fg);    background: var(--paid-bg);    border-color: var(--paid-bd); }
.badge-paid::before    { content: "✓"; }
.badge-pending { color: var(--pending-fg); background: var(--pending-bg); border-color: var(--pending-bd); }
.badge-pending::before { content: "⏳"; }
.badge-failed  { color: var(--failed-fg);  background: var(--failed-bg);  border-color: var(--failed-bd); }
.badge-failed::before  { content: "✕"; }
.badge-neutral { color: var(--neutral-fg); background: var(--neutral-bg); border-color: var(--neutral-bd); }

/* Phone cards (hidden on desktop) */
.bill-cards { display: none; margin: 0; padding: 0; list-style: none; }
.bill-card {
    margin-bottom: 14px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--teal-500);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.bill-card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.bill-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy-800);
    overflow-wrap: anywhere;
}
.bill-card-net { width: 100%; }
.bill-card-net .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.bill-card-net .value { display: block; font-size: 1.4rem; font-weight: 800; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.bill-card dl {
    display: grid;
    grid-template-columns: minmax(96px, 40%) 1fr;
    gap: 8px 12px;
    margin: 0;
    font-size: .93rem;
}
.bill-card dt { font-weight: 600; color: var(--muted); }
.bill-card dd { margin: 0; min-width: 0; color: var(--text); overflow-wrap: anywhere; }

/* Card side bar follows the payment status colour */
.bill-card { position: relative; border-left-width: 6px; }
.bill-card.tone-paid    { border-left-color: #2f9e5a; }
.bill-card.tone-pending { border-left-color: #e0a100; }
.bill-card.tone-failed  { border-left-color: #c53030; }
.bill-card.tone-neutral { border-left-color: var(--navy-700); }

/* ---------- Back to top ---------- */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--teal-600), var(--navy-800));
    box-shadow: 0 8px 22px rgba(11, 37, 69, .35);
    cursor: pointer;
    opacity: 0;
    transform: translateY(24px) scale(.6);
    transition: opacity .35s ease, transform .45s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
}
.back-to-top[hidden] { display: grid !important; visibility: hidden; pointer-events: none; }
.back-to-top.is-visible { opacity: 1; transform: none; visibility: visible; }
.back-to-top::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--teal-300);
    opacity: 0;
}
.back-to-top.is-visible::before { animation: btt-pulse 2.6s ease-out 1s infinite; }
.back-to-top:hover { box-shadow: 0 12px 28px rgba(15, 118, 110, .45); transform: translateY(-4px); }
.back-to-top:hover .btt-arrow { animation: btt-bounce .7s ease-in-out infinite; }
.back-to-top.is-scrolling-down { box-shadow: 0 0 0 6px rgba(95, 211, 198, .25), 0 10px 26px rgba(15, 118, 110, .45); }
.back-to-top.is-scrolling-down .btt-arrow { animation: btt-bounce .5s ease-in-out infinite; }
.back-to-top.is-scrolling-down::before { animation: btt-pulse 1s ease-out infinite; }
.back-to-top:active { transform: translateY(0) scale(.94); }
.btt-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.btt-track, .btt-progress { fill: none; stroke-width: 3; }
.btt-track { stroke: rgba(255, 255, 255, .18); }
.btt-progress {
    stroke: var(--teal-300);
    stroke-linecap: round;
    stroke-dasharray: 131.95;
    stroke-dashoffset: 131.95;
    transition: stroke-dashoffset .12s linear;
}
.btt-arrow { position: relative; width: 22px; height: 22px; }
.btt-arrow path { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes btt-pulse {
    0%   { opacity: .7; transform: scale(.9); }
    70%  { opacity: 0;  transform: scale(1.35); }
    100% { opacity: 0;  transform: scale(1.35); }
}
@keyframes btt-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}
@media (max-width: 560px) {
    .back-to-top { right: 14px; bottom: 14px; width: 48px; height: 48px; }
    .site-footer { padding-bottom: 76px; } /* keep footer text clear of the button */
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: auto;
    padding: 22px 0;
    color: #d5dde8;
    background: var(--navy-900);
    border-top: 3px solid var(--teal-500);
    text-align: center;
    font-size: .92rem;
}
.footer-inner p { margin: 4px 0; }
.credit a.dev-name {
    position: relative;
    display: inline-block;
    font-weight: 800;
    letter-spacing: .02em;
    text-decoration: none;
    color: var(--teal-300);
    background: linear-gradient(90deg, #5fd3c6 0%, #ffffff 25%, #f5c84b 50%, #ffffff 75%, #5fd3c6 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: name-shine 4s linear infinite;
}
.credit a.dev-name::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -3px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #5fd3c6, #f5c84b, #5fd3c6, transparent);
    background-size: 200% 100%;
    animation: name-line 2.6s ease-in-out infinite;
}
.credit a.dev-name:hover { animation-duration: 1.5s; }
.credit a.dev-name:focus-visible { -webkit-text-fill-color: #fff; }
@keyframes name-shine { to { background-position: -200% center; } }
@keyframes name-line {
    0%   { background-position: 100% 0; transform: scaleX(.3); opacity: .6; }
    50%  { transform: scaleX(1); opacity: 1; }
    100% { background-position: -100% 0; transform: scaleX(.3); opacity: .6; }
}
.disclaimer { font-size: .8rem; color: #a9b6c8; }

/* ---------- Copy / screenshot deterrents (best effort) ---------- */
.protected {
    position: relative;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.protected::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='170'%3E%3Ctext x='150' y='90' text-anchor='middle' transform='rotate(-24 150 90)' font-family='Arial,sans-serif' font-size='15' font-weight='700' fill='%230b2545' fill-opacity='0.07'%3EC. Belagal Mandal Teachers%3C/text%3E%3Ctext x='150' y='110' text-anchor='middle' transform='rotate(-24 150 90)' font-family='Arial,sans-serif' font-size='11' fill='%230b2545' fill-opacity='0.07'%3EFor personal reference only%3C/text%3E%3C/svg%3E");
    background-repeat: repeat;
}
.protected img { -webkit-user-drag: none; }
.protected.is-shielded > * { filter: blur(10px); transition: filter .1s; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .table-wrap { display: none; }
    .bill-cards { display: block; }
    .summary { grid-template-columns: 1fr 1fr; }
    .summary-name { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
    .main { padding-top: 24px; }
    .search-card { padding: 18px 16px; }
    .search-row { flex-direction: column; }
    .btn-primary { width: 100%; }
    .orb { opacity: .25; }
}

@media (max-width: 760px) {
    .demo-pill { position: static; }
    .brand-text { font-size: 1rem; }
}

@media (max-width: 360px) {
    .brand-text { font-size: .92rem; }
    .brand-mark { width: 30px; height: 30px; }
    .demo-pill { font-size: .7rem; padding: 3px 8px; }
    .bill-card { padding: 14px 12px; }
    .bill-card dl { grid-template-columns: 1fr; gap: 2px; }
    .bill-card dd { margin-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .orb, .site-header::after { animation: none !important; }
    .spinner { animation: spin 1.6s linear infinite !important; }
}

@media print {
    /* Bill details are never printed (also blocks "Save as PDF"). */
    body * { visibility: hidden !important; }
    body::before {
        content: "Printing is disabled for DA arrears bill details.";
        visibility: visible;
        display: block;
        padding: 40px;
        font-size: 18px;
        text-align: center;
    }
    .bg-decor { display: none !important; }
}


/* ---------- Desktop: footer always visible at the bottom of the screen ---------- */
@media (min-width: 761px) and (min-height: 560px) {
    .site-footer {
        position: sticky;
        bottom: 0;
        z-index: 40;
        padding: 10px 0;
        font-size: .86rem;
        box-shadow: 0 -6px 18px rgba(7, 26, 51, .18);
    }
    .footer-inner p { margin: 2px 0; }
    .back-to-top { bottom: 84px; }
    .header-inner { min-height: 56px; }
    .main { padding-top: 28px; padding-bottom: 28px; }
}
