/* Support Requests page — visually mirrors my-profile.css's tab/card/badge
   patterns (same values, scoped to #support-requests-page instead) so this
   new page looks native to the app rather than a bolt-on. */

/* Root-cause layout fix (2026-09-09) — global.css's shared
   `.page-section.active` rule makes every page a
   `display:flex; flex-direction:column; justify-content:center;
   align-items:center` box (min-height:100vh). That's invisible on a page
   like My Profile, whose <header>+<main> content is always taller/wider
   than the centering box anyway - but on THIS page, content can genuinely
   be short (an empty "My Requests" tab: just a line of text) or narrow
   (a request type with only 2-3 fields), and centering then visibly:
   (a) pushes <header>+<main> down from the top when the panel is short -
       "lot of space above the trust logo";
   (b) shrinks <main> to fit its own content's natural width instead of
       filling its max-width:900px, since align-items:center sizes a flex
       item to shrink-to-fit rather than stretch - so a form with few/short
       fields renders in a narrower <main> than one with many fields (e.g.
       Upload Expense Sheet's 4 fields, which happens to be wide enough to
       already hit the 900px cap and "fits perfectly" by comparison);
   (c) makes the whole <main> box (tabs included) visibly re-center itself
       whenever that shrink-to-fit width changes between tab switches -
       "tabs are moving left" / "My Requests kind of breaks the page".
   Overriding align-items to stretch (fills the container's width, capped
   by <main>'s own max-width:900px, same outcome the other pages already
   get "for free" from their content being wide enough) and justify-content
   to flex-start (top-aligned instead of vertically centered) fixes all of
   the above without touching the shared global.css rule every other page
   still depends on. */
#support-requests-page.page-section.active {
    justify-content: flex-start;
    align-items: stretch;
}

#support-requests-page .sr-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#support-requests-page .sr-tab {
    background: white;
    border: 2px solid #e0e0e0;
    color: #667eea;
    padding: 0.6rem 1.1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#support-requests-page .sr-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    color: white;
}

#support-requests-page .sr-panel {
    display: none;
}

#support-requests-page .sr-panel.active {
    display: block;
}

#support-requests-page .sr-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.25rem;
    margin-bottom: 0.9rem;
}

#support-requests-page .sr-form-group {
    margin-bottom: 1rem;
}

#support-requests-page .sr-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: #444;
    margin-bottom: 0.35rem;
}

#support-requests-page .sr-required {
    color: #a71d2a;
}

#support-requests-page .sr-repeat-row {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 0.85rem 0.85rem 0.25rem;
    margin-bottom: 0.85rem;
    background: #fafafa;
}

#support-requests-page .sr-repeat-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

#support-requests-page .sr-repeat-row-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#support-requests-page .sr-repeat-remove-btn {
    background: none;
    border: none;
    color: #a71d2a;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
}

#support-requests-page .sr-repeat-remove-btn:hover {
    text-decoration: underline;
}

#support-requests-page .sr-input,
#support-requests-page select.sr-input,
#support-requests-page textarea.sr-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #333;
    background: white;
}

#support-requests-page .sr-input:focus {
    outline: none;
    border-color: #764ba2;
}

#support-requests-page .sr-hint {
    font-size: 0.78rem;
    color: #888;
    margin-top: 0.3rem;
}

/* Country-code combobox + national-number input, side by side, for the
   'mobile' field type (Add Student → Mobile Number). The combobox button
   only needs to fit "+91"-width text, so it stays narrow and the number
   input takes the rest of the row; both stack full-width on phones (media
   query below). */
#support-requests-page .sr-mobile-row {
    display: flex;
    gap: 0.5rem;
}

#support-requests-page .sr-mobile-number {
    flex: 1 1 auto;
    min-width: 0;
}

/* Country-code combobox (mirrors the portal's CountryCodeSelect.tsx) — a
   narrow button showing just "+91", opening a search box + scrollable list
   of all ~250 countries. Positioned relative so the panel below can anchor
   to it with a plain `position:absolute` (this page has no modal/overflow-
   clipping ancestor to route around, unlike the portal's version which
   portals to document.body for that reason). */
#support-requests-page .sr-cc-combo {
    position: relative;
    flex: 0 0 auto;
}

#support-requests-page .sr-cc-btn {
    width: auto;
    min-width: 72px;
    text-align: left;
    cursor: pointer;
    background: white;
}

#support-requests-page .sr-cc-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 260px;
    max-width: 80vw;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 50;
    overflow: hidden;
}

#support-requests-page .sr-cc-search {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.7rem;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 0.88rem;
    font-family: inherit;
    background: #fafafa;
}

#support-requests-page .sr-cc-search:focus {
    outline: none;
}

#support-requests-page .sr-cc-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    max-height: 220px;
    overflow-y: auto;
}

#support-requests-page .sr-cc-option {
    /* Was a single-line flex row (name left, code/date right) with the name
       forced onto one line via nowrap+ellipsis below — fine for a short
       "+91"-style code, but a long course name plus its date range just got
       clipped/hidden entirely ("GOD LIKE SELF CULTIV…", no date at all).
       Stacking name above sublabel and letting both wrap uses the option
       row's full width/height instead of squeezing everything onto one
       line — Lavanya, 2026-09-14: "use the card to use full room space so
       it is visible". */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
}

#support-requests-page .sr-cc-option:hover,
#support-requests-page .sr-cc-option-highlighted {
    background: #f0f4ff;
}

#support-requests-page .sr-cc-option-name {
    white-space: normal;
    overflow-wrap: break-word;
}

#support-requests-page .sr-cc-option-code {
    color: #888;
    font-size: 0.78rem;
}

#support-requests-page .sr-cc-empty {
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    color: #999;
}

/* Searchable Instructor Name picker (Add Student) — reuses the .sr-cc-list/
   .sr-cc-option/.sr-cc-empty option-row styling above; only the wrapper/
   panel are distinct since this combo's trigger is the text input itself
   (full width) rather than a narrow "+91"-style button. */
#support-requests-page .sr-instructor-combo {
    position: relative;
}

#support-requests-page .sr-instructor-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 50;
    overflow: hidden;
}

/* Live duplicate/format check result (Membership Number, Mobile Number,
   Email Address on Add Student) — filled in on blur by
   wireSrDuplicateCheckField, and left empty otherwise. */
#support-requests-page .sr-field-inline-error {
    color: #a71d2a;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

/* Selected-file chips for a multi-photo field (e.g. Upload Expense Sheet's
   "Expense Sheet Photos") — each file the member has picked so far, with a
   remove (×) affordance, since a native multi-file <input> silently
   replaces its whole selection if reopened rather than adding to it. */
#support-requests-page .sr-files-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

#support-requests-page .sr-file-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #f0f4ff;
    border: 1px solid #dbe3fb;
    border-radius: 20px;
    padding: 0.3rem 0.5rem 0.3rem 0.75rem;
    font-size: 0.78rem;
    color: #444;
    max-width: 100%;
}

#support-requests-page .sr-file-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

#support-requests-page .sr-file-chip-remove {
    background: none;
    border: none;
    color: #a71d2a;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.1rem 0.2rem;
    flex-shrink: 0;
}

#support-requests-page .sr-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.5rem;
}

#support-requests-page .sr-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#support-requests-page .sr-title {
    font-weight: 700;
    color: #333;
    font-size: 1rem;
}

#support-requests-page .sr-subtitle {
    font-size: 0.85rem;
    color: #777;
    margin-top: 0.2rem;
}

#support-requests-page .sr-meta {
    font-size: 0.78rem;
    color: #999;
    margin-top: 0.4rem;
}

#support-requests-page .sr-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

#support-requests-page .sr-badge-submitted {
    background: #fff3cd;
    color: #856404;
}

#support-requests-page .sr-badge-linked {
    background: #d1e7ff;
    color: #084298;
}

#support-requests-page .sr-badge-closed {
    background: #d4edda;
    color: #1e7e34;
}

#support-requests-page .sr-empty {
    text-align: center;
    padding: 2rem;
    color: #777;
}

#support-requests-page .sr-share-btn {
    background: #e9f5ea;
    color: #1e7e34;
    border: 1px solid #bfe3c4;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

#support-requests-page .sr-detail-btn {
    background: none;
    border: none;
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    padding: 0;
}

#support-requests-page .sr-comments {
    margin-top: 0.75rem;
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
}

#support-requests-page .sr-comment {
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
}

#support-requests-page .sr-comment-requester {
    background: #f0f4ff;
}

#support-requests-page .sr-comment-team {
    background: #f4f4f4;
}

#support-requests-page .sr-comment-author {
    font-size: 0.72rem;
    font-weight: 700;
    color: #888;
    margin-bottom: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* "What you submitted" — the member's own form answers, shown at the top
   of the detail overlay above the comment thread. Previously this data
   (request.fields/entries) was fetched but never rendered anywhere on
   this page. */
#support-requests-page .sr-submitted-fields {
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    background: #f8f9fc;
    border: 1px solid #eceffc;
}

#support-requests-page .sr-submitted-fields-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #888;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* One group per entry — a repeatable form (e.g. Password/Login Codes →
   Grade 1, one row per student) submits several of these; a non-repeatable
   form renders exactly one, untitled group. */
#support-requests-page .sr-submitted-group + .sr-submitted-group {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed #d9deee;
}

#support-requests-page .sr-submitted-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.3rem;
}

#support-requests-page .sr-submitted-field {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.85rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid #eef0f8;
}

#support-requests-page .sr-submitted-group:last-child .sr-submitted-field:last-child {
    border-bottom: none;
}

#support-requests-page .sr-submitted-field-label {
    color: #777;
    flex-shrink: 0;
}

#support-requests-page .sr-submitted-field-value {
    color: #222;
    text-align: right;
    word-break: break-word;
}

/* Per-comment Copy icon — replaces the page-level Share button, which was
   removed (see copySupportRequestSummary/copySupportRequestComment). */
#support-requests-page .sr-copy-comment-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    font-size: 0.78rem;
    flex-shrink: 0;
}

#support-requests-page .sr-copy-comment-btn:hover {
    color: #667eea;
}

#support-requests-page .sr-comment-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

#support-requests-page .sr-comment-form input {
    flex: 1;
}

#support-requests-page .sr-comment-send {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Mobile pass (2026-09-09) — same 768px breakpoint the rest of this app
   uses (main.css). Most of this page already reflows fine (flex-wrap on
   the tabs, width:100%/box-sizing:border-box on every input, a percentage-
   capped detail overlay) once the shrink-to-fit centering bug above is
   fixed - this tightens spacing/sizing so it reads as a native mobile
   layout rather than a shrunk desktop one. */
@media (max-width: 768px) {
    #support-requests-page .sr-card {
        padding: 0.85rem 1rem;
    }

    #support-requests-page .sr-tab {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
    }

    #support-requests-page .sr-title {
        font-size: 0.92rem;
    }

    #support-requests-page .sr-comment-form {
        flex-wrap: wrap;
    }

    #support-requests-page .sr-comment-form input {
        min-width: 100%;
    }

    #support-requests-page .sr-comment-send {
        padding: 0.6rem 1rem;
        width: 100%;
    }

    #support-requests-page .sr-mobile-row {
        flex-wrap: wrap;
    }

    #support-requests-page .sr-cc-combo {
        width: 100%;
    }

    #support-requests-page .sr-cc-btn {
        width: 100%;
    }

    #support-requests-page .sr-cc-panel {
        width: 100%;
        max-width: 100%;
    }

    #support-requests-page .sr-mobile-number {
        min-width: 100%;
    }

    /* The detail overlay and its inner box both carry a fixed inline
       padding (index.html) - inline styles outrank any external
       stylesheet rule regardless of selector specificity, so both need
       !important here to actually shrink on a narrow phone. */
    #srDetailOverlay {
        padding: 10px !important;
    }

    #srDetailOverlay > div {
        padding: 1rem !important;
    }
}
