/* ==========================================================================
   Exact Sneat PRO Theme Palette & Typography (Light & Dark Support)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Light Mode (Default)
   -------------------------------------------------------------------------- */
:root,
[data-bs-theme="light"],
html:not([data-bs-theme="dark"]) {
    --bs-primary: #696cff;
    --bs-primary-rgb: 105, 108, 255;
    --bs-link-color: #696cff;
    --bs-link-hover-color: #5f61e6;
    --bs-body-bg: #f5f5f9;
    --bs-body-color: #38324f;
    --bs-body-color-rgb: 56, 50, 79;
    --bs-heading-color: #2f2b3d;
    --bs-card-bg: #ffffff;
    --bs-paper-bg: #ffffff;
    --bs-border-color: #dbdade;
    --bs-secondary: #8592a3;
    --bs-secondary-rgb: 133, 146, 163;
}

[data-bs-theme="light"] body,
html:not([data-bs-theme="dark"]) body {
    background-color: #f5f5f9 !important;
    color: #38324f;
    font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-bs-theme="light"] .bg-navbar-theme,
html:not([data-bs-theme="dark"]) .bg-navbar-theme {
    background-color: #ffffff !important;
    color: #38324f;
}

[data-bs-theme="light"] .bg-menu-theme,
html:not([data-bs-theme="dark"]) .bg-menu-theme {
    background-color: #ffffff !important;
    color: #38324f;
}

[data-bs-theme="light"] .card,
html:not([data-bs-theme="dark"]) .card {
    background-color: #ffffff !important;
    color: #38324f;
}

[data-bs-theme="light"] h1,
[data-bs-theme="light"] h2,
[data-bs-theme="light"] h3,
[data-bs-theme="light"] h4,
[data-bs-theme="light"] h5,
[data-bs-theme="light"] h6,
[data-bs-theme="light"] .h1,
[data-bs-theme="light"] .h2,
[data-bs-theme="light"] .h3,
[data-bs-theme="light"] .h4,
[data-bs-theme="light"] .h5,
[data-bs-theme="light"] .h6,
[data-bs-theme="light"] .text-heading,
html:not([data-bs-theme="dark"]) h1,
html:not([data-bs-theme="dark"]) h2,
html:not([data-bs-theme="dark"]) h3,
html:not([data-bs-theme="dark"]) h4,
html:not([data-bs-theme="dark"]) h5,
html:not([data-bs-theme="dark"]) h6,
html:not([data-bs-theme="dark"]) .text-heading {
    color: #2f2b3d !important;
}

[data-bs-theme="light"] .layout-menu .menu-link,
html:not([data-bs-theme="dark"]) .layout-menu .menu-link {
    color: #38324f !important;
    font-size: 0.9375rem;
    font-weight: 500;
}

[data-bs-theme="light"] .layout-menu .app-brand-text,
html:not([data-bs-theme="dark"]) .layout-menu .app-brand-text {
    color: #2f2b3d !important;
}

[data-bs-theme="light"] .layout-menu .menu-header .menu-header-text,
html:not([data-bs-theme="dark"]) .layout-menu .menu-header .menu-header-text {
    color: #828599 !important;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 0.72rem;
}

/* --------------------------------------------------------------------------
   2. Dark Mode (Exact Sneat PRO Dark Theme)
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"],
html[data-bs-theme="dark"],
body[data-bs-theme="dark"] {
    --bs-body-bg: #232333;
    --bs-paper-bg: #2b2c40;
    --bs-card-bg: #2b2c40;
    --bs-body-color: #cfcde4;
    --bs-body-color-rgb: 207, 205, 228;
    --bs-heading-color: #dbd9ed;
    --bs-border-color: #444564;
    --bs-secondary-color: #8688a2;
}

[data-bs-theme="dark"] body {
    background-color: #232333 !important;
    color: #cfcde4 !important;
    font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-bs-theme="dark"] .layout-wrapper {
    background-color: #232333 !important;
}

[data-bs-theme="dark"] .bg-navbar-theme {
    background-color: #2b2c40 !important;
    color: #cfcde4 !important;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.25) !important;
}

[data-bs-theme="dark"] .bg-menu-theme {
    background-color: #2b2c40 !important;
    color: #cfcde4 !important;
    border-right: 1px solid #444564 !important;
}

[data-bs-theme="dark"] .card {
    background-color: #2b2c40 !important;
    color: #cfcde4 !important;
    border-color: #444564 !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2) !important;
}

[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .h1,
[data-bs-theme="dark"] .h2,
[data-bs-theme="dark"] .h3,
[data-bs-theme="dark"] .h4,
[data-bs-theme="dark"] .h5,
[data-bs-theme="dark"] .h6,
[data-bs-theme="dark"] .text-heading {
    color: #dbd9ed !important;
}

[data-bs-theme="dark"] .card-title,
[data-bs-theme="dark"] .card-header h5,
[data-bs-theme="dark"] .card-header h6 {
    color: #dbd9ed !important;
}

[data-bs-theme="dark"] .layout-menu .app-brand-text,
[data-bs-theme="dark"] .app-brand-text.demo {
    color: #dbd9ed !important;
}

[data-bs-theme="dark"] .layout-menu .menu-link {
    color: #cfcde4 !important;
    font-size: 0.9375rem;
    font-weight: 500;
}

[data-bs-theme="dark"] .layout-menu .menu-link .menu-icon {
    color: #a1a0b5 !important;
}

[data-bs-theme="dark"] .layout-menu .menu-header .menu-header-text {
    color: #797993 !important;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 0.72rem;
}

[data-bs-theme="dark"] .layout-menu .menu-item.active > .menu-link:not(.menu-toggle) {
    background: rgba(105, 108, 255, 0.16) !important;
    color: #696cff !important;
}

[data-bs-theme="dark"] .text-body {
    color: #cfcde4 !important;
}

[data-bs-theme="dark"] .text-body-secondary {
    color: #8688a2 !important;
}

[data-bs-theme="dark"] .text-muted {
    color: #8688a2 !important;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #2b2c40 !important;
    border-color: #444564 !important;
    color: #cfcde4 !important;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #cfcde4 !important;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .dropdown-divider {
    border-color: #444564 !important;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #cfcde4;
    --bs-table-border-color: #444564;
    color: #cfcde4 !important;
}

[data-bs-theme="dark"] .table th {
    color: #a1a0b5 !important;
}

[data-bs-theme="dark"] .table td {
    color: #cfcde4 !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #a1a0b5 !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    color: #696cff !important;
    background-color: #2b2c40 !important;
    border-bottom-color: #696cff !important;
}

[data-bs-theme="dark"] .border-left-dashed,
[data-bs-theme="dark"] .border-dashed {
    border-color: #444564 !important;
}

[data-bs-theme="dark"] .bg-lighter {
    background-color: #35364e !important;
    color: #dbd9ed !important;
}

[data-bs-theme="dark"] .vehicles-progress-labels .vehicles-progress-label {
    color: #cfcde4 !important;
}

/* --------------------------------------------------------------------------
   3. Common Components & Buttons
   -------------------------------------------------------------------------- */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #696cff !important;
    border-color: #696cff !important;
    box-shadow: 0 0.125rem 0.25rem 0 rgba(105, 108, 255, 0.4) !important;
}

.btn-outline-primary {
    color: #696cff !important;
    border-color: #696cff !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: #696cff !important;
    border-color: #696cff !important;
    color: #fff !important;
    box-shadow: 0 0.125rem 0.25rem 0 rgba(105, 108, 255, 0.4) !important;
}

.layout-menu .app-brand-text,
.app-brand-text.demo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-brand {
    position: relative;
    padding-right: 1.5rem;
}

.app-brand .layout-menu-toggle {
    position: absolute;
    right: -13px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #696cff;
    color: #ffffff !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.125rem 0.25rem 0 rgba(105, 108, 255, 0.4);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.app-brand .layout-menu-toggle i {
    width: 14px;
    height: 14px;
    display: inline-block;
    background-color: #ffffff;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M13.293 6.293L7.586 12l5.707 5.707l1.414-1.414L10.414 12l4.293-4.293z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M13.293 6.293L7.586 12l5.707 5.707l1.414-1.414L10.414 12l4.293-4.293z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    transition: transform 0.2s ease-in-out;
}

.layout-menu-collapsed .app-brand .layout-menu-toggle i {
    transform: rotate(180deg);
}

.app-brand .layout-menu-toggle:hover {
    background-color: #5f61e6;
    color: #ffffff !important;
}

/* Authentication Page Brand Styling */
.authentication-wrapper.authentication-basic .authentication-inner .card .app-brand {
    margin-bottom: 1.25rem !important;
    min-height: auto;
    height: auto;
}

.authentication-basic .app-brand-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.authentication-basic .app-brand-text,
.authentication-cover .app-brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.authentication-wrapper.authentication-cover {
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

.authentication-wrapper.authentication-cover .authentication-inner {
    min-height: 100vh;
    width: 100%;
    margin: 0;
}

.authentication-cover .auth-cover-brand {
    position: absolute;
    z-index: 10;
    top: 2rem;
    left: 2.5rem;
    text-decoration: none;
}

@media (max-width: 575.98px) {
    .authentication-cover .auth-cover-brand {
        left: 1.5rem;
        top: 1.5rem;
    }
}

.auth-cover-bg {
    background-color: #f5f5f9;
    min-height: 100vh;
}

[data-bs-theme="dark"] .auth-cover-bg {
    background-color: #232333 !important;
}

.auth-cover-img {
    max-width: 90%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.layout-navbar .badge-notifications {
    background-color: #ff3e1d !important;
}

/* --------------------------------------------------------------------------
   4. DataTables Full Right Pagination
   -------------------------------------------------------------------------- */
div.dt-container {
    width: 100%;
}

div.dt-container div.dt-layout-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0.75rem 1.5rem;
}

div.dt-container div.dt-layout-start {
    margin-right: auto;
    display: flex;
    align-items: center;
}

div.dt-container div.dt-layout-end {
    margin-left: auto !important;
    display: flex;
    align-items: center;
    justify-content: flex-end !important;
}

div.dt-container div.dt-paging {
    display: flex;
    justify-content: flex-end !important;
}

div.dt-container div.dt-paging ul.pagination {
    margin: 0;
    justify-content: flex-end !important;
}

/* --------------------------------------------------------------------------
   5. Card Widget Separator & Avatar XS
   -------------------------------------------------------------------------- */
.card-widget-separator-wrapper {
    width: 100%;
}

.avatar-xs {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.avatar-xs .avatar-initial {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 576px) {
    .border-end-sm {
        border-right: 1px solid var(--bs-border-color) !important;
    }
}

/* --------------------------------------------------------------------------
   6. Comprehensive iPad & Tablet Compatibility Suite (768px - 1024px & iPadOS)
   -------------------------------------------------------------------------- */

/* Prevent iOS / iPadOS Safari auto-zoom on field focus */
@media screen and (max-width: 1024px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"],
    select.form-select,
    select.form-select-sm,
    .form-control,
    .form-control-sm,
    textarea.form-control {
        font-size: 16px !important;
    }
}

/* Responsive Top Navbar for iPad portrait and landscape */
.top-navbar-search-box {
    min-width: 220px;
    max-width: 380px;
}

@media screen and (max-width: 1024px) {
    .layout-navbar {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    .top-navbar-search-box {
        min-width: 140px;
        max-width: 240px;
    }
    .layout-menu-toggle {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}

@media screen and (max-width: 768px) {
    .top-navbar-search-box {
        min-width: 100px;
        max-width: 150px;
    }
}

/* Touch Targets & Ergonomics (Apple HIG 44x44pt Standard) */
@media (hover: none) and (pointer: coarse), screen and (max-width: 1024px) {
    .btn,
    .nav-link,
    .dropdown-item,
    .pagination .page-link,
    .form-check-input,
    .form-check-label {
        touch-action: manipulation;
    }

    .btn:not(.btn-xs):not(.btn-sm) {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-sm, .btn-xs {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .pagination .page-link {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dropdown-item {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
        font-size: 0.9375rem;
    }

    .form-check-input {
        width: 1.25em;
        height: 1.25em;
        margin-top: 0.15em;
    }

    .form-check-label {
        padding-left: 0.25rem;
        cursor: pointer;
    }
}

/* Table Momentum Scrolling & Touch Friendliness */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    max-width: 100%;
}

@media screen and (max-width: 1024px) {
    .card .table-responsive {
        margin-bottom: 0;
    }

    .table td, .table th {
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
    }

    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }
    .table-responsive::-webkit-scrollbar-thumb {
        background: rgba(105, 108, 255, 0.25);
        border-radius: 4px;
    }
}

/* Signature Pad & Apple Pencil Drawing Optimizations */
canvas[id*="Signature"],
canvas[id*="signature"],
canvas#signatureCanvas,
canvas#adminSignatureCanvas,
canvas#bookSignatureCanvas {
    touch-action: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    cursor: crosshair;
}

/* Modals on iPad / Tablet with Virtual Keyboard */
@media screen and (max-width: 1024px) {
    .modal-dialog {
        margin: 1rem auto !important;
        max-width: 94vw !important;
    }

    .modal-content {
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }

    .modal-header,
    .modal-footer {
        flex-shrink: 0;
    }

    .modal-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* iPad Sidebar Off-Canvas Smooth Transitions & Backdrop */
@media screen and (max-width: 1199.98px) {
    .layout-menu {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    }
    .layout-overlay {
        backdrop-filter: blur(2px);
        background-color: rgba(30, 30, 45, 0.5) !important;
    }
}

