/* ===================================================================
   ESBDPortal - Site Stylesheet
   Modern, professional design inspired by the ESBD brand.
   Neutral surfaces with ESBD blue + cyan accents.
   =================================================================== */

:root {
    --esbd-blue: #2f6fe0;
    --esbd-blue-dark: #1f57c4;
    --esbd-cyan: #1fb6d4;
    --esbd-cyan-light: #4fc3d0;
    --esbd-ink: #2c3340;
    --esbd-ink-soft: #55606f;
    --esbd-muted: #8a94a3;
    --esbd-bg: #f4f6f9;
    --esbd-surface: #ffffff;
    --esbd-border: #e4e8ee;
    --esbd-shadow: 0 2px 8px rgba(20, 35, 61, 0.06);
    --esbd-shadow-hover: 0 8px 22px rgba(20, 35, 61, 0.12);
}

/* --- Navbar (light, matches public site) --- */
.navbar-portal {
    background-color: var(--esbd-surface);
    border-bottom: 1px solid var(--esbd-border);
    box-shadow: 0 1px 4px rgba(20, 35, 61, 0.05);
    padding-top: 0;
    padding-bottom: 0;
    min-height: 62px;
}

.navbar-portal-brand {
    display: flex;
    align-items: center;
    padding: 8px 20px 8px 4px;
}

.navbar-portal-brand img {
    height: 36px;
    width: auto;
    transition: opacity 0.2s ease-in-out;
}

.navbar-portal-brand:hover img {
    opacity: 0.85;
}

.navbar-portal-link {
    color: var(--esbd-ink-soft) !important;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 20px 16px !important;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s ease-in-out;
}

.navbar-portal-link::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 12px;
    height: 2px;
    background: linear-gradient(90deg, var(--esbd-blue), var(--esbd-cyan));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease-in-out;
}

.navbar-portal-link:hover,
.navbar-portal-link:focus,
.navbar-portal-link.active {
    color: var(--esbd-blue) !important;
    background-color: transparent;
}

.navbar-portal-link:hover::after,
.navbar-portal-link:focus::after,
.navbar-portal-link.active::after {
    transform: scaleX(1);
}

.navbar-portal .navbar-toggler {
    border-color: var(--esbd-border);
}

.navbar-portal .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2844, 51, 64, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-portal-dropdown {
    background-color: var(--esbd-surface);
    border: 1px solid var(--esbd-border);
    border-radius: 8px;
    box-shadow: var(--esbd-shadow);
    min-width: 180px;
    padding: 6px 0;
    margin-top: 0 !important;
}

.navbar-portal-dropdown-item {
    color: var(--esbd-ink-soft) !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 18px;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.navbar-portal-dropdown-item:hover,
.navbar-portal-dropdown-item:focus {
    color: var(--esbd-blue) !important;
    background-color: #eef4ff;
}

.navbar-portal-dropdown .dropdown-divider {
    border-color: var(--esbd-border);
}

/* --- Base --- */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--esbd-bg);
    color: var(--esbd-ink-soft);
}

/* --- Headings --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--esbd-ink);
    font-weight: 700;
    letter-spacing: -0.01em;
}

h1, h2 {
    text-transform: uppercase;
    letter-spacing: 0.01em;
}

hr {
    border-top: 1px solid var(--esbd-border);
    opacity: 1;
}

/* --- Links --- */
a {
    color: var(--esbd-blue);
    text-decoration: none;
}

a:hover {
    color: var(--esbd-blue-dark);
}

/* --- Focus Styles --- */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.2rem rgba(47, 111, 224, 0.35);
}

.form-control:focus, .form-select:focus {
    border-color: var(--esbd-blue);
    box-shadow: 0 0 0 0.2rem rgba(47, 111, 224, 0.15);
}

/* --- Buttons --- */
/* Primary button - use for the main action on the page (1 Primary, rest Secondary) */
.btn-primary {
    color: #fff;
    background-color: var(--esbd-blue);
    border-color: var(--esbd-blue);
}

.btn-primary:hover {
    color: #fff;
    background-color: var(--esbd-blue-dark);
    border-color: var(--esbd-blue-dark);
}

.btn-primary:active, .btn-primary:focus {
    background-color: var(--esbd-blue-dark);
    border-color: var(--esbd-blue-dark);
}

/* Secondary button - use for all other actions */
.btn-secondary {
    color: #333;
    background-color: #f0f0f0;
    border-color: #ccc;
}

.btn-secondary:hover {
    color: #333;
    background-color: #e0e0e0;
    border-color: #adadad;
}

.btn-secondary:active, .btn-secondary:focus {
    background-color: #d4d4d4;
    border-color: #8c8c8c;
}

/* Danger button */
.btn-danger {
    color: #fff;
    background-color: #d9534f;
    border-color: #d43f3a;
}

.btn-danger:hover {
    color: #fff;
    background-color: #c9302c;
    border-color: #ac2925;
}

/* Button transition for smooth hover effect */
.btn {
    transition: all 0.2s ease-in-out;
    border-radius: 6px;
    font-weight: 600;
}

/* --- Layout --- */
.border-top {
    border-top: 1px solid #e5e5e5;
}

.border-bottom {
    border-bottom: 1px solid #e5e5e5;
}

.box-shadow {
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
    font-size: 0.85rem;
}

/* --- Navbar --- */
.navbar-brand {
    white-space: normal;
    display: flex;
    align-items: center;
}

.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
    color: #fff;
    background-color: #337ab7;
    border-color: #2e6da4;
}

/* --- Tables --- */
.table {
    font-size: 0.8rem;
    border-collapse: collapse;
    margin-bottom: 0;
}

/* Table header - dark, bold, tight */
.table thead th {
    background-color: #2c3340;
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: none;
    padding: 8px 10px;
    vertical-align: middle;
    white-space: nowrap;
}

.table thead th a {
    color: #fff;
    text-decoration: none;
}

.table thead th a:hover {
    color: #cce0ff;
    text-decoration: underline;
}

/* Body rows — compact, clean */
.table tbody td {
    padding: 5px 10px;
    vertical-align: middle;
    border-top: 1px solid #e8eaed;
    border-bottom: none;
    color: #333;
}

/* Stripe: disabled — all rows white */
.table-striped > tbody > tr:nth-of-type(odd) > *,
.table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: #ffffff;
}

/* Hover: clear highlight like the screenshot */
.table-hover > tbody > tr:hover > * {
    background-color: #eef3fb !important;
    color: #111;
}

/* Wrap the table for a card-like border */
.table-responsive,
.table-wrapper {
    border: 1px solid var(--esbd-border);
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--esbd-surface);
    box-shadow: var(--esbd-shadow);
}

/* Sortable table styles */
.sortable th {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.sortable th:hover {
    background-color: #1e2530;
}

.sortable th::after {
    content: '\2195';
    position: absolute;
    right: 8px;
    opacity: 0.35;
    font-size: 0.7rem;
}

.sortable th.sort-asc::after {
    content: '\2191';
    opacity: 1;
}

.sortable th.sort-desc::after {
    content: '\2193';
    opacity: 1;
}

/* No-sort column: hide the sort indicator */
.sortable th.no-sort {
    cursor: default;
}

.sortable th.no-sort::after {
    content: '';
}

/* --- Action Links in Tables --- */
.table-action-link {
    color: #337ab7;
    text-decoration: none;
    font-size: 0.78rem;
    white-space: nowrap;
}

.table-action-link:hover {
    color: #1a5276;
    text-decoration: underline;
}

.table-action-delete {
    color: #c0392b;
}

.table-action-delete:hover {
    color: #922b21;
}

/* --- Action Icons in Tables --- */
.action-icon {
    width: 18px;
    height: 18px;
    margin: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.action-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* --- Cards --- */
.card {
    border: 1px solid var(--esbd-border);
    border-radius: 10px;
    background-color: var(--esbd-surface);
    box-shadow: var(--esbd-shadow);
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.card:hover {
    box-shadow: var(--esbd-shadow-hover);
}

/* Subtle brand accent bar helper for feature/section cards */
.card-accent {
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--esbd-blue), var(--esbd-cyan)) 1;
}

/* --- Forms --- */
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* --- Alerts --- */
.alert {
    font-size: 0.9rem;
}

/* --- Login Page --- */
.login-container {
    max-width: 400px;
    margin: 0 auto;
}

/* ================================================================
   Status & Activity Pills (shared: Scan, Audit Trail,
   Site Detail, Box History modal)
   ================================================================ */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.70rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}

.pill-in           { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.pill-checked-out  { background: #fff3cd; color: #856404; border-color: #ffc107; }
.pill-running-late { background: #fde8e8; color: #9b1c1c; border-color: #f87171; }
.pill-on-time      { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.pill-late         { background: #fde8e8; color: #9b1c1c; border-color: #f87171; }
.pill-correction   { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.pill-activity-out { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.pill-activity-in  { background: #ccfbf1; color: #0f766e; border-color: #5eead4; }

/* ── Summary cards (Site Detail) ───────────────────────────────────────── */
.summary-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 18px 20px;
    text-align: center;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    height: 100%;
}

.summary-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    border-color: #adb5bd;
}

.summary-card-active {
    border-color: #337ab7;
    box-shadow: 0 0 0 2px rgba(51,122,183,.25);
}

.summary-card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: #2c3340;
}

.summary-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin-top: 4px;
}

.summary-card-in   { border-left: 4px solid #10b981; }
.summary-card-out  { border-left: 4px solid #f59e0b; }
.summary-card-late { border-left: 4px solid #ef4444; }

/* Late row highlight in box tables */
.table-row-late td {
    background-color: #fff5f5 !important;
    color: #9b1c1c;
}