/* =====================================================================
   CGSCSC  -  Login page only   (load AFTER gov-theme.css)

   Turns the old bordered 3-column login table into a modern card.
   Every asp: control, ID, validator and event stays exactly as it is.
   ===================================================================== */

/* Soft glow behind the card */
#form1 > div > table > tbody > tr > td:last-child:not([colspan]):not(:only-child) {
    padding-top: 16px !important;
    /* the login page has no outer card: the login form itself is the card */
    margin: 0;
    align-self: stretch;
    background-color: transparent !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background-image: radial-gradient(700px 320px at 50% 0, rgba(177,157,212,.28), transparent 70%);
    background-repeat: no-repeat;
}
td[valign] > br:first-child { display: none; }      /* leading <br /> in the content cell */

/* ---------- Card -------------------------------------------------------- */
table[border="1"] {
    display: block !important;
    width: 100% !important;
    max-width: 420px;
    height: auto !important;
    margin: 0 auto !important;
    background: #fff !important;
    border: 0 !important;
    border-radius: 16px;
    box-shadow: 0 14px 34px rgba(79,69,128,.20), 0 2px 6px rgba(79,69,128,.12);
    overflow: hidden;
    text-align: left;
}
table[border="1"] > tbody { display: block; }
table[border="1"] > tbody > tr { display: flex; flex-wrap: wrap; align-items: center; }
table[border="1"] td {
    display: block;
    height: auto !important;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    text-align: left !important;
}

/* title bar */
table[border="1"] > tbody > tr:first-child > td[colspan]:first-child {
    flex: 1 1 100%;
    width: 100% !important;
    padding: 10px 22px;
    background: var(--soft) !important;
    border-bottom: 3px solid var(--accent) !important;
}
span[id$="Label8"] {
    display: inline-block;
    width: auto !important;
    height: auto !important;
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-dark);
}
span[id$="Label8"]::before {
    content: "";
    display: inline-block;
    width: 20px; height: 20px;
    margin-right: 10px;
    vertical-align: -3px;
    background: var(--brand);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z'/></svg>") center / contain no-repeat;
}

/* label | field rows */
table[border="1"] > tbody > tr > td:first-child:not([colspan]) {
    flex: 0 0 36%;
    max-width: 36%;
    padding: 5px 10px 5px 22px;
}
table[border="1"] > tbody > tr > td:first-child:not([colspan]) > span {
    display: block;
    width: auto !important;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
table[border="1"] > tbody > tr > td:nth-child(2) {
    display: flex;
    align-items: center;
    flex: 1 1 0%;
    min-width: 0;
    width: auto !important;
    padding: 5px 22px 5px 0;
    font-size: 0;                                   /* swallows the &nbsp; before the textboxes */
}

/* fields */
table[border="1"] select,
table[border="1"] input[type="text"],
table[border="1"] input[type="password"] {
    flex: 1 1 0%;
    min-width: 0;
    width: auto !important;
    height: 34px;
    box-sizing: border-box;
    padding: 0 10px;
    font-size: 13px !important;
    color: var(--ink);
    background-color: #fff;
    border: 1.5px solid #cfc8ea;
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
table[border="1"] select {
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='%23665b96' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
}
table[border="1"] select:focus,
table[border="1"] input[type="text"]:focus,
table[border="1"] input[type="password"]:focus {
    outline: 0;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(102,91,150,.22);
}
/* The red "*" validators are pinned into the right-hand gutter of the card,
   so a visible/hidden validator never changes the width of its field. */
table[border="1"] > tbody > tr > td:nth-child(2) { position: relative; }
table[border="1"] td > span[id^="RequiredFieldValidator"],
table[border="1"] td > span[id^="Req"] {
    position: absolute;
    right: 9px;
    top: 50%;
    margin-top: -10px;
    font-size: 18px;
    font-weight: 700;
    line-height: 20px;
}

/* ---------- Full-width rows (captcha, alert, buttons) ------------------- */
table[border="1"] > tbody > tr > td[colspan="3"]:first-child { flex: 1 1 100%; width: 100% !important; padding: 0 22px; }

/* captcha */
div[id$="Panel1"] { padding: 12px 0 4px; text-align: center; }
div[id$="Panel1"] img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
span[id$="Label1"] {
    display: block;
    width: auto !important;
    margin: 6px 0;
    font-size: 13px;
    color: var(--muted);
}
input[id$="txtcaptcha"] {
    width: 100% !important;
    max-width: 200px;
    text-align: center;
    letter-spacing: .35em;
    font-weight: 700;
}

/* "someone else is logged in" prompt */
#tblAlert > td {
    margin: 4px 22px 0;
    padding: 14px 16px;
    text-align: center !important;
    background: #fdf0f0 !important;
    border-left: 4px solid var(--danger) !important;
    border-radius: 8px;
}
span[id$="lblalert"] { font-size: 14px !important; line-height: 1.6; color: var(--danger) !important; }
input[id$="btnOk"], input[id$="btnCancel"] {
    min-width: 84px;
    height: 36px;
    margin: 10px 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--brand);
    border: 0;
    border-radius: 8px;
}
input[id$="btnCancel"] { color: var(--brand); background: #fff; border: 1.5px solid var(--brand); }

/* sign-in button + forgot password */
table[border="1"] > tbody > tr:last-child > td[colspan]:first-child {
    display: flex;
    flex-direction: column;
    padding: 10px 22px 18px;
    font-size: 0;                                   /* swallows the &nbsp; between button and link */
}
input[id$="btnLogin"] {
    width: 100% !important;
    height: 38px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .3px;
    color: #fff !important;
    background: var(--brand) !important;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 5px 14px rgba(102,91,150,.38);
    transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
}
input[id$="btnLogin"]:hover  { background: var(--brand-dark) !important; filter: none; }
input[id$="btnLogin"]:active { transform: translateY(1px); box-shadow: 0 2px 6px rgba(102,91,150,.38); }
input[id$="btnLogin"]:focus  { outline: 3px solid var(--accent); outline-offset: 2px; }
a[id$="lbForgetPwd"] {
    align-self: center;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--link);
    text-decoration: none;
}
a[id$="lbForgetPwd"]:hover { text-decoration: underline; }

/* ---------- Messages under the card -------------------------------------- */
span[id$="lblLoginMsg"] { display: block; box-sizing: border-box; max-width: 480px; margin: 14px auto 0; }
span[id$="lblLoginMsg"]:empty { display: none; }
span[id$="lblLoginMsg"]:not(:empty) {
    padding: 12px 16px;
    font-size: 14px;
    font-style: normal !important;
    font-weight: 600 !important;
    color: var(--danger) !important;
    background: #fdf0f0;
    border-left: 4px solid var(--danger);
    border-radius: 8px;
    text-align: left;
}
td[valign] > table:not([border="1"]) {
    display: block !important;
    width: 100% !important;
    max-width: 480px;
    margin: 10px auto 0;
}
td[valign] > table:not([border="1"]) tbody, td[valign] > table:not([border="1"]) tr, td[valign] > table:not([border="1"]) td { display: block; width: 100% !important; }
div[id$="ValidationSummary1"] {
    width: auto !important;
    height: auto !important;
    padding: 4px 8px;
    font-size: 14px !important;
    font-style: normal !important;
    color: var(--danger) !important;
}

/* ---------- Phone -------------------------------------------------------- */
@media (max-width: 560px) {
    #form1 > div > table > tbody > tr > td:last-child:not([colspan]):not(:only-child) { padding: 20px 12px 28px !important; }
    table[border="1"] > tbody > tr:first-child > td[colspan]:first-child { padding: 16px 20px; }
    table[border="1"] > tbody > tr > td:first-child:not([colspan]) { flex: 1 1 100%; max-width: 100%; padding: 12px 20px 0; }
    table[border="1"] > tbody > tr > td:nth-child(2)             { flex: 1 1 100%; padding: 6px 20px 4px; }
    table[border="1"] > tbody > tr > td[colspan="3"]:first-child { padding: 0 20px; }
    table[border="1"] > tbody > tr:last-child > td[colspan]:first-child { padding: 16px 20px 24px; }
}
