/* TowOps ERP - Consolidated Global Stylesheet */

/* --- General & Native Element Overrides --- */

/* --- Body --- */
body {
    background-color: #F8FAFC;
    color: #1a1c1e;
    font-family: 'Inter', sans-serif;
}

body.towops-theme-dark {
    background-color: #101820;
    color: #e5edf5;
}

body.towops-theme-dark #main-content,
body.towops-theme-dark .bg-background,
body.towops-theme-dark .bg-surface,
body.towops-theme-dark .bg-surface-container-lowest {
    background-color: #101820 !important;
}

body.towops-theme-dark #top-bar,
body.towops-theme-dark footer,
body.towops-theme-dark .bg-white,
body.towops-theme-dark .bg-surface-container-low,
body.towops-theme-dark .bg-surface-container,
body.towops-theme-dark .bg-surface-container-high,
body.towops-theme-dark .card-elevation,
body.towops-theme-dark .card-shadow {
    background-color: #182431 !important;
    border-color: #334456 !important;
}

body.towops-theme-dark .text-on-surface,
body.towops-theme-dark h1,
body.towops-theme-dark h2,
body.towops-theme-dark h3,
body.towops-theme-dark h4 {
    color: #e5edf5 !important;
}

body.towops-theme-dark .text-on-surface-variant,
body.towops-theme-dark .text-outline {
    color: #a9b8c8 !important;
}

body.towops-theme-dark .border-outline,
body.towops-theme-dark .border-outline-variant {
    border-color: #334456 !important;
}

body.towops-theme-dark input,
body.towops-theme-dark select,
body.towops-theme-dark textarea,
body.towops-theme-dark .premium-input {
    background-color: #111d28 !important;
    border-color: #3a4d60 !important;
    color: #e5edf5 !important;
}

body.towops-theme-dark input::placeholder,
body.towops-theme-dark textarea::placeholder {
    color: #7f90a3 !important;
}

body.towops-theme-dark table thead,
body.towops-theme-dark .modal-body-premium {
    background-color: #182431 !important;
}


/* --- Scrollbars --- */
::-webkit-scrollbar {
    width: 6px;
    height: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.55);
}

::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 5px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}


/* --- Material --- */
.material-symbols-outlined {
    direction: ltr;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Material Symbols Outlined', sans-serif;
    font-style: normal;
    font-weight: normal;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    letter-spacing: normal;
    line-height: 1;
    text-transform: none !important;
    vertical-align: middle;
    visibility: visible;
    white-space: nowrap;
    word-wrap: normal;
}

.material-icons-ready .material-symbols-outlined {
    visibility: visible;
}

/* --- Create Job Wizard --- */
#new-client-form label {
    font-size: 13px;
    line-height: 1.15;
}

#new-client-form input,
#new-client-form select,
#new-client-form textarea {
    min-height: 36px;
    padding: 7px 10px !important;
    font-size: 14px;
    line-height: 1.25;
}

#new-client-form textarea {
    resize: vertical;
}


/* --- Sidebar --- */
#sidebar {
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
}

#sidebar .nav-text,
#sidebar .sidebar-logo-text,
#sidebar .create-job-text {
    opacity: 1;
    overflow: hidden;
    transition: opacity 0.2s ease, width 0.2s ease;
    white-space: nowrap;
}

#sidebar .sidebar-logo-block {
    transition: padding 0.3s ease;
}

#sidebar nav {
    min-height: 0;
}

#sidebar nav a {
    min-height: 38px;
}

#sidebar nav a .material-symbols-outlined {
    flex: 0 0 22px;
}

#sidebar .nav-text[id^="sidebar-badge-"] {
    font-size: 9px;
    line-height: 1;
}

#sidebar .sidebar-footer-block {
    flex-shrink: 0;
}

#sidebar .sidebar-version {
    user-select: none;
}

#sidebar.collapsed {
    width: 72px;
}

#sidebar.collapsed #create-job-btn {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

#sidebar.collapsed .nav-text,
#sidebar.collapsed .sidebar-logo-text,
#sidebar.collapsed .create-job-text {
    display: none !important;
}

#sidebar.collapsed .sidebar-logo-block {
    padding-left: 16px;
    padding-right: 16px;
    text-align: center;
    justify-content: center;
}

#sidebar.collapsed nav a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

#sidebar nav a {
    border-left: 4px solid transparent;
}

#sidebar nav a.border-primary-fixed-dim,
#sidebar nav a.border-l-4 {
    border-left-color: #a3caf2 !important;
}

#toggle-sidebar-btn {
    position: fixed;
    left: 268px;
    top: 16px;
    z-index: 60;
    width: 24px;
    height: 24px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
}

#sidebar.collapsed~#toggle-sidebar-btn {
    left: 60px;
}

#sidebar.collapsed~#toggle-sidebar-btn .toggle-icon {
    transform: rotate(180deg);
}


/* --- Topbar --- */
#top-bar {
    left: 280px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#top-bar.expanded {
    left: 72px;
}


/* --- Main-content --- */
#main-content {
    margin-left: 280px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#main-content.expanded {
    margin-left: 72px;
}


/* --- Layout --- */
.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}


/* --- Cards --- */
.card-elevation {
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.card-elevation:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.card-shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

/* --- Operations Dashboard --- */
.dashboard-hero {
    background:
        radial-gradient(circle at 92% 15%, rgba(163, 202, 242, 0.3), transparent 28%),
        linear-gradient(135deg, #ffffff 0%, #f6faff 58%, #eef6ff 100%);
    box-shadow: 0 10px 30px rgba(0, 39, 65, 0.06);
}

.dashboard-primary-action {
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.dashboard-primary-action:hover {
    box-shadow: 0 8px 18px rgba(0, 39, 65, 0.2);
    transform: translateY(-1px);
}

.dashboard-filter-bar {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dashboard-kpi {
    min-height: 112px;
    overflow: hidden;
    position: relative;
}

.dashboard-kpi::after {
    background: linear-gradient(180deg, rgba(163, 202, 242, 0.75), rgba(163, 202, 242, 0));
    border-radius: 999px;
    content: '';
    height: 44px;
    position: absolute;
    right: -12px;
    top: -14px;
    transform: rotate(38deg);
    width: 5px;
}

.dashboard-kpi-featured {
    box-shadow: inset 0 3px 0 #00639a, 0 1px 3px rgba(0, 39, 65, 0.08);
}

.dashboard-kpi-alert::after {
    background: linear-gradient(180deg, rgba(186, 26, 26, 0.55), rgba(186, 26, 26, 0));
}

.dashboard-shortcut {
    border-color: #e6edf4;
    min-height: 104px;
}

.dashboard-shortcut-icon {
    align-items: center;
    background: #eef6ff;
    border-radius: 10px;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.dashboard-scroll-list {
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-width: thin;
}

.dashboard-scroll-list::-webkit-scrollbar {
    width: 5px;
}

.dashboard-scroll-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}


/* --- Component & Helper Classes --- */
#toggle-sidebar-btn {
    transition: transform 0.3s ease;
}

.active-tab {
    border-bottom: 2px solid #002741;
    color: #002741;
    font-weight: 600;
}

.canvas-bg {
    background-color: #F8FAFC;
}

.chart-bar {
    transition: height 1s ease-in-out;
}

.custom-shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.drawer-shadow {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.fill-icon {
    font-variation-settings: 'FILL' 1;
}

.glass-card {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.glass-panel {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.8);
}

.nav-transition {
    transition: all 0.2s ease-in-out;
}

.pricing-active-card {
    border-left: 4px solid #a3caf2;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.step-transition {
    transition: all 0.3s ease-in-out;
}

input:focus,
select:focus {
    box-shadow: 0 0 0 2px rgba(0, 39, 65, 0.2);
    outline: none;
}

/* --- Mobile Responsiveness --- */
#mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 9999px;
    transition: all 0.2s ease;
    margin-right: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #475569;
}

#mobile-menu-btn:hover {
    background-color: var(--md-sys-color-surface-container-high, #e2e8f0);
}

#sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    #mobile-menu-btn {
        display: flex !important;
    }

    #sidebar,
    #sidebar.collapsed {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 100 !important;
        width: 280px !important;
    }

    #sidebar.mobile-open,
    #sidebar.collapsed.mobile-open {
        transform: translateX(0) !important;
    }

    #sidebar.collapsed .nav-text,
    #sidebar.collapsed .sidebar-logo-text,
    #sidebar.collapsed .create-job-text {
        display: inline-block !important;
    }

    #sidebar.collapsed .sidebar-logo-block {
        padding-left: 24px !important;
        padding-right: 24px !important;
        text-align: left !important;
        justify-content: flex-start !important;
    }

    #sidebar.collapsed nav a {
        justify-content: flex-start !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    #sidebar.collapsed #create-job-btn {
        justify-content: center !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    #main-content {
        margin-left: 0 !important;
    }

    #top-bar {
        left: 0 !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    #toggle-sidebar-btn {
        display: none !important;
    }

    /* Responsive Spacing & Spacers */
    .px-margin-desktop {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    .p-unit-lg,
    .p-unit-md,
    .p-8 {
        padding: 16px !important;
    }

    .px-8 {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    .gap-gutter {
        gap: 16px !important;
    }

    /* Responsive header elements */
    #top-bar .relative.w-full.max-w-md {
        max-width: 150px;
    }

    /* Make header buttons circular showing only icons */
    #top-bar button span {
        display: none !important;
    }

    #top-bar button span.material-symbols-outlined {
        display: inline-block !important;
    }

    #top-bar button {
        padding: 8px !important;
        border-radius: 9999px !important;
    }

    /* Hide name and role in profile widget */
    #top-bar .text-right,
    #top-bar .text-left {
        display: none !important;
    }

    #top-bar .pl-4.border-l {
        padding-left: 0 !important;
        border-left: none !important;
    }

    #top-bar .material-symbols-outlined {
        font-size: 20px !important;
    }

    /* Hide dropdown chevron on mobile profile */
    #top-bar img+.material-symbols-outlined {
        display: none !important;
    }

    /* Hide page titles in top bar on mobile */
    #top-bar h2 {
        display: none !important;
    }

    /* Shrink search input container in driver/agent management */
    #top-bar .relative.w-96 {
        width: 100% !important;
        max-width: 160px !important;
    }

    /* Stack page headers to prevent horizontal clipping */
    #main-content>div>.flex.justify-between,
    #main-content>div>div>.flex.justify-between,
    #main-content>.p-unit-lg>.flex.justify-between,
    #main-content>.p-8>.flex.justify-between {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        width: 100% !important;
    }

    #main-content>div>.flex.justify-between>div,
    #main-content>div>div>.flex.justify-between>div,
    #main-content>.p-unit-lg>.flex.justify-between>div,
    #main-content>.p-8>.flex.justify-between>div,
    #main-content>div>.flex.justify-between>.flex,
    #main-content>div>div>.flex.justify-between>.flex,
    #main-content>.p-unit-lg>.flex.justify-between>.flex,
    #main-content>.p-8>.flex.justify-between>.flex {
        width: 100% !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    #main-content>div>.flex.justify-between button,
    #main-content>div>div>.flex.justify-between button,
    #main-content>.p-unit-lg>.flex.justify-between button,
    #main-content>.p-8>.flex.justify-between button,
    #main-content>div>.flex.justify-between select,
    #main-content>div>div>.flex.justify-between select,
    #main-content>.p-unit-lg>.flex.justify-between select,
    #main-content>.p-8>.flex.justify-between select {
        flex: 1 1 auto !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* Prevent charts from overflowing on mobile */
    .card-elevation .w-6 {
        width: 10px !important;
    }

    .card-elevation .flex.gap-1 {
        gap: 2px !important;
    }

    #chart-labels {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Force major columns to stack vertically on mobile */
    .col-span-1,
    .col-span-2,
    .col-span-3,
    .col-span-4,
    .col-span-5,
    .col-span-6,
    .col-span-7,
    .col-span-8,
    .col-span-9,
    .col-span-10,
    .col-span-11,
    .col-span-12 {
        grid-column: span 12 / span 12 !important;
    }

    /* Stacking flex container columns */
    .flex.gap-gutter {
        flex-direction: column !important;
    }

    /* Force full-width elements */
    .w-3\/4,
    .w-1\/2,
    .w-1\/4 {
        width: 100% !important;
    }

    /* Mobile-specific Typography Sizing to prevent clipping */
    h2,
    .font-display-lg,
    .text-display-lg,
    .font-headline-lg,
    .text-headline-lg {
        font-size: 22px !important;
        line-height: 28px !important;
        letter-spacing: -0.02em !important;
    }

    h3,
    .font-headline-md,
    .text-headline-md,
    .font-title-lg,
    .text-title-lg {
        font-size: 18px !important;
        line-height: 24px !important;
        letter-spacing: -0.01em !important;
    }

    .text-body-lg {
        font-size: 14px !important;
        line-height: 20px !important;
    }

    /* Touch target active feedback */
    button:active,
    a.px-4:active {
        transform: scale(0.97) !important;
        opacity: 0.9 !important;
    }

    /* Soft shadows and glassmorphism styling for mobile cards */
    .card-elevation,
    .card-shadow {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
        border: 1px solid rgba(226, 232, 240, 0.8) !important;
        background: #ffffff !important;
    }

    /* Dynamic Notification Badge Pulse on Mobile */
    #top-bar button .bg-error {
        animation: badge-pulse 1.8s infinite ease-in-out;
    }

    @keyframes badge-pulse {
        0% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        }

        70% {
            transform: scale(1.1);
            box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
        }

        100% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        }
    }

    /* Horizontal Table Scroll Indicator */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin;
    }

    .overflow-x-auto::-webkit-scrollbar {
        height: 6px !important;
        display: block !important;
    }

    .overflow-x-auto::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.03) !important;
        border-radius: 4px !important;
    }

    .overflow-x-auto::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15) !important;
        border-radius: 4px !important;
    }
}

@media (max-width: 640px) {
    #top-bar .relative.w-full.max-w-md {
        display: none !important;
    }
}

/* --- Premium Modal System --- */
.modal-overlay {
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    transition: all 0.3s ease-in-out;
}

.modal-container {
    background: #FFFFFF !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal-header-premium {
    padding: 24px 28px 20px 28px !important;
    border-b: 1px solid #F1F5F9 !important;
    background: linear-gradient(135deg, #002741 0%, #00406c 100%) !important;
    color: #FFFFFF !important;
}

.modal-body-premium {
    padding: 28px !important;
}

.premium-input {
    width: 100% !important;
    background-color: #F8FAFC !important;
    border: 1.5px solid #E2E8F0 !important;
    border-radius: 12px !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    color: #1E293B !important;
    outline: none !important;
    transition: all 0.2s ease-in-out !important;
}

.premium-input::placeholder {
    color: #94A3B8 !important;
}

.premium-input:focus {
    background-color: #FFFFFF !important;
    border-color: #002741 !important;
    box-shadow: 0 0 0 4px rgba(0, 39, 65, 0.1) !important;
}
[data-requires-capability][aria-hidden="true"] {
  display: none !important;
}
