/* Custom styles for Construction Management System */

body {
    background-color: #f4f6fb;
    background-image:
        radial-gradient(1200px 600px at 100% 0%, rgba(78,115,223,0.04), transparent 60%),
        radial-gradient(900px 500px at 0% 100%, rgba(28,200,138,0.03), transparent 60%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2d3748;
}

.navbar-brand {
    font-weight: bold;
}

.card {
    border: 1px solid #e3e6f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    transition: all 0.25s ease;
    background: #ffffff;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

.card-header {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fc 100%);
    border-bottom: 1px solid #e3e6f0;
    font-weight: 600;
    color: #39536f;
    padding: 14px 20px;
}

.card-header.bg-primary,
.card-header.bg-success,
.card-header.bg-info,
.card-header.bg-warning,
.card-header.bg-danger {
    color: #fff !important;
    border-bottom: none;
}

/* Reports page: card header titles should be black even on colored backgrounds.
   This overrides the white color rule above for the specific report cards. */
#revenue-card .card-header h5,
.card.border-success > .card-header.text-dark h5,
.card.border-danger > .card-header.text-dark h5,
.card-header.text-dark h5 {
    color: #000 !important;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: #f8f9fc;
    border-top: 1px solid #e3e6f0;
}

/* Disable card hover translate when its dropdown is open to keep dropdown in sync with toggle */
.card.no-hover-transform,
.card.no-hover-transform:hover {
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06) !important;
}

/* Prevent card hover flicker when modal is open */
.modal-open .card:hover {
    transform: none;
}

/* Tables - more polished */
.table {
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
}

.table thead th {
    background: linear-gradient(180deg, #f8f9fc 0%, #eef1f7 100%);
    color: #4a5568;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.6px;
    padding: 14px 12px;
    border-bottom: 2px solid #e3e6f0;
    border-top: none;
}

.table tbody td {
    padding: 12px;
    border-bottom: 1px solid #eef1f7;
    vertical-align: middle;
    color: #2d3748;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: rgba(78,115,223,0.04);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(78,115,223,0.02);
}

.table-bordered {
    border: 1px solid #e3e6f0;
}

.table-responsive {
    margin-top: 20px;
}

/* Buttons - more polished */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1.1rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    border-color: #4e73df;
    box-shadow: 0 1px 3px rgba(78,115,223,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3a5ccc 0%, #1d3da3 100%);
    border-color: #3a5ccc;
    box-shadow: 0 4px 12px rgba(78,115,223,0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #1cc88a 0%, #138d60 100%);
    border-color: #1cc88a;
}

.btn-success:hover {
    background: linear-gradient(135deg, #17a673 0%, #0f7a52 100%);
    border-color: #17a673;
    transform: translateY(-1px);
}

.btn-info {
    background: linear-gradient(135deg, #36b9cc 0%, #258391 100%);
    border-color: #36b9cc;
    color: #fff;
}

.btn-info:hover {
    background: linear-gradient(135deg, #2a96a5 0%, #1d6c78 100%);
    border-color: #2a96a5;
    color: #fff;
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #f6c23e 0%, #dda20a 100%);
    border-color: #f6c23e;
    color: #fff;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #f4b81e 0%, #c7910a 100%);
    color: #fff;
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #e74a3b 0%, #be3c2f 100%);
    border-color: #e74a3b;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #d63c2c 0%, #a02e23 100%);
    border-color: #d63c2c;
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, #858796 0%, #6c6e7e 100%);
    border-color: #858796;
    color: #fff;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #6c6e7e 0%, #565869 100%);
    color: #fff;
    transform: translateY(-1px);
}

.btn-light {
    background: #ffffff;
    border-color: #d1d5e0;
    color: #2d3748;
}

.btn-light:hover {
    background: #f8f9fc;
    border-color: #a0aec0;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.825rem;
    border-radius: 5px;
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 1.05rem;
    border-radius: 8px;
}

.btn-custom {
    margin-right: 10px;
}

/* Forms - more polished */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #d1d5e0;
    padding: 0.55rem 0.85rem;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #2d3748;
}

.form-control:focus,
.form-select:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78,115,223,0.15);
}

.form-label {
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 15px;
}

.input-group-text {
    background: #f8f9fc;
    border-color: #d1d5e0;
    color: #4a5568;
}

.form-check-input {
    border-color: #d1d5e0;
}

.form-check-input:checked {
    background-color: #4e73df;
    border-color: #4e73df;
}

/* Alerts - more polished */
.alert {
    margin-top: 20px;
    border: none;
    border-radius: 8px;
    padding: 0.85rem 1.1rem;
    border-left: 4px solid;
}

.alert-primary {
    background: rgba(78,115,223,0.1);
    color: #2c4a9e;
    border-left-color: #4e73df;
}

.alert-success {
    background: rgba(28,200,138,0.1);
    color: #0f7a52;
    border-left-color: #1cc88a;
}

.alert-info {
    background: rgba(54,185,204,0.1);
    color: #1d6c78;
    border-left-color: #36b9cc;
}

.alert-warning {
    background: rgba(246,194,62,0.1);
    color: #8a6d10;
    border-left-color: #f6c23e;
}

.alert-danger {
    background: rgba(231,74,59,0.1);
    color: #a02e23;
    border-left-color: #e74a3b;
}

/* Badges - more refined */
.badge {
    border-radius: 999px;
    padding: 0.32em 0.65em;
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.3px;
}

.badge.bg-primary {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%) !important;
}

.badge.bg-success {
    background: linear-gradient(135deg, #1cc88a 0%, #138d60 100%) !important;
}

/* Modals - more refined */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #f8f9fc 0%, #eef1f7 100%);
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.5rem;
    color: #2d3748 !important;
}

.modal-header .modal-title {
    color: #2d3748 !important;
    font-weight: 600;
}

.modal-header.bg-primary,
.modal-header.bg-success,
.modal-header.bg-info,
.modal-header.bg-warning,
.modal-header.bg-danger {
    color: #fff !important;
}

.modal-header.bg-primary .modal-title,
.modal-header.bg-success .modal-title,
.modal-header.bg-info .modal-title,
.modal-header.bg-warning .modal-title,
.modal-header.bg-danger .modal-title {
    color: #fff !important;
}

.modal-header .btn-close {
    color: #2d3748;
    filter: none;
}

.modal-header.bg-primary .btn-close,
.modal-header.bg-success .btn-close,
.modal-header.bg-info .btn-close,
.modal-header.bg-warning .btn-close,
.modal-header.bg-danger .btn-close {
    filter: brightness(0) invert(1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: #f8f9fc;
    border-top: 1px solid #e3e6f0;
    padding: 0.85rem 1.5rem;
}

/* Page header */
.page-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%);
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 1px solid #e3e6f0;
    border-left: 4px solid #4e73df;
}

.page-header h1,
.page-header h2 {
    margin: 0;
    color: #2d3748;
    font-weight: 700;
}

/* Footer */
.footer {
    margin-top: 50px;
    padding: 20px 0;
    background-color: #343a40;
    color: white;
    text-align: center;
}

/* Modern Dashboard Styles */
.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.border-left-danger {
    border-left: 0.25rem solid #e74a3b !important;
}

.border-left-secondary {
    border-left: 0.25rem solid #858796 !important;
}

.border-left-dark {
    border-left: 0.25rem solid #5a5c69 !important;
}

.text-xs {
    font-size: 0.7rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-uppercase {
    text-transform: uppercase !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.shadow {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.h-100 {
    height: 100% !important;
}

/* Common Action Dropdown Styles */
.action-dropdown {
    position: relative;
    display: inline-block;
}
.action-dropdown-toggle {
    background: none;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.action-dropdown-toggle:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}
.action-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 9999;
    min-width: 160px;
    padding: 8px 0;
    margin: 2px 0 0;
    font-size: 14px;
    color: #212529;
    text-align: left;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 6px;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.action-dropdown-menu.show {
    display: block;
}

/* Dropdown menus in table cells: use fixed positioning via JS to escape overflow context */
.action-dropdown-menu.dropdown-fixed {
    position: fixed !important;
    z-index: 99999 !important;
}
.action-dropdown-item {
    display: block;
    width: 100%;
    padding: 6px 16px;
    clear: both;
    font-weight: 400;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
}
.action-dropdown-item:hover {
    color: #1e2125;
    background-color: #e9ecef;
}
.action-dropdown-item.text-danger {
    color: #dc3545 !important;
}
.action-dropdown-item.text-danger:hover {
    color: #a71d2a !important;
    background-color: #f8d7da;
}
.action-dropdown-divider {
    height: 0;
    margin: 8px 0;
    overflow: hidden;
    border-top: 1px solid rgba(0,0,0,.15);
}

.no-gutters {
    margin-right: 0;
    margin-left: 0;
}

.no-gutters > .col,
.no-gutters > [class*="col-"] {
    padding-right: 0;
    padding-left: 0;
}

.avatar {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 3rem;
}

.avatar-sm {
    width: 2.25rem !important;
    height: 2.25rem !important;
}

.avatar-title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #6c757d;
    color: #fff;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
}

.rounded-circle {
    border-radius: 50% !important;
}

.action-card {
    transition: all 0.3s ease;
}

.action-card:hover {
    background-color: #f8f9fc;
}

/* Colorful Dashboard Cards */
.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}
.border-left-primary .card-body {
    background: linear-gradient(135deg, #f8f9fc 0%, #e3e6f0 100%);
}
.border-left-primary .text-primary {
    color: #4e73df !important;
}
.border-left-primary .fa-building {
    color: #4e73df !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}
.border-left-success .card-body {
    background: linear-gradient(135deg, #f0fdf4 0%, #d1fae5 100%);
}
.border-left-success .text-success {
    color: #059669 !important;
}
.border-left-success .fa-users {
    color: #10b981 !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}
.border-left-info .card-body {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}
.border-left-info .text-info {
    color: #0891b2 !important;
}
.border-left-info .fa-file-invoice {
    color: #06b6d4 !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}
.border-left-warning .card-body {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
.border-left-warning .text-warning {
    color: #d97706 !important;
}
.border-left-warning .fa-chart-line {
    color: #f59e0b !important;
}

.border-left-secondary {
    border-left: 0.25rem solid #858796 !important;
}
.border-left-secondary .card-body {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}
.border-left-secondary .text-secondary {
    color: #6b7280 !important;
}
.border-left-secondary .fa-user-tie {
    color: #8b5cf6 !important;
}

.border-left-danger {
    border-left: 0.25rem solid #e74a3b !important;
}
.border-left-danger .card-body {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}
.border-left-danger .text-danger {
    color: #dc2626 !important;
}
.border-left-danger .fa-credit-card {
    color: #ef4444 !important;
}

.border-left-dark {
    border-left: 0.25rem solid #5a5c69 !important;
}
.border-left-dark .card-body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}
.border-left-dark .text-dark {
    color: #1e293b !important;
}
.border-left-dark .fa-tools {
    color: #6366f1 !important;
}

.dashboard-card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 10px;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
}

.dashboard-card .card-body {
    padding: 1.5rem;
}

.dashboard-card .text-xs {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.dashboard-card .h5 {
    font-size: 1.5rem;
    font-weight: 700;
}

.dashboard-card .fa-2x {
    font-size: 2rem;
    opacity: 0.8;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.dashboard-card {
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Form field highlighting */
.form-control.has-value,
.form-select.has-value {
    background-color: #d4edda !important; /* light green for entered fields */
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    background-color: #fff3cd !important; /* light yellow for current field */
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

@media (max-width: 768px) {
    .dashboard-card {
        height: auto;
        margin-bottom: 20px;
    }
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand img {
    height: 50px;
    margin-bottom: 10px;
}

.sidebar-brand span {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #fff, #f8f9fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-company {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #b8c6db;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
}

.sidebar-body {
    padding: 15px 0;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav .nav-item {
    margin: 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #b8c6db !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255,255,255,0.1);
    border-left-color: #ffd700;
}

.sidebar-nav .nav-link.active {
    color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.15);
    border-left-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-nav .dropdown-toggle::after {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.sidebar-nav .dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.sidebar-nav .dropdown-menu {
    position: static !important;
    float: none !important;
    width: 100% !important;
    background: rgba(0,0,0,0.2);
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    display: none;
    transform: none !important;
    top: auto !important;
    left: auto !important;
}

.sidebar-nav .dropdown-toggle[aria-expanded="true"] + .dropdown-menu,
.sidebar-nav .show > .dropdown-menu {
    display: block;
}

.sidebar-nav .dropdown-menu .dropdown-item {
    color: #b8c6db !important;
    padding: 10px 20px 10px 50px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.sidebar-nav .dropdown-menu .dropdown-item:hover {
    color: #ffffff !important;
    background: rgba(255,255,255,0.1);
}

.sidebar-nav .dropdown-menu .dropdown-item.active {
    color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.1);
}

.sidebar-nav .dropdown-divider {
    border-color: rgba(255,255,255,0.1);
    margin: 5px 0;
}

/* ====================================================
   GROUPED SIDEBAR MENU (BOQ Enhanced)
   Group headers with collapsible chevrons.
   Yellow highlighter is reserved for the active/clicked
   menu item only — group headers stay muted.
   ==================================================== */

.sidebar-group {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-group-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #b8c6db !important;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
    border-left: 3px solid transparent;
    margin-top: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sidebar-group-header:hover {
    color: #ffffff !important;
    background: rgba(255,255,255,0.08);
}

.sidebar-group-header i:first-child {
    width: 20px;
    margin-right: 10px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-group-header span {
    flex: 1;
}

.sidebar-group-chevron {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.sidebar-group-header[aria-expanded="true"] .sidebar-group-chevron {
    transform: rotate(180deg);
}

/* Group headers do NOT get the yellow highlighter */
.sidebar-group.active > .sidebar-group-header {
    color: #ffffff !important;
    background: rgba(255,255,255,0.05);
    border-left-color: transparent;
}

/* When a parent menu item contains the active page OR its dropdown is open,
   highlight that parent main menu item with the yellow color too. */
.sidebar-group-items .nav-item.dropdown > .nav-link.active,
.sidebar-group-items .nav-item.dropdown.show > .nav-link {
    color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.15);
    border-left-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.sidebar-group-items .nav-item.dropdown > .nav-link.active i,
.sidebar-group-items .nav-item.dropdown.show > .nav-link i {
    color: #ffd700 !important;
}

/* Highlight direct (non-dropdown) main menu items when active */
.sidebar-group-items > .nav-item > .nav-link.active {
    color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.15);
    border-left-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.sidebar-group-items > .nav-item > .nav-link.active i {
    color: #ffd700 !important;
}

.sidebar-group-items {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-group-items.collapse:not(.show) {
    display: none;
}

.sidebar-group-items.collapsing {
    height: auto;
    overflow: hidden;
    transition: height 0.3s ease;
}

.sidebar-group-items .nav-item {
    margin: 0;
}

.sidebar-group-items .nav-link {
    padding-left: 35px !important;
    font-size: 0.85rem;
}

.sidebar-group-items .nav-item.dropdown .nav-link {
    padding-left: 35px !important;
}

.sidebar-group-items .dropdown-menu .dropdown-item {
    padding-left: 60px !important;
}

/* Logout at the bottom of sidebar */
.sidebar-logout {
    margin-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 5px;
}

.sidebar-logout .nav-link {
    color: #ff6b6b !important;
}

.sidebar-logout .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 107, 107, 0.2);
}

/* When sidebar is collapsed (icon-only mode) */
.sidebar.collapsed .sidebar-group-header span,
.sidebar.collapsed .sidebar-group-header .sidebar-group-chevron {
    display: none;
}

.sidebar.collapsed .sidebar-group-header {
    padding: 12px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-group-header i:first-child {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-group-items {
    display: none;
}

.sidebar.collapsed .sidebar-group-items.show {
    display: block;
    position: absolute;
    left: 60px;
    top: 0;
    width: 220px;
    background: #1e3a5f;
    border-radius: 0 8px 8px 0;
    box-shadow: 4px 0 15px rgba(0,0,0,0.2);
    z-index: 1000;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sidebar-group-header {
        padding: 10px 15px;
        font-size: 0.8rem;
    }

    .sidebar-group-items .nav-link {
        padding-left: 25px !important;
    }

    .sidebar-group-items .dropdown-menu .dropdown-item {
        padding-left: 50px !important;
    }
}

/* Content Wrapper */
.content-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease-in-out;
}

/* Top Bar */
.top-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
    padding: 5px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    color: #dc3545;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-logout:hover {
    color: #a71d2a;
}

/* Main Content */
.main-content {
    padding: 20px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 260px;
        transform: translateX(-100%);
    }

    .sidebar.collapsed.show {
        transform: translateX(0);
    }

    /* Show dropdown sub-menus on mobile when sidebar is shown and toggle is expanded */
    .sidebar.collapsed .sidebar-nav .dropdown-toggle[aria-expanded="true"] + .dropdown-menu,
    .sidebar.collapsed .sidebar-nav .show > .dropdown-menu {
        display: block !important;
    }

    /* Ensure sub-menu icons are visible on mobile */
    .sidebar.collapsed .sidebar-nav .dropdown-menu .dropdown-item i {
        display: inline-block !important;
        width: 20px;
        margin-right: 10px;
        text-align: center;
    }

    .content-wrapper {
        margin-left: 0;
    }

    .content-wrapper.sidebar-collapsed {
        margin-left: 0;
    }

    .top-bar {
        display: flex;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 70px;
    }

    .sidebar-toggle {
        display: none;
    }
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header {
    padding: 15px 10px;
}

.sidebar.collapsed .sidebar-brand img {
    height: 35px;
    margin-bottom: 0;
}

.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .sidebar-company {
    display: none;
}

.sidebar.collapsed .sidebar-nav .nav-link {
    padding: 12px 15px;
    justify-content: center;
    border-left: none;
    border-bottom: 3px solid transparent;
}

.sidebar.collapsed .sidebar-nav .nav-link i {
    margin-right: 0;
    font-size: 1.2rem;
}

.sidebar.collapsed .sidebar-nav .nav-link span {
    display: none;
}

.sidebar.collapsed .sidebar-nav .dropdown-toggle::after {
    display: none;
}

.sidebar.collapsed .sidebar-nav .dropdown-menu {
    display: none !important;
}

.sidebar.collapsed .sidebar-toggle-sidebar i {
    transform: rotate(180deg);
}

.content-wrapper.sidebar-collapsed {
    margin-left: 70px;
}

/* Sidebar Toggle Button */
.sidebar-toggle-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #b8c6db;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    gap: 8px;
}

.sidebar-toggle-sidebar:hover {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

.sidebar-toggle-sidebar i {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.sidebar.collapsed .sidebar-toggle-sidebar i {
    transform: rotate(180deg);
}

.sidebar-header {
    position: relative;
}/* ============================================================
   AGGRESSIVE MODAL HEADER OVERRIDE
   Ensures ALL modals use dark text color regardless of
   Bootstrap default styles or page-specific overrides
   ============================================================ */

.modal-header,
.modal-header .modal-title,
.modal-header h1, .modal-header h2, .modal-header h3,
.modal-header h4, .modal-header h5, .modal-header h6,
.modal-header p, .modal-header span:not(.btn-close):not(.visually-hidden) {
    color: #2d3748 !important;
}

.modal-header.bg-primary,
.modal-header.bg-primary .modal-title,
.modal-header.bg-success,
.modal-header.bg-success .modal-title,
.modal-header.bg-info,
.modal-header.bg-info .modal-title,
.modal-header.bg-warning,
.modal-header.bg-warning .modal-title,
.modal-header.bg-danger,
.modal-header.bg-danger .modal-title {
    color: #1a202c !important;
}

.modal-header.bg-primary .modal-title ~ *,
.modal-header.bg-success .modal-title ~ *,
.modal-header.bg-info .modal-title ~ *,
.modal-header.bg-warning .modal-title ~ *,
.modal-header.bg-danger .modal-title ~ * {
    color: #1a202c !important;
}

/* Pastel / light backgrounds for colored modal headers (keep the visual cue
   of the Bootstrap color but use a soft tint with black text/icons/close) */
.modal-header.bg-primary {
    background: linear-gradient(135deg, #e7f0ff 0%, #d6e4ff 100%) !important;
    border-bottom-color: #b8cdff !important;
}
.modal-header.bg-success {
    background: linear-gradient(135deg, #e3f8ef 0%, #d1f0e1 100%) !important;
    border-bottom-color: #a7e2c5 !important;
}
.modal-header.bg-info {
    background: linear-gradient(135deg, #e1f4f8 0%, #cdebf2 100%) !important;
    border-bottom-color: #9cd5e0 !important;
}
.modal-header.bg-warning {
    background: linear-gradient(135deg, #fdf3d7 0%, #fae8b3 100%) !important;
    border-bottom-color: #ecd58a !important;
}
.modal-header.bg-danger {
    background: linear-gradient(135deg, #fbe3e0 0%, #f6cdc8 100%) !important;
    border-bottom-color: #e8a8a0 !important;
}
.modal-header.bg-dark {
    background: linear-gradient(135deg, #e3e6f0 0%, #ced3dc 100%) !important;
    color: #1a202c !important;
    border-bottom-color: #b8bdca !important;
}
.modal-header.bg-secondary {
    background: linear-gradient(135deg, #eaecf1 0%, #d6dae3 100%) !important;
    color: #1a202c !important;
    border-bottom-color: #c2c7d2 !important;
}/* ============================================================
   CUSTOMERS_SITES SPECIFIC OVERRIDE
   Force dark text on Edit Customer modal which has no bg-*
   class but inherits white from somewhere
   ============================================================ */

#editCustomerSiteModal .modal-header,
#editCustomerSiteModal .modal-header .modal-title,
#editCustomerSiteModal .modal-header h5,
#editCustomerSiteModal .modal-header i {
    color: #2d3748 !important;
}

#addCustomerSiteModal .modal-header,
#addCustomerSiteModal .modal-header .modal-title,
#addCustomerSiteModal .modal-header h5,
#addCustomerSiteModal .modal-header h4,
#addCustomerSiteModal .modal-header h3,
#addCustomerSiteModal .modal-header i,
#addCustomerSiteModal .modal-header span,
#addCustomerSiteModal .modal-header *,
#addSiteToExistingCustomerModal .modal-header,
#addSiteToExistingCustomerModal .modal-header .modal-title,
#addSiteToExistingCustomerModal .modal-header h5,
#addSiteToExistingCustomerModal .modal-header h4,
#addSiteToExistingCustomerModal .modal-header h3,
#addSiteToExistingCustomerModal .modal-header i,
#addSiteToExistingCustomerModal .modal-header span,
#addSiteToExistingCustomerModal .modal-header *,
#addSiteModal .modal-header,
#addSiteModal .modal-header .modal-title,
#addSiteModal .modal-header h5,
#addSiteModal .modal-header h4,
#addSiteModal .modal-header h3,
#addSiteModal .modal-header i,
#addSiteModal .modal-header span,
#addSiteModal .modal-header *,
#viewCustomerSiteModal .modal-header,
#viewCustomerSiteModal .modal-header .modal-title,
#viewCustomerSiteModal .modal-header h5,
#viewCustomerSiteModal .modal-header h4,
#viewCustomerSiteModal .modal-header h3,
#viewCustomerSiteModal .modal-header i,
#viewCustomerSiteModal .modal-header span,
#viewCustomerSiteModal .modal-header * {
    color: #2d3748 !important;
    -webkit-text-fill-color: #2d3748 !important;
}

#addCustomerSiteModal .modal-header .btn-close,
#addSiteToExistingCustomerModal .modal-header .btn-close,
#addSiteModal .modal-header .btn-close,
#viewCustomerSiteModal .modal-header .btn-close {
    filter: none !important;
    opacity: 0.7;
    color: #2d3748 !important;
}

#editCustomerSiteModal .modal-header .btn-close {
    filter: none !important;
    opacity: 0.7;
}

/* Also force dark on any modal-header that does NOT have bg-* class */
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) {
    color: #2d3748 !important;
}

.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) .modal-title,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) h1,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) h2,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) h3,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) h4,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) h5,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) h6,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) p,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) i,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) span:not(.btn-close):not(.visually-hidden) {
    color: #2d3748 !important;
}

.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) .btn-close {
    filter: none !important;
    opacity: 0.6;
}

.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) .btn-close:hover {
    opacity: 1;
}/* ============================================================
   NUCLEAR OPTION: Force dark modal text via JS-applied inline styles
   This runs after all CSS to guarantee dark modal titles
   ============================================================ */

.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary),
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) * {
    color: #1a202c !important;
    -webkit-text-fill-color: #1a202c !important;
}

/* Force close button visibility on default modals */
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) .btn-close {
    background: transparent !important;
    filter: none !important;
    opacity: 0.7 !important;
    color: #1a202c !important;
}

.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger):not(.bg-dark):not(.bg-secondary) .btn-close:hover {
    opacity: 1 !important;
}

/* Catch-all for any h5/h4 inside modal-header */
.modal-header,
.modal-header h5,
.modal-header h4,
.modal-header h3,
.modal-header .modal-title,
.modal-header i,
.modal-header p,
.modal-header span:not(.btn-close):not(.visually-hidden),
.modal-header strong,
.modal-header small,
.modal-header *:not(.btn-close):not(.visually-hidden):not(.badge):not(.btn):not(.input-group-text) {
    color: #1a202c !important;
    -webkit-text-fill-color: #1a202c !important;
}

/* Close button (Bootstrap uses SVG background-image; color won't help, force dark via filter + custom dark icon) */
.modal-header .btn-close {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231a202c'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") !important;
    background-size: 1em auto !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    width: 1em !important;
    height: 1em !important;
    padding: 0.5em !important;
    box-sizing: content-box !important;
    filter: none !important;
    opacity: 0.7 !important;
}

.modal-header .btn-close:hover {
    opacity: 1 !important;
}

/* Colored modal-header backgrounds: keep dark text + dark icons (pastel bg makes dark readable) */
.modal-header.bg-primary,
.modal-header.bg-primary h5,
.modal-header.bg-primary h4,
.modal-header.bg-primary h3,
.modal-header.bg-primary .modal-title,
.modal-header.bg-primary i,
.modal-header.bg-primary p,
.modal-header.bg-primary span:not(.btn-close):not(.visually-hidden),
.modal-header.bg-primary strong,
.modal-header.bg-success,
.modal-header.bg-success h5,
.modal-header.bg-success h4,
.modal-header.bg-success h3,
.modal-header.bg-success .modal-title,
.modal-header.bg-success i,
.modal-header.bg-success p,
.modal-header.bg-success span:not(.btn-close):not(.visually-hidden),
.modal-header.bg-success strong,
.modal-header.bg-info,
.modal-header.bg-info h5,
.modal-header.bg-info h4,
.modal-header.bg-info h3,
.modal-header.bg-info .modal-title,
.modal-header.bg-info i,
.modal-header.bg-info p,
.modal-header.bg-info span:not(.btn-close):not(.visually-hidden),
.modal-header.bg-info strong,
.modal-header.bg-warning,
.modal-header.bg-warning h5,
.modal-header.bg-warning h4,
.modal-header.bg-warning h3,
.modal-header.bg-warning .modal-title,
.modal-header.bg-warning i,
.modal-header.bg-warning p,
.modal-header.bg-warning span:not(.btn-close):not(.visually-hidden),
.modal-header.bg-warning strong,
.modal-header.bg-danger,
.modal-header.bg-danger h5,
.modal-header.bg-danger h4,
.modal-header.bg-danger h3,
.modal-header.bg-danger .modal-title,
.modal-header.bg-danger i,
.modal-header.bg-danger p,
.modal-header.bg-danger span:not(.btn-close):not(.visually-hidden),
.modal-header.bg-danger strong,
.modal-header.bg-dark,
.modal-header.bg-dark h5,
.modal-header.bg-dark h4,
.modal-header.bg-dark h3,
.modal-header.bg-dark .modal-title,
.modal-header.bg-dark i,
.modal-header.bg-dark p,
.modal-header.bg-dark span:not(.btn-close):not(.visually-hidden),
.modal-header.bg-dark strong,
.modal-header.bg-secondary,
.modal-header.bg-secondary h5,
.modal-header.bg-secondary h4,
.modal-header.bg-secondary h3,
.modal-header.bg-secondary .modal-title,
.modal-header.bg-secondary i,
.modal-header.bg-secondary p,
.modal-header.bg-secondary span:not(.btn-close):not(.visually-hidden),
.modal-header.bg-secondary strong {
    color: #1a202c !important;
    -webkit-text-fill-color: #1a202c !important;
}

/* Override Bootstrap's .text-white utility used together with bg-* classes on modal headers */
.modal-header.text-white,
.modal-header.text-white h5,
.modal-header.text-white h4,
.modal-header.text-white h3,
.modal-header.text-white .modal-title,
.modal-header.text-white i,
.modal-header.text-white p,
.modal-header.text-white span:not(.btn-close):not(.visually-hidden),
.modal-header.text-white strong {
    color: #1a202c !important;
    -webkit-text-fill-color: #1a202c !important;
}

/* Override Bootstrap's .text-dark utility used with bg-warning to keep consistency */
.modal-header.text-dark,
.modal-header.text-dark h5,
.modal-header.text-dark h4,
.modal-header.text-dark h3,
.modal-header.text-dark .modal-title,
.modal-header.text-dark i,
.modal-header.text-dark p,
.modal-header.text-dark span:not(.btn-close):not(.visually-hidden) {
    color: #1a202c !important;
    -webkit-text-fill-color: #1a202c !important;
}

/* Close button on colored (now pastel) modal headers — still dark */
.modal-header.bg-primary .btn-close,
.modal-header.bg-success .btn-close,
.modal-header.bg-info .btn-close,
.modal-header.bg-warning .btn-close,
.modal-header.bg-danger .btn-close,
.modal-header.bg-dark .btn-close,
.modal-header.bg-secondary .btn-close {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231a202c'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") !important;
    background-size: 1em auto !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    width: 1em !important;
    height: 1em !important;
    padding: 0.5em !important;
    box-sizing: content-box !important;
    opacity: 0.7 !important;
}

/* When the entire modal-content has bg-dark (photo viewer modals), the close
   button needs to stay WHITE to remain visible on the dark background. */
.modal-content.bg-dark .btn-close,
.modal-content.bg-dark .btn-close-white,
.modal-dark .modal-header .btn-close {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") !important;
    background-size: 1em auto !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    width: 1em !important;
    height: 1em !important;
    padding: 0.5em !important;
    box-sizing: content-box !important;
    filter: none !important;
    opacity: 0.9 !important;
}