/* =========================================================
   Public theme - District Kalolsavam
   Watercolour Kerala background + light glass cards,
   matching the Sub-District portal. Bootstrap 4.
========================================================= */

:root {
    --kl-ink: #0f172a;
    --kl-muted: #64748b;
    --kl-primary: #1d4ed8;
    --kl-primary-soft: #eff6ff;
    --kl-accent: #db2777;
    --kl-gold: #f59e0b;
    --kl-nav: rgba(17, 24, 39, .92);
    --kl-card: rgba(255, 255, 255, .94);
    --kl-border: #e2e8f0;
    --kl-radius: 12px;
    --kl-shadow: 0 4px 14px rgba(15, 23, 42, .07);
}

/* ---------- page ---------- */
html,
body {
    min-height: 100%;
}

body.public-theme {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    color: var(--kl-ink);
    font-size: 14px;
    background: #f8fafc url("../../img/district_bg.png?v=2") no-repeat center top;
    background-attachment: fixed;
    background-size: cover;
}

/* iOS / small screens do not support fixed backgrounds well */
@media (max-width: 768px) {
    body.public-theme {
        background-attachment: scroll;
        background-size: auto 100vh;
    }
}

.public-main {
    flex: 1 0 auto;
}

/* ---------- banner ---------- */
.festival-banner {
    width: 100%;
    background: #fff;
}

/* keep the banner's own aspect ratio so logos at the edges are never cropped */
.festival-banner img {
    width: 100%;
    height: auto;
    display: block;
}

/* ---------- navbar ---------- */
.public-nav.navbar {
    background: var(--kl-nav);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    backdrop-filter: saturate(140%) blur(8px);
    padding: .35rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}

.public-nav .navbar-brand {
    color: #fff !important;
    font-weight: 700;
    letter-spacing: .3px;
    font-size: 1rem;
}

.public-nav .navbar-brand .brand-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--kl-gold), var(--kl-accent));
    vertical-align: middle;
}

.public-nav .navbar-nav .nav-link {
    color: rgba(255, 255, 255, .88) !important;
    font-weight: 600;
    padding: .5rem .85rem;
    border-radius: 8px;
    transition: background .2s, color .2s;
}

.public-nav .navbar-nav .nav-link:hover,
.public-nav .navbar-nav .nav-item.active .nav-link {
    background: rgba(255, 255, 255, .12);
    color: #fff !important;
}

.public-nav .dropdown-menu {
    border: 0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .2);
    padding: .4rem;
    max-height: 70vh;
    overflow-y: auto;
}

.public-nav .dropdown-item {
    border-radius: 6px;
    padding: .4rem .8rem;
    font-size: 13.5px;
    white-space: normal;
    color: var(--kl-ink);
}

.public-nav .dropdown-item:hover {
    background: var(--kl-primary-soft);
    color: var(--kl-primary);
}

/* login form in navbar */
.public-nav .nav-login .form-control {
    height: 34px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .95);
}

.public-nav .nav-login .btn {
    height: 34px;
    border-radius: 8px;
    font-weight: 700;
    padding: 0 18px;
}

@media (max-width: 991px) {
    .public-nav .nav-login {
        flex-direction: column;
        align-items: stretch !important;
        padding: .5rem 0;
    }

    .public-nav .nav-login .form-control,
    .public-nav .nav-login .btn {
        width: 100%;
        margin: 4px 0 !important;
    }
}

/* ---------- content ---------- */
.public-container {
    max-width: 1250px;
    padding-left: 16px;
    padding-right: 16px;
}

.page-title {
    margin: 16px auto 10px;
    padding: 12px 18px;
    background: rgba(255, 247, 230, .95);
    border: 1px solid #fde7b0;
    border-radius: var(--kl-radius);
    text-align: center;
    box-shadow: var(--kl-shadow);
}

.page-title h3 {
    margin: 0;
    font-size: clamp(16px, 2.2vw, 22px);
    font-weight: 700;
    color: var(--kl-primary);
}

/* Back button on every public page */
.page-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 4px;
    padding: 7px 16px 7px 8px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: var(--kl-primary) !important;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .06);
    transition: background .2s, border-color .2s;
}

.page-back:hover {
    background: var(--kl-primary-soft);
    border-color: #93c5fd;
}

.page-back-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
}

/* cards / panels used by the public views - frosted so the background shows through */
.public-theme .card {
    background: var(--kl-card);
    border: 1px solid var(--kl-border);
    border-radius: var(--kl-radius);
    box-shadow: var(--kl-shadow);
    margin-top: 1.25rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.public-theme .card-header {
    padding: .6rem 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--kl-border);
}

.public-theme .card-info:not(.card-outline) > .card-header {
    background: linear-gradient(90deg, #0891b2, #17a2b8);
    color: #fff;
}

.public-theme .card-body {
    padding: 1rem;
}

.public-theme .info-box {
    background: var(--kl-card);
    border: 1px solid var(--kl-border);
    border-radius: var(--kl-radius);
    box-shadow: var(--kl-shadow);
    transition: transform .15s, box-shadow .15s;
}

.public-theme .info-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .12);
}

/* tables */
.public-theme .table {
    background: rgba(255, 255, 255, .96);
    border-radius: 10px;
    overflow: hidden;
}

.public-theme .table thead th {
    background: #eef2ff;
    color: #1e3a8a;
    border-bottom: 2px solid #c7d2fe;
    font-weight: 700;
    vertical-align: middle;
}

.public-theme .table-hover tbody tr:hover {
    background: #f8fafc;
}

.public-theme .table-responsive {
    border-radius: 10px;
}

.public-theme fieldset {
    background: var(--kl-card);
    border-radius: var(--kl-radius);
}

/* utilities kept from the old template */
.minheight {
    min-height: 30px;
}

.flt-r {
    float: right;
}

.blink {
    animation: blink-animation 1s steps(5, start) infinite;
}

@keyframes blink-animation {
    to {
        visibility: hidden;
    }
}

/* back to top */
#top_button {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 18px;
    box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
    cursor: pointer;
}

#top_button:hover {
    background: #1e40af;
}

/* =========================================================
   Legacy fieldset/legend panels used by the public result views
   -> rendered as the same white card as the Sub-District site.
   (Old CSS made <legend><h4> ~50px; normalised here.)
========================================================= */
.public-theme fieldset {
    background: #fff;
    border: 1px solid var(--kl-border) !important;
    border-radius: var(--kl-radius);
    box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
    padding: 0 !important;
    margin: 0 0 20px;
    overflow: hidden;
    text-align: left;
}

.public-theme fieldset > legend {
    float: left;                    /* puts the legend inside the box like a card header */
    width: 100% !important;
    margin: 0;
    padding: 14px 16px;
    font-size: 18px;
    line-height: 1.3;
    background: #fff !important;
    border: 0;
    border-bottom: 1px solid var(--kl-border);
    border-radius: 0;
    box-shadow: none;
    color: var(--kl-primary);
}

.public-theme fieldset > legend + * {
    clear: both;
}

.public-theme fieldset > legend h1,
.public-theme fieldset > legend h2,
.public-theme fieldset > legend h3,
.public-theme fieldset > legend h4,
.public-theme fieldset > legend h5 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    font-size: 18px !important;
    font-weight: 800;
    line-height: 1.3;
    color: inherit;
}

.public-theme fieldset > legend img {
    width: 22px;
    height: auto;
}

.public-theme fieldset > legend.alert-success { color: #15803d; }
.public-theme fieldset > legend.alert-info    { color: #0e7490; }
.public-theme fieldset > legend.alert-primary { color: #1d4ed8; }

.public-theme fieldset .table {
    margin: 0;
    font-size: 14px;
    border: 0;
    border-radius: 0;
}

.public-theme fieldset .table th,
.public-theme fieldset .table td {
    padding: 10px 14px;
    border-left: 0;
    border-right: 0;
    border-color: #eef2f7;
    vertical-align: middle;
}

.public-theme fieldset .table thead th {
    background: #fff;
    color: #64748b;
    border-bottom: 1px solid var(--kl-border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.public-theme fieldset .table-striped tbody tr:nth-of-type(odd) {
    background: #fafcff;
}

.public-theme fieldset .table a {
    color: var(--kl-primary);
    font-weight: 600;
}

@media (max-width: 767px) {
    .public-theme fieldset > legend,
    .public-theme fieldset > legend h4 {
        font-size: 16px !important;
    }

    .public-theme fieldset .table {
        font-size: 13px;
    }

    .public-theme fieldset .table th,
    .public-theme fieldset .table td {
        padding: 8px;
    }
}

/* fieldsets without a legend (e.g. the district title box) keep normal padding */
.public-theme fieldset:not(:has(> legend)) {
    padding: 12px 16px !important;
    text-align: center;
}

/* =========================================================
   Navbar extras
========================================================= */
.nav-mobile-label {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .3px;
}

.public-nav .navbar-toggler {
    border-color: rgba(255, 255, 255, .35);
    padding: .3rem .55rem;
}

.badge-new {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b, #db2777);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .6px;
    line-height: 1.5;
    vertical-align: middle;
    animation: badge-pulse 1.8s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(219, 39, 119, .55); }
    50%      { box-shadow: 0 0 0 5px rgba(219, 39, 119, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .badge-new { animation: none; }
}

/* old per-page text "Back" links - the template's Back button replaces them */
.public-theme .back-button-container,
.public-theme a.back-button,
.public-theme .back-button + .fa-home {
    display: none !important;
}

/* JS wraps every content table in this so wide tables scroll instead of being cut off */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll > table {
    margin-bottom: 0;
}

img {
    max-width: 100%;
}

/* =========================================================
   Phones & small tablets
========================================================= */
@media (max-width: 767px) {
    body.public-theme {
        font-size: 13px;
    }

    .public-nav.navbar {
        padding: .4rem .75rem;
    }

    .public-nav .navbar-collapse {
        max-height: calc(100vh - 140px);
        overflow-y: auto;
    }

    .public-nav .navbar-nav .nav-link {
        padding: .6rem .5rem;
    }

    .public-nav .dropdown-menu {
        max-height: 50vh;
        box-shadow: none;
        background: rgba(255, 255, 255, .97);
    }

    .public-container {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* old views nest container/row/col - strip their side gutters so content uses the full width */
    .public-container .container,
    .public-container .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: 100%;
    }

    .public-container .row {
        margin-left: 0;
        margin-right: 0;
    }

    .public-container .row > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
    }

    .public-container br + br {
        display: none;
    }

    .page-back {
        margin: 10px 0 2px;
        padding: 5px 12px 5px 6px;
        font-size: 13px;
    }

    .page-title {
        margin: 10px 0 8px;
        padding: 10px 12px;
    }

    .page-title h3 {
        font-size: 15px;
        line-height: 1.4;
    }

    /* generic tables */
    .public-container .table {
        font-size: 12.5px;
    }

    .public-container .table th,
    .public-container .table td {
        padding: 7px 8px;
    }

    .public-container .table img {
        max-width: 56px;
        height: auto;
    }

    /* item list (3 links per row) -> one item per line */
    .item-grid-table,
    .item-grid-table tbody,
    .item-grid-table tr,
    .item-grid-table td {
        display: block;
        width: 100% !important;
    }

    .item-grid-table tr {
        border: 0;
    }

    .item-grid-table td {
        border: 0 !important;
        border-bottom: 1px solid #eef2f7 !important;
        padding: 10px 12px !important;
    }

    .public-theme fieldset {
        margin-bottom: 14px;
    }

    .public-theme fieldset > legend {
        padding: 11px 12px;
    }

    /* footer */
    .new-public-footer .footer-main {
        padding: 22px 16px;
    }

    .new-public-footer .footer-kite {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    #top_button {
        bottom: 14px;
        right: 14px;
        width: 40px;
        height: 40px;
    }
}
