/*
 * CSG portal theme: spacing and polish on top of Bootswatch Flatly 3.3.
 * Loaded after main.css on every page (see _Header.php, not_logged_in.php, password_reset.php).
 */

:root {
    --csg-navy: #2c3e50;
    --csg-teal: #18bc9c;
    --csg-page: #eef1f5;
    --csg-card: #ffffff;
    --csg-border: #dde3ea;
    --csg-muted: #6b7785;
    --csg-radius: 8px;
}

body {
    background: var(--csg-page);
    color: #2c3e50;
}

/* ---------- Navbar ---------- */
.navbar.navbar-default {
    border: 0;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.navbar-default .navbar-brand {
    font-weight: 600;
    letter-spacing: 0.2px;
}

.navbar-default .navbar-text {
    color: #b8c4d0;
    margin-right: 12px;
}

.navbar .navbar-btn {
    border-radius: 6px;
}

/* ---------- Page card ---------- */
#wrap > .container {
    background: var(--csg-card);
    border: 1px solid var(--csg-border);
    border-radius: var(--csg-radius);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
    margin-top: 28px;
    margin-bottom: 32px;
    padding: 8px 28px 28px;
}

/* The page markup puts headings and content in Bootstrap .row elements;
   inside the card those negative margins would push content into the padding. */
#wrap > .container > .row {
    margin-left: 0;
    margin-right: 0;
}

#wrap > .container h3 {
    font-weight: 600;
    margin: 18px 0 18px;
}

#wrap > .container h4 {
    font-weight: 600;
    color: var(--csg-navy);
    margin: 26px 0 12px;
}

.text-muted {
    color: var(--csg-muted);
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: 6px;
}

.btn .glyphicon {
    margin-right: 4px;
}

/* Never let neighbouring buttons or inline forms touch */
.btn + .btn,
.btn + form,
form + .btn,
form + form,
.btn + a.btn {
    margin-left: 6px;
}

td .btn {
    margin: 2px 0;
}

td form[style*="inline"] {
    margin-right: 2px;
}

td[style*="nowrap"] > form,
td:last-child > form {
    display: inline-block;
}

/* ---------- List page toolbar ---------- */
.csg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.csg-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.csg-actions .btn + .btn {
    margin-left: 0;
}

.csg-manage {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
    background: #f6f8fa;
    border: 1px solid var(--csg-border);
    border-radius: var(--csg-radius);
}

.csg-manage .csg-manage-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--csg-muted);
    margin-right: 4px;
}

.csg-manage .btn + .btn {
    margin-left: 0;
}

.csg-manage .btn-default {
    background: #fff;
    color: var(--csg-navy);
    border: 1px solid var(--csg-border);
}

.csg-manage .btn-default:hover,
.csg-manage .btn-default:focus {
    background: var(--csg-navy);
    border-color: var(--csg-navy);
    color: #fff;
}

.csg-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.csg-search .form-group {
    margin: 0;
}

.csg-search .btn + .btn {
    margin-left: 0;
}

.csg-search input[type="text"] {
    min-width: 240px;
}

/* ---------- Inline forms (Create New Location / Requester / etc.) ---------- */
.form-inline .form-group {
    margin: 0 14px 12px 0;
    vertical-align: bottom;
}

.form-inline .form-group > label {
    display: block;
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--csg-muted);
}

.form-inline .checkbox {
    margin: 0 16px 12px 0;
    vertical-align: bottom;
    line-height: 34px;
}

.form-inline .checkbox label {
    font-weight: 600;
}

.form-inline > .btn {
    margin: 0 0 12px;
    vertical-align: bottom;
}

/* ---------- Tables ---------- */
.table {
    background: #fff;
}

.table > thead > tr > th {
    background: #f6f8fa;
    color: var(--csg-navy);
    font-size: 13px;
    font-weight: 700;
    border-bottom: 2px solid var(--csg-border);
    vertical-align: bottom;
}

.table-bordered,
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > td {
    border-color: var(--csg-border);
}

.table > tbody > tr > td {
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #fafbfc;
}

.table-hover > tbody > tr:hover,
.table-striped > tbody > tr:hover {
    background-color: #f1f6f9;
}

/* Grid pages (Edit Locations / Requesters / Work Items...) set an inline
   min-width; let their card use the window width instead of the fixed 1170px
   so the editable tables fit, and scroll sideways only if the window is narrow. */
#wrap > .container[style*="min-width"] {
    width: auto;
    max-width: 1600px;
    min-width: 0 !important;
    margin-left: 24px;
    margin-right: 24px;
    overflow-x: auto;
}

@media (min-width: 1648px) {
    #wrap > .container[style*="min-width"] {
        margin-left: auto;
        margin-right: auto;
    }
}

/* Editable grids (Edit Locations / Requesters / Work Items...) */
.table input[name="Name"] { min-width: 140px; }
.table input[name="email"],
.table input[name="Email"] { min-width: 190px; }
.table input[name="Description"] { min-width: 180px; }
.table input[name="Address"] { min-width: 150px; }
.table input[name="Phone"],
.table input[name="Mobile"],
.table input[name="MobilePhone"] { min-width: 112px; }
.table input[name="State"] { min-width: 52px; width: 60px; }
.table input[name="ZipCode"] { min-width: 72px; }
.table input[name="District"] { min-width: 64px; }
.table td:last-child { white-space: nowrap; }
/* Requesters has the widest grid: let its three action buttons wrap */
.table td:last-child:has(input[value="send_password_reset"]) {
    white-space: normal !important;
    min-width: 175px;
}
.table select[name="is_admin"] { width: 125px !important; }
.table select[name="District"] { width: 135px !important; }
.table select[name="user_active"] { width: 95px !important; }
.table .form-control {
    height: 32px;
    padding: 4px 8px;
    font-size: 13px;
    min-width: 70px;
}

.table select.form-control {
    padding: 4px 6px;
}

.table-condensed > tbody > tr > td {
    padding: 6px 8px;
}

.label {
    border-radius: 10px;
    padding: 3px 8px;
    font-weight: 600;
}

/* ---------- Alerts ---------- */
.alert {
    border-radius: var(--csg-radius);
    margin-top: 10px;
}

/* ---------- Big create form ---------- */
.csg-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--csg-muted);
    margin: 0 0 4px;
}

.form-control {
    border-radius: 6px;
}

.input-lg,
select.input-lg {
    font-size: 16px;
}

/* ---------- View page ---------- */
.row.well,
.well {
    background: #f6f8fa;
    border: 1px solid var(--csg-border);
    border-radius: var(--csg-radius);
    box-shadow: none;
    margin-left: 0;
    margin-right: 0;
}

.well h4 {
    margin: 16px 0 6px !important;
    font-size: 15px;
}

.well [class*="col-"] > h4:first-child,
.well [class*="col-"] > div:first-child {
    margin-top: 0 !important;
}

/* Deadline / Urgent / Billable headings use inline 18px; match the other h4s */
.well div[style*="font-size: 18px"] {
    font-size: 15px !important;
    font-weight: 600;
    color: var(--csg-navy);
    margin: 0 0 6px !important;
}

/* ---------- Footer ---------- */
#footer {
    background: #fff;
    border-top: 1px solid var(--csg-border);
    color: var(--csg-muted);
    font-size: 13px;
}

/* ---------- Sign-in / password reset ---------- */
.form-signin img {
    display: block;
    max-width: 100%;
    margin: 0 auto 18px;
}

.form-signin .form-signin-heading {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 16px;
}

.form-signin {
    background: #fff;
    border: 1px solid var(--csg-border);
    border-radius: var(--csg-radius);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
    margin-top: 40px;
    padding: 24px 28px;
}

/* ---------- Requester login status / bulk send ---------- */
.csg-login-status {
    font-size: 12px;
    margin-top: 4px;
    white-space: nowrap;
}

.csg-callout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: #eaf6fb;
    border: 1px solid #bfe3f2;
    border-radius: var(--csg-radius);
    color: var(--csg-navy);
}

/* ---------- Email log ---------- */
.csg-email-status-sent { color: #18bc9c; font-weight: 600; }
.csg-email-status-failed { color: #e74c3c; font-weight: 600; }
