/*
 * Employee Management System - application styles
 * Loaded after Bootstrap 5.3.9 (assets/css/bootstrap.min.css).
 */

:root {
    --app-navy: #1e2a3b;
    --app-navy-light: #2b3a50;
    --app-primary: #2563eb;
    --app-primary-dark: #1d4ed8;
    --app-bg: #f4f6f9;
    --app-surface: #ffffff;
    --app-border: #e3e7ee;
    --app-text: #1f2937;
    --app-muted: #6b7280;

    /* Align Bootstrap's primary colour with the app palette */
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: #2563eb;
    --bs-link-color-rgb: 37, 99, 235;
    --bs-link-hover-color: #1d4ed8;
    --bs-link-hover-color-rgb: 29, 78, 216;
    --bs-body-bg: #f4f6f9;
    --bs-body-color: #1f2937;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--app-bg);
    color: var(--app-text);
}

/* ---------- Top navigation ---------- */

.app-navbar {
    background-color: var(--app-navy);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.app-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.45rem;
    border-radius: 0.375rem;
    background-color: var(--app-primary);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.78);
    font-weight: 500;
    border-radius: 0.375rem;
    padding: 0.45rem 0.85rem;
    margin: 0.1rem 0.15rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
    color: #ffffff;
    background-color: var(--app-navy-light);
}

.app-navbar .nav-link.active,
.app-navbar .nav-link.active:hover {
    color: #ffffff;
    background-color: var(--app-primary);
}

/* ---------- Main content ---------- */

.app-main {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.page-header h1,
.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
}

.card {
    border-color: var(--app-border);
    border-radius: 0.6rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.table > thead th {
    background-color: #f8fafc;
    color: var(--app-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.table td,
.table th {
    vertical-align: middle;
}

.form-label {
    font-weight: 500;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-dark);
    --bs-btn-hover-border-color: var(--app-primary-dark);
    --bs-btn-active-bg: var(--app-primary-dark);
    --bs-btn-active-border-color: var(--app-primary-dark);
}

/* ---------- Footer ---------- */

.app-footer {
    background-color: var(--app-surface);
    border-top: 1px solid var(--app-border);
    color: var(--app-muted);
    font-size: 0.875rem;
    padding: 1rem 0;
}

/* ---------- Small screens ---------- */

@media (max-width: 575.98px) {
    .app-main {
        padding-top: 1.25rem;
    }

    .app-brand-text {
        font-size: 1rem;
    }
}

/* =====================================================================
 * CF2018 legacy markup styles (cf2018-app only)
 * cftable/cfcol and XML cfform generate their own HTML, which cannot
 * take Bootstrap classes directly. These rules make that generated
 * markup match the Bootstrap table and form styles used in migrated-app.
 * ===================================================================== */

/* ---------- cftable / cfcol output (wrap in .legacy-table) ---------- */

.legacy-table table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
    color: var(--app-text);
    background-color: var(--app-surface);
}

.legacy-table th,
.legacy-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
}

.legacy-table th {
    background-color: #f8fafc;
    color: var(--app-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.legacy-table tr:last-child td {
    border-bottom: 0;
}

.legacy-table tr:hover > td {
    background-color: rgba(15, 23, 42, 0.04);
}

/* ---------- XML cfform / cfformgroup output (wrap in .legacy-xml-form) ---------- */

.legacy-xml-form .cfform {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
}

.legacy-xml-form table {
    width: 100%;
    border-collapse: separate;
}

.legacy-xml-form td {
    padding: 0.35rem 0.5rem 0.35rem 0;
    vertical-align: middle;
}

.legacy-xml-form .cfLabelTitle,
.legacy-xml-form label {
    font-weight: 500;
    color: var(--app-text);
    text-align: left;
}

.legacy-xml-form .cfRequiredLabelIndicator {
    color: #dc3545;
}

/* cfformgroup label column ("Name") */
.legacy-xml-form td[rowspan] {
    color: var(--app-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.legacy-xml-form td[rowspan] .cfRequiredLabelIndicator {
    display: none;
}

/* cfinput text fields styled like .form-control */
.legacy-xml-form .cfInput {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--app-text);
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.legacy-xml-form .cfInput:focus {
    border-color: #86a8f3;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

/* cfinput submit button styled like .btn .btn-primary */
.legacy-xml-form .cfButton {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #ffffff;
    background-color: var(--app-primary);
    border: 1px solid var(--app-primary);
    border-radius: 0.375rem;
    cursor: pointer;
    margin-top: 0.75rem;
}

.legacy-xml-form .cfButton:hover,
.legacy-xml-form .cfButton:focus {
    background-color: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
}

/* Stack the generated form tables on small screens */
@media (max-width: 767.98px) {
    .legacy-xml-form table,
    .legacy-xml-form tbody,
    .legacy-xml-form tr,
    .legacy-xml-form td {
        display: block;
        width: 100% !important;
    }

    .legacy-xml-form td {
        padding-right: 0;
    }
}
