/* ============================================================
   ROOT THEME TOKENS
   ============================================================ */
:root {
    --brand-gradient-start: #005885; /* Sapphire Blue */
    --brand-gradient-end: #6a7c1c;   /* Olive Green */
    --brand-dark: #0b2239;
    --brand-light: #f5f7fb;
    --primary-color: var(--brand-gradient-start);

    /* Derived values for gradients / effects */
    --primary-rgb: 0, 88, 133;         /* Sapphire Blue RGB */
    --primary-dark-rgb: 11, 34, 57;    /* Darker brand RGB */
    --white-light: #f5f7fb;
}

/* ============================================================
   GLOBAL
   ============================================================ */
html,
body {
    height: 100%;
}

body {
    background-color: var(--brand-light);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #212529;
    margin: 0;
}

/* Shell for main app (header + content) */
#app-shell {
    display: flex;
    flex-direction: column;
}

/* Main content area (inside master layout) */
.content-body {
    flex: 1 1 auto;
    padding: 1.25rem 1.5rem;
}

/* ============================================================
   HEADER & TOP NAVIGATION
   ============================================================ */
.app-header {
    background:
        linear-gradient(
            135deg,
            rgba(var(--primary-rgb), 0.98),
            rgba(var(--primary-dark-rgb), 0.96),
            rgba(106, 124, 28, 0.94)
        );
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.brand-logo-img {
    max-height: 32px;
    width: auto;
    display: block;
}

.app-header .navbar {
    min-height: 56px;
}

/* Navbar toggler (mobile) */
.navbar-light .navbar-toggler {
    border: none;
}
.navbar-light .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%255,255,255,0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Top nav links in header */
.app-header .navbar-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    color: rgba(241, 245, 249, 0.9);
    font-size: 0.95rem;
    transition: background-color .15s ease, color .15s ease;
    white-space: nowrap;
}

.app-header .navbar-nav .nav-link i {
    font-size: 1.1rem;
}

.app-header .navbar-nav .nav-link:hover {
    background-color: rgba(15, 23, 42, 0.16);
    color: #ffffff;
    text-decoration: none;
}

.app-header .navbar-nav .nav-link.active {
    background-color: rgba(248, 250, 252, 0.16);
    color: #ffffff;
}

/* Admin dropdown menu */
.app-header .dropdown-menu {
    font-size: 0.9rem;
}

/* User avatar dropdown toggle */
.user-dropdown-toggle img {
    border: 2px solid rgba(15, 23, 42, 0.06);
}

/* Page title helper */
.page-title {
    font-weight: 600;
    color: var(--brand-dark);
}

/* ============================================================
   BUTTON SYSTEM — OUTLINE BY DEFAULT
   ============================================================ */
.btn {
    font-weight: 500;
    border-radius: .4rem;
    transition: all .15s ease-in-out;
    font-size: 0.95rem;
}

/* Primary Button (outlined by default) */
.btn-primary {
    background-color: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

button.btn-primary,
a.btn-primary,
input[type="submit"].btn-primary,
input[type="button"].btn-primary {
    background-color: transparent !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

.btn-primary:hover,
.btn-primary:focus,
button.btn-primary:hover,
a.btn-primary:hover,
input[type="submit"].btn-primary:hover,
input[type="button"].btn-primary:hover {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

.btn-primary:active {
    background-color: #003f66 !important;
    border-color: #003f66 !important;
}

/* Secondary (soft outline) */
.btn-secondary {
    background-color: transparent;
    border-color: #6c757d;
    color: #6c757d;
}
.btn-secondary:hover {
    background-color: #6c757d;
    color: #fff;
}

/* Soft Button (SaaS style) */
.btn-soft-primary {
    background: rgba(0, 88, 133, 0.08);
    color: var(--primary-color);
    border-color: rgba(0, 88, 133, 0.25);
}
.btn-soft-primary:hover {
    background: rgba(0, 88, 133, 0.16);
    color: var(--primary-color);
}

/* Danger Button (outlined) */
.btn-danger {
    background-color: transparent;
    border-color: #dc3545;
    color: #dc3545;
}
.btn-danger:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

/* Disabled */
.btn:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* Sizes */
.btn-block {
    width: 100%;
}
.btn-sm {
    padding: .35rem .75rem;
    font-size: .85rem;
}
.btn-lg {
    padding: .75rem 1.25rem;
    font-size: 1.05rem;
}

/* ============================================================
   LINKS & PRIMARY TEXT
   ============================================================ */
.text-primary,
a.text-primary,
.text-primary:hover,
a.text-primary:hover {
    color: var(--primary-color) !important;
}

/* Global anchor styling */
a {
    color: var(--primary-color);
    text-decoration: none;
    background-color: transparent;
}
a:hover,
a:focus {
    color: #003f66;
    text-decoration: underline;
}

/* link-primary overridden to theme */
.link-primary {
    color: var(--brand-gradient-start) !important; /* Sapphire Blue */
    text-decoration-color: var(--brand-gradient-start) !important;
}
.link-primary:hover,
.link-primary:focus {
    color: #003f66 !important;
    text-decoration-color: #003f66 !important;
}

/* ============================================================
   GENERIC NAV-LINK (tabs, pills, pagination, etc.)
   ============================================================ */
.nav-link {
    display: block;
    padding: var(--bs-nav-link-padding-y) var(--bs-nav-link-padding-x);
    font-size: var(--bs-nav-link-font-size);
    font-weight: var(--bs-nav-link-font-weight, 500);
    color: var(--primary-color);
    text-decoration: none;
    background-color: transparent;
    border: 0;
    transition:
        color .15s ease-in-out,
        background-color .15s ease-in-out,
        border-color .15s ease-in-out;
}

.nav-link:hover,
.nav-link:focus {
    color: #003f66;
    text-decoration: none;
    background-color: rgba(0, 88, 133, 0.06);
}

.nav-link.disabled,
.nav-link:disabled {
    color: rgba(148, 163, 184, 0.9);
}

/* Nav-pills active */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    color: #fff;
    background: linear-gradient(
        135deg,
        var(--brand-gradient-start),
        var(--brand-gradient-end)
    );
}

/* Nav-tabs active border */
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: var(--brand-dark);
    border-color: var(--brand-gradient-start) var(--brand-gradient-start) #fff;
}

/* ============================================================
   CARDS, TABLES & PROGRESS
   ============================================================ */
.card {
    border-radius: .75rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Small progress bar */
.progress.progress-sm {
    height: 0.5rem;
    border-radius: 999px;
}
.progress.progress-sm .progress-bar {
    border-radius: 999px;
}

/* Progress bar theme */
.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    background-image: linear-gradient(
        90deg,
        var(--brand-gradient-start),
        var(--brand-gradient-end)
    );
    transition: var(--bs-progress-bar-transition);
}

/* Optional striped theme */
.progress-bar.progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(0, 88, 133, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(0, 88, 133, 0.15) 50%,
        rgba(0, 88, 133, 0.15) 75%,
        transparent 75%,
        transparent
    );
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   FORM FOCUS STATE — THEME COLORS ONLY
   ============================================================ */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-gradient-start) !important;
    outline: none !important;
    box-shadow:
        0 0 0 0.15rem rgba(0, 88, 133, 0.30),
        0 0 6px rgba(106, 124, 28, 0.20) !important;
}

/* Form-select hover (slight border emphasis) */
.form-select:hover {
    border-color: rgba(0, 88, 133, 0.9);
}

/* ============================================================
   CHECKBOX / RADIO — THEMED
   ============================================================ */
.form-check-input:checked {
    background-color: var(--brand-gradient-start) !important;
    border-color: var(--brand-gradient-start) !important;
}

.form-check-input:hover {
    border-color: var(--brand-gradient-start) !important;
}

.form-check-input:focus {
    border-color: var(--brand-gradient-start) !important;
    outline: 0 !important;
    box-shadow:
        0 0 0 0.15rem rgba(0, 88, 133, 0.25),
        0 0 0 0.25rem rgba(106, 124, 28, 0.12) !important;
}

.form-check-input:disabled:checked {
    background-color: rgba(0, 88, 133, 0.45) !important;
    border-color: rgba(0, 88, 133, 0.45) !important;
}

/* ============================================================
   AUTH PAGES (LOGIN / REGISTER)
   ============================================================ */
.auth-page-wrapper {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(
            1200px 600px at -10% -10%,
            rgba(var(--primary-rgb), 0.06),
            transparent 40%
        ),
        radial-gradient(
            1200px 600px at 110% 110%,
            rgba(var(--primary-dark-rgb), 0.06),
            transparent 40%
        ),
        var(--white-light);
}

.auth-logo {
    max-height: 60px;
    width: auto;
}

/* Login & register card tweaks */
.card.shadow.border-0.rounded,
.card.shadow.border-0.rounded-3 {
    border-radius: .85rem !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .content-body {
        padding: 1rem;
    }

    .app-header .navbar-nav .nav-link {
        margin-bottom: .25rem;
        border-radius: .4rem;
    }
}

@media (max-width: 575.98px) {
    .brand-logo-img {
        max-height: 28px;
    }

    .auth-page-wrapper {
        padding: 1rem;
    }
}

.btn-outline-primary {
    --bs-btn-color: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);

    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--primary-color);
    --bs-btn-hover-border-color: var(--primary-color);

    --bs-btn-focus-shadow-rgb: var(--primary-rgb);

    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--primary-color);
    --bs-btn-active-border-color: var(--primary-color);
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);

    --bs-btn-disabled-color: var(--primary-color);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--primary-color);

    --bs-gradient: none;
}
.highlight-row {
    background-color: #fff3cd !important;
    transition: background-color 1s ease;
}

/* ============================================================
   SELECTPICKER — MATCH INPUTS (SINGLE BOX)
   ============================================================ */

/* 1) Wrapper should be transparent (NO border, NO padding) */
.bootstrap-select.form-control,
.bootstrap-select.form-control.form-control-sm {
    border: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Ensure full width like normal inputs */
.bootstrap-select:not(.input-group-btn),
.bootstrap-select.form-control {
    width: 100% !important;
    float: none;
}

/* 2) The REAL input look on the toggle button */
.bootstrap-select > .dropdown-toggle {
    background-color: #fff !important;
    border: var(--bs-border-width) solid var(--bs-border-color) !important;
    border-radius: var(--bs-border-radius);
    width: 100%;
    text-align: left;
    padding: .375rem .75rem !important;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    box-shadow: none !important;
}

/* Small size variant */
.bootstrap-select.form-control-sm > .dropdown-toggle {
    padding: .25rem .5rem !important;
    font-size: .875rem !important;
}

/* 3) Focus / open state (match .form-control:focus) */
.bootstrap-select.show > .dropdown-toggle,
.bootstrap-select > .dropdown-toggle:focus,
.bootstrap-select > .dropdown-toggle:active,
.bootstrap-select > .dropdown-toggle:focus-visible {
    border-color: var(--brand-gradient-start) !important;
    outline: none !important;
    box-shadow:
        0 0 0 0.15rem rgba(var(--primary-rgb), 0.30),
        0 0 6px rgba(106, 124, 28, 0.20) !important;
}

/* 4) Text inside the toggle */
.bootstrap-select .filter-option-inner-inner {
    color: var(--brand-dark);
}

/* 5) Dropdown menu background + shadow */
.bootstrap-select .dropdown-menu {
    background: #fff !important;
    border-radius: .5rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

/* Live search input */
.bootstrap-select .bs-searchbox input {
    border-radius: .5rem !important;
    border-color: rgba(148,163,184,0.4);
}

.bootstrap-select .bs-searchbox input:focus {
    border-color: var(--brand-gradient-start) !important;
    box-shadow:
        0 0 0 0.10rem rgba(var(--primary-rgb), 0.25),
        0 0 4px rgba(106, 124, 28, 0.12) !important;
}

/* ============================================================
   DROPDOWN OPTIONS (Normal, Hover, Selected)
   ============================================================ */

/* Normal option */
.bootstrap-select .dropdown-item {
    padding: .35rem .75rem;
    color: #212529;
    background-color: #fff !important;
}

/* Hover → light background + THEME TEXT COLOR */
.bootstrap-select .dropdown-item:hover,
.bootstrap-select .dropdown-item:focus {
    background-color: rgba(0, 88, 133, 0.08) !important;
    color: var(--brand-gradient-start) !important;
}

/* Selected option (multiselect & single) */
.bootstrap-select .dropdown-item.selected,
.bootstrap-select .dropdown-item.active {
    background-color: rgba(0, 88, 133, 0.12) !important;
    color: var(--brand-gradient-start) !important;
}

/* Check mark color */
.bootstrap-select .dropdown-item.selected .check-mark,
.bootstrap-select .dropdown-item.active .check-mark {
    color: var(--brand-gradient-start) !important;
}

/* ============================================================
   CUSTOM ARROW — Bootstrap-style hollow chevron, slightly thicker
   ============================================================ */

.bootstrap-select .dropdown-toggle::after {
    content: "";
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    background-size: 0.9em;
    background-position: center;
    background-repeat: no-repeat;
    border: none !important;
    vertical-align: middle;

    /* Default arrow (dark grey, slightly thick, hollow) */
    background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'> \
<path d='M2 5l6 6 6-6' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/> \
</svg>");
}

/* Hide bootstrap-select default caret triangle */
.bootstrap-select .dropdown-toggle .bs-caret {
    display: none !important;
}

/* Add spacing so text doesn't overlap arrow */
.bootstrap-select .dropdown-toggle .filter-option {
    padding-right: 1.6rem !important;
}

/* Focus/Active — hollow brand-blue arrow */
.bootstrap-select.show .dropdown-toggle::after,
.bootstrap-select .dropdown-toggle:focus::after {
    background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'> \
<path d='M2 5l6 6 6-6' fill='none' stroke='rgb(0,88,133)' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/> \
</svg>");
}
