body {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    overflow-x: hidden;
}

.login-container {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    /* Tech Blue Gradient */
    position: relative;
    overflow: hidden;
}

/* Animated Background Icons */
.animated-bg-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.animated-bg-icons i {
    position: absolute;
    display: block;
    color: rgba(255, 255, 255, 0.1);
    top: 50%;
    /* Default vertical start */
    opacity: 0;
}

.animated-bg-icons i:nth-child(1) {
    top: 10%;
    font-size: 60px;
    animation: animateLeft 20s linear infinite;
    animation-delay: 0s;
}

.animated-bg-icons i:nth-child(2) {
    top: 25%;
    font-size: 45px;
    animation: animateRight 15s linear infinite;
    animation-delay: 2s;
}

.animated-bg-icons i:nth-child(3) {
    top: 40%;
    font-size: 70px;
    animation: animateLeft 25s linear infinite;
    animation-delay: 4s;
}

.animated-bg-icons i:nth-child(4) {
    top: 55%;
    font-size: 55px;
    animation: animateRight 18s linear infinite;
    animation-delay: 1s;
}

.animated-bg-icons i:nth-child(5) {
    top: 70%;
    font-size: 50px;
    animation: animateLeft 22s linear infinite;
    animation-delay: 6s;
}

.animated-bg-icons i:nth-child(6) {
    top: 85%;
    font-size: 80px;
    animation: animateRight 20s linear infinite;
    animation-delay: 3s;
}

.animated-bg-icons i:nth-child(7) {
    top: 15%;
    font-size: 65px;
    animation: animateLeft 30s linear infinite;
    animation-delay: 8s;
}

.animated-bg-icons i:nth-child(8) {
    top: 35%;
    font-size: 40px;
    animation: animateRight 12s linear infinite;
    animation-delay: 10s;
}

.animated-bg-icons i:nth-child(9) {
    top: 60%;
    font-size: 75px;
    animation: animateLeft 28s linear infinite;
    animation-delay: 5s;
}

.animated-bg-icons i:nth-child(10) {
    top: 80%;
    font-size: 50px;
    animation: animateRight 20s linear infinite;
    animation-delay: 12s;
}

@keyframes animateLeft {
    0% {
        transform: translateX(-150px) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateX(100vw) rotate(360deg);
        opacity: 0;
    }
}

@keyframes animateRight {
    0% {
        transform: translateX(100vw) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateX(-150px) rotate(-360deg);
        opacity: 0;
    }
}

/* Autocomplete Suggestion List Refined */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
    margin-top: 5px;
    display: none;
    padding: 5px 0;
}

.autocomplete-suggestion {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.autocomplete-suggestion i {
    margin-right: 12px;
    color: #adb5bd;
    font-size: 0.85rem;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.active {
    background-color: #f8f9fa;
    color: #2a5298;
    padding-left: 25px;
}

.autocomplete-suggestion.active {
    background-color: rgba(42, 82, 152, 0.12);
}

.autocomplete-suggestion mark {
    background: none;
    color: #2a5298;
    font-weight: 700;
    padding: 0;
}

/* Overlay for better text readability */
/* Overlay removed for icon background */

.login-card {
    width: 100%;
    max-width: 400px;
    z-index: 10;
    /* Bring card well above icons */
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

/* Mobile Responsiveness for Login Card */
@media (max-width: 576px) {
    .login-card {
        width: 90%;
        max-width: none;
        padding: 1.5rem !important;
        margin: 0 20px;
    }

    .login-container h3 {
        font-size: 1.5rem;
    }
}

.icons-container i {
    transition: transform 0.3s ease;
}

.icons-container i:hover {
    transform: scale(1.2);
}

.form-floating>label {
    color: #6c757d;
}

.bg-primary {
    background-color: rgba(42, 82, 152, var(--bs-bg-opacity, 1)) !important;
}

.text-primary {
    color: #2a5298 !important;
}

.btn-primary {
    background-color: #2a5298;
    border-color: #2a5298;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #1e3c72;
    border-color: #1e3c72;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 10;
    color: #6c757d;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: #2a5298;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.bg-indigo {
    background-color: #6610f2 !important;
}

.btn-outline-indigo {
    color: #6610f2;
    border-color: #6610f2;
}

.btn-outline-indigo:hover,
.btn-outline-indigo.active {
    background-color: #6610f2;
    border-color: #6610f2;
    color: #fff;
}

.filter-btn {
    transition: all 0.2s ease;
    border-radius: 20px;
    padding: 5px 15px;
}

.filter-btn.active {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.fade-in {
    animation: fadeIn 1s ease-out;
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Animation Delays */
.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

/* Enhanced Interactability */
.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(42, 82, 152, 0.25);
    border-color: #2a5298;
}

/* Dashboard Specific Animations */
.stat-card {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.sidebar {
    /* height: 100vh; */
    background-color: #2a5298;
    color: white;
    padding-top: 20px;
    width: 250px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    position: sticky;
    top: 0;
    overflow: visible;
    /* Prevent clipping children like the toggle button */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: block;
    padding: 12px 20px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar a:hover,
.sidebar a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left: 4px solid white;
}

.sidebar .collapse a {
    padding-left: 3.5rem !important;
    /* background-color: rgba(0, 0, 0, 0.1); */
    font-size: 0.9rem;
}

/* Sidebar Mini State */
.sidebar-mini {
    width: 70px !important;
}

.sidebar-mini .sidebar-text,
.sidebar-mini .sidebar-logo-container h5,
.sidebar-mini .fa-chevron-down {
    display: none !important;
}

.sidebar-mini .sidebar-header {
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-mini .sidebar-logo-container {
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

.sidebar-mini .sidebar-logo-container i {
    font-size: 2rem;
    /* Matches fa-2x used in maximized state */
    margin-bottom: 0;
}

.sidebar-mini .sidebar-content a {
    display: flex !important;
    justify-content: center !important;
    /* Force center even if it was space-between */
    align-items: center;
    padding: 15px 0 !important;
    width: 100%;
    border-left: 4px solid transparent;
}

/* Ensure icons inside spans (like Services) also center */
.sidebar-mini .sidebar-content a span {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
}

.sidebar-mini .sidebar-content a.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid white;
}

.sidebar-mini a i {
    margin: 0 !important;
    font-size: inherit;
    /* Use same size as maximized state */
    width: auto;
}

.sidebar-mini .collapse {
    display: none !important;
}

/* Sidebar Toggle Arrow - Premium Design */
.sidebar-mini-toggle {
    position: absolute;
    right: 15px;
    /* Moved INSIDE the sidebar */
    top: 35px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    /* Modern rounded-square look */
    padding: 0;
    z-index: 1060;
    background: #ffffff;
    color: #2a5298;
    border: 2px solid #2a5298;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    /* Spring transition */
}

/* Hide arrow button when minimized */
.sidebar-mini .sidebar-mini-toggle {
    display: none !important;
}

.sidebar-mini-toggle:hover {
    background: #2a5298;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(42, 82, 152, 0.4);
}

.sidebar-mini-toggle i {
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* Rotate icon based on sidebar state */
.sidebar-mini .sidebar-mini-toggle i {
    transform: rotate(180deg);
}

.sidebar-mini-toggle:active {
    transform: scale(0.9);
}

.sidebar a i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    transition: all 0.3s;
}

.sidebar a:hover::before {
    left: 100%;
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        height: 100vh;
        z-index: 1050;
    }

    .sidebar.active {
        transform: translateX(0);
    }
}

/* 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: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Dashboard Content Padding */
.content {
    padding: 2rem;
}

@media (max-width: 768px) {
    .content {
        padding: 1rem;
    }
}

.flex-grow-1 {
    min-width: 0;
}

table.dataTable td {
    white-space: normal;
    word-break: break-word;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.card-body {
    overflow-x: auto;
}

/* Select2 Bootstrap 5 Floating Label Integration */
.form-floating.select2-parent {
    position: relative;
    margin-bottom: 0.5rem;
}

.form-floating.select2-parent .select2-container--bootstrap-5 .select2-selection {
    height: calc(3.5rem + 2px) !important;
    padding-top: 1.625rem !important;
    padding-bottom: 0.625rem !important;
    border-radius: 0.375rem !important;
}

.form-floating.select2-parent .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding-left: 0.75rem !important;
    line-height: 1.25 !important;
    color: #495057;
}

.form-floating.select2-parent label {
    padding: 1rem 0.75rem;
    transform-origin: 0 0;
    transition: opacity .1s ease-in-out, transform .1s ease-in-out;
    z-index: 10;
    pointer-events: none;
    /* Force floating state for Select2 to avoid overlapping text */
    transform: scale(0.85) translateY(-0.75rem) translateX(0.15rem);
    opacity: 0.65;
}

/* Specific focus state for the selection box */
.form-floating.select2-parent .select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: #2a5298 !important;
    box-shadow: 0 0 0 0.25rem rgba(42, 82, 152, 0.25) !important;
}

/* Header Mobile Overlay Navigation */
@media (max-width: 768px) {
    .header-mobile-overlay {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        z-index: 1000;
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
        overflow: hidden;
    }

    .mobile-nav-links {
        display: flex;
        flex-direction: column;
    }

    .mobile-nav-item {
        padding: 12px 15px;
        color: #495057;
        text-decoration: none;
        display: flex;
        align-items: center;
        border-radius: 8px;
        margin-bottom: 5px;
        transition: all 0.2s;
    }

    .mobile-nav-item i {
        width: 30px;
        font-size: 1.1rem;
        color: #2a5298;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item.active {
        background: rgba(42, 82, 152, 0.08);
        color: #2a5298;
        font-weight: 600;
    }

    .mobile-nav-group-title {
        font-size: 0.75rem;
        text-transform: uppercase;
        color: #adb5bd;
        font-weight: 700;
        letter-spacing: 1px;
        margin: 15px 0 8px 10px;
    }
}

/* Navbar Animations */
.animate {
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

@keyframes slideIn {
    0% {
        transform: translateY(1rem);
        opacity: 0;
    }

    100% {
        transform: translateY(0rem);
        opacity: 1;
    }
}

/* Dropdown Toggle Arrow 360 Rotation */
.dropdown-toggle::after {
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    display: inline-block;
}

/* Desktop Rotation */
.dropdown.show .dropdown-toggle::after {
    transform: rotate(180deg);
}

/* Mobile Rotation (using navbar-toggler state) */
.navbar-toggler.collapsed::after {
    transform: rotate(0deg);
}

.navbar-toggler:not(.collapsed)::after {
    transform: rotate(180deg);
}

/* Extra touch: Remove default border from toggler arrow on mobile if needed */
.navbar-toggler.dropdown-toggle::after {
    margin-left: 0.5em;
    vertical-align: 0.255em;
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
}

.slideIn {
    animation-name: slideIn;
}

/* Make dropdown text white when active/clicked to override .text-danger */
.dropdown-item.active,
.dropdown-item:active,
.dropdown-item.text-danger:active {
    color: #fff !important;
    text-decoration: none;
    background-color: var(--bs-dropdown-link-active-bg);
}

.driver-theme-crm {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-top: 5px solid #2a5298;
    font-family: inherit;
}

.driver-theme-crm .driver-popover-title {
    color: #1e3c72;
    font-size: 18px;
    font-weight: 700;
}

.driver-theme-crm .driver-popover-description {
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.driver-theme-crm .driver-popover-next-btn {
    background-color: #2a5298;
    color: white;
    border-radius: 6px;
    text-shadow: none;
    border: none;
    padding: 5px 15px;
}

.driver-theme-crm .driver-popover-next-btn:hover {
    background-color: #1e3c72;
}

.driver-theme-crm .driver-popover-prev-btn,
.driver-theme-crm .driver-popover-close-btn {
    background-color: #f8f9fa;
    color: #333;
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 5px 5px;
}

.driver-theme-crm .driver-popover-prev-btn:hover,
.driver-theme-crm .driver-popover-close-btn:hover {
    background-color: #e9ecef;
}

.driver-theme-crm .driver-popover-progress-text {
    color: #ff9800;
    font-weight: bold;
}

/* Mobile Responsiveness for Tour Popup */
@media (max-width: 767.98px) {
    .driver-popover {
        max-width: calc(100vw - 32px) !important;
        width: auto !important;
        min-width: 0 !important;
    }
}

.brand-text {
    font-size: 1.6rem;
    letter-spacing: -0.5px;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
}

.brand-service {
    font-weight: 600;
    /* Semi-bold */
    color: #2a5298;
}

.brand-crm {
    font-weight: 900;
    /* Extra-bold */
    color: #2a5298;
    /* Deeper blue for visual anchor */
}

/* Mobile Responsive UI Fixes */
@media (max-width: 767.98px) {

    /* 1. Dashboard - Service Requests Status Buttons (Exactly 2 Rows) */
    #statusFilters {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
    }

    #statusFilters .filter-btn {
        flex: 1 1 23% !important;
        /* 4 buttons on first row */
        max-width: 24%;
        padding: 0.35rem 0.1rem !important;
        font-size: 11px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #statusFilters .filter-btn:nth-child(n+5) {
        flex: 1 1 30% !important;
        /* 3 buttons on second row */
        max-width: 32%;
    }

    /* 2. DataTables - Show Entries and Search on the same row */
    div.dataTables_wrapper div.row:first-child {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 0.5rem !important;
    }

    div.dataTables_wrapper div.row:first-child>div {
        width: auto !important;
        flex: 0 0 auto !important;
        padding: 0 5px !important;
        max-width: 50% !important;
    }

    div.dataTables_wrapper div.dataTables_length {
        text-align: left !important;
    }

    div.dataTables_wrapper div.dataTables_filter {
        text-align: right !important;
    }

    div.dataTables_wrapper div.dataTables_length label,
    div.dataTables_wrapper div.dataTables_filter label {
        display: flex !important;
        align-items: center !important;
        margin-bottom: 0 !important;
        font-size: 14px !important;
        white-space: nowrap !important;
    }

    div.dataTables_wrapper div.dataTables_length select {
        width: auto !important;
        display: inline-block !important;
        margin: 0 4px !important;
        padding: 0.1rem 1.25rem 0.1rem 0.25rem !important;
        font-size: 14px !important;
    }

    div.dataTables_wrapper div.dataTables_filter input {
        width: 146px !important;
        /* Compact search box for narrow screens */
        display: inline-block !important;
        margin-left: 4px !important;
        padding: 0.1rem 0.5rem !important;
        font-size: 14px !important;
    }

    /* 3. Page Headers - Title Left, Action Right */
    .content>.d-flex.justify-content-between.align-items-center.mb-4 {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
        margin-bottom: 1rem !important;
    }

    .content>.d-flex.justify-content-between.align-items-center.mb-4>h1,
    .content>.d-flex.justify-content-between.align-items-center.mb-4>h2,
    .content>.d-flex.justify-content-between.align-items-center.mb-4>h3,
    .content>.d-flex.justify-content-between.align-items-center.mb-4>h4 {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        margin-bottom: 0 !important;
        text-align: left !important;
        line-height: 1.3 !important;
    }

    .content>.d-flex.justify-content-between.align-items-center.mb-4>.btn,
    .content>.d-flex.justify-content-between.align-items-center.mb-4>a.btn {
        flex: 0 0 auto !important;
        max-width: 48% !important;
        white-space: normal !important;
        text-align: center !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.35rem 0.6rem !important;
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
    }
}

/* Remove arrows from number inputs globally */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
}