/* ============================================================
   Bootstrap 5 polish — IMI Kolkata StudentWeb.
   Loaded after default.css and bootstrap.min.css so these rules win.
   Brand navy: #004080 (matches .my-navbar).
   ============================================================ */

/* ---------- GridViews (grids carrying .gv-nice) ----------
   Child combinators (> tbody > tr > td) keep borders/striping off
   nested tables inside ItemTemplates. */
.gv-nice {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: .9rem;
}

.gv-nice > tbody > tr > th,
.gv-nice > tbody > tr > td,
.gv-nice > thead > tr > th,
.gv-nice > tr > th,
.gv-nice > tr > td {
    border: 1px solid #cdd7df; /* vertical + horizontal column lines */
    padding: 8px 10px;
    vertical-align: middle;
}

/* Header: brand navy, left by default (gridview.js syncs each column to its
   data cells). UseAccessibleHeader="False" renders header cells as <td> and
   puts the HeaderStyle class on the ROW, so the cells are painted directly -
   otherwise a row hover on the cells covers the row's navy. */
.gv-nice > tbody > tr > th,
.gv-nice > thead > tr > th,
.gv-nice > tr > th,
.gv-nice .HeaderStyle,
.gv-nice > tbody > tr.HeaderStyle > td,
.gv-nice > tbody > tr.HeaderStyle > th {
    background-color: #004080 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #004080 !important;
    text-align: left;
    font-weight: 600;
    box-shadow: none !important;
}

    .gv-nice > tbody > tr > th a,
    .gv-nice > tbody > tr.HeaderStyle a {
        color: #fff !important;
    }

.gv-nice > tbody > tr:nth-child(even) > td {
    background-color: #eef3f6;
}

/* row hover - never the header row (class lives on the <tr>) */
.gv-nice > tbody > tr:not(.HeaderStyle):hover > td {
    background-color: #dceaf5;
}

/* ---------- Buttons: outline style ----------
   Recolours the classes the markup already uses, so no .aspx/.ascx changes. */
.btn {
    border-radius: .375rem;
    font-weight: 600;
}

.btn-secondary,
.btn-primary {
    --bs-btn-bg: transparent;
    --bs-btn-color: #004080;
    --bs-btn-border-color: #004080;
    --bs-btn-hover-bg: #004080;
    --bs-btn-hover-border-color: #004080;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #002b55;
    --bs-btn-active-border-color: #002b55;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: #9db3c6;
    --bs-btn-disabled-color: #9db3c6;
    --bs-btn-focus-shadow-rgb: 0, 64, 128;
    border-width: 1px;
}

.btn-danger {
    --bs-btn-bg: transparent;
    --bs-btn-color: #b02a37;
    --bs-btn-border-color: #b02a37;
    --bs-btn-hover-bg: #b02a37;
    --bs-btn-hover-border-color: #b02a37;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #8f222d;
    --bs-btn-active-border-color: #8f222d;
    --bs-btn-active-color: #fff;
    border-width: 1px;
}

/* ASP.NET renders a disabled Button as <input disabled>; BS5's
   --bs-btn-disabled-* only reaches .disabled on <a>/<button>. */
.btn-secondary:disabled,
.btn-primary:disabled,
.btn-secondary[disabled],
.btn-primary[disabled] {
    background-color: transparent;
    border-color: #9db3c6;
    color: #9db3c6;
    opacity: 1;
}

/* btn-xs was dropped in BS5 but the legacy markup still uses it */
.btn-xs {
    --bs-btn-padding-y: .12rem;
    --bs-btn-padding-x: .5rem;
    --bs-btn-font-size: .78rem;
    --bs-btn-border-radius: .25rem;
}

.gv-nice td .btn,
.gv-nice th .btn {
    --bs-btn-padding-y: .12rem;
    --bs-btn-padding-x: .5rem;
    --bs-btn-font-size: .8rem;
}

/* legacy themed button -> outline (drops the gif background).
   Scoped to real buttons only: <asp:Button> renders <input>, <asp:LinkButton> <a>.
   A <span> (<asp:Label>) using ButtonStyle as a status badge - e.g. "FINAL GRADES
   SAVED, (EDIT MODE)" in SubmitGradesByFaculty - keeps its original Default.css look. */
input.ButtonStyle,
button.ButtonStyle,
a.ButtonStyle {
    background-image: none !important;
    background-color: transparent !important;
    color: #004080 !important;
    border: 1px solid #004080 !important;
    border-radius: .375rem !important;
    padding: .35rem 1rem !important;
    font-weight: 600 !important;
    font-size: .9rem !important;
    text-decoration: none;
    cursor: pointer;
    margin: 2px 3px;
}

    input.ButtonStyle:hover,
    button.ButtonStyle:hover,
    a.ButtonStyle:hover {
        background-color: #004080 !important;
        color: #fff !important;
    }

/* label used as a status badge: keep the maroon text, drop the background */
span.ButtonStyle {
    background-color: transparent;
}

#pageContent .btn + .btn {
    margin-left: 6px;
}

/* ---------- UpdateProgress "Processing" overlay ---------- */
.proc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 27, 45, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100010;
}

.proc-box {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .32);
    padding: 28px 40px;
    min-width: 300px;
    max-width: 90vw;
}

.proc-spinner {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border: 5px solid #d3dded;
    border-top-color: #004080;
    border-radius: 50%;
    animation: proc-spin .7s linear infinite;
}

@keyframes proc-spin {
    to { transform: rotate(360deg); }
}

.proc-text {
    color: #004080;
    font-weight: 600;
    font-size: 1.15rem;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .proc-spinner { animation-duration: 2s; }
}

/* ---------- ReportViewer ----------
   The viewer lays out in a table-layout:fixed table whose column widths come
   from a hidden first row (25% Document Map + splitter). Fixed layout still
   reserves those hidden columns, squeezing the report area. Auto layout lets
   the visible report column fill the control. Matched by id suffix because a
   ReportViewer's CssClass does not land on the fixedTable's ancestor. */
#pageContent table[id$="_fixedTable"] {
    table-layout: auto !important;
    width: 100% !important;
}

    #pageContent table[id$="_fixedTable"] > tbody > tr > td[style*="display:none"],
    #pageContent table[id$="_fixedTable"] > tbody > tr > td[style*="display: none"] {
        width: 0 !important;
        padding: 0 !important;
    }

#pageContent div[id$="_ctl13"] {
    width: 100% !important;
}

/* centre the report page; auto margins fall back to 0 (not clipped) when
   the report is wider than the area */
#pageContent div[id$="_oReportDiv"] > table {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ---------- Page title image ----------
   Titles come from titletext.ashx. BS5 img-fluid (unlike BS3 img-responsive)
   is not display:block, so centre it explicitly. Matched by src because the
   title image's ID varies between controls. */
#pageContent img[src*="titletext.ashx"] {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Form controls & labels ---------- */
.form-control,
.form-select {
    font-size: .92rem;
}

/* labels sat flush against their control in the legacy markup */
.LabelStyle {
    font-weight: 600;
    display: inline-block;
    margin-bottom: 4px;
}

/* ---------- Vertical rhythm ----------
   Filler rows (<tr><td>&nbsp;</td></tr>) are tagged .sp-row and given a
   controlled height instead of a full blank line. */
.sp-row > td {
    height: 6px;
    padding: 0 !important;
    font-size: 0;
    line-height: 0;
}

#pageContent .gv-nice {
    margin-top: 4px;
    margin-bottom: 8px;
}
