/* UX Improvements for Better Navigation */

/* AI Assessment Layout Fixes */
#ai_assessment_content .row.g-4 {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
}

#ai_assessment_content .row.g-4 > [class*="col-"] {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Ensure no overlap on medium screens */
@media (min-width: 768px) and (max-width: 991.98px) {
    #ai_assessment_content .col-md-6 {
        margin-bottom: 2rem;
    }
}

/* Enhanced vehicle info and assessment boxes */
.vehicle-info-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    height: 100%;
    min-height: 200px;
}

.vehicle-info-box:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.assessment-features-box {
    background: linear-gradient(135deg, #f0fdf4 0%, #f0fdf4 100%);
    border: 2px solid #00c805 !important;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    height: 100%;
    min-height: 200px;
}

.assessment-features-box:hover {
    box-shadow: 0 4px 12px rgba(0, 200, 5, 0.15);
    transform: translateY(-2px);
}

/* Mobile optimizations for AI Assessment */
@media (max-width: 767.98px) {
    #ai_assessment_content .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .vehicle-info-box, 
    .assessment-features-box {
        margin-bottom: 1.5rem;
        min-height: auto;
    }
    
    #ai_assessment_content .row.g-4 {
        margin-left: 0;
        margin-right: 0;
    }
    
    #ai_assessment_content .row.g-4 > [class*="col-"] {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Fix text and spacing in assessment features */
.assessment-feature-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0;
}

.assessment-feature-item:last-child {
    margin-bottom: 0;
}

.assessment-feature-item .fas {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 110px; /* Start below header */
    left: 0;
    height: calc(100vh - 110px);
    width: 250px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    transition: all 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-toggle {
    position: fixed;
    top: 130px; /* Position below header */
    left: 250px;
    z-index: 1000;
    background: white;
    border: 2px solid #007bff;
    border-radius: 0 5px 5px 0;
    padding: 10px 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar.collapsed + .sidebar-toggle {
    left: 60px;
}

.main-content {
    margin-left: 250px;
    transition: all 0.3s ease;
    min-height: calc(100vh - 110px);
    padding-top: 120px; /* Start content below header */
}

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

/* Sidebar Menu Items */
.sidebar-menu {
    list-style: none;
    padding: 20px 0 10px 0; /* Normal padding since sidebar now starts below header */
    margin: 0;
}

.sidebar-menu li {
    position: relative;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 0 15px 5px 15px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}


.sidebar-menu i {
    width: 25px;
    text-align: center;
    margin-right: 10px;
    font-size: 1.1rem;
}

.sidebar.collapsed .sidebar-menu span {
    display: none;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 15px 10px;
}

.sidebar.collapsed .sidebar-menu i {
    margin-right: 0;
}

/* Quick Actions Panel - REMOVED to prevent duplicate buttons */

/* Enhanced Breadcrumb Navigation */
.breadcrumb-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideInDown 0.4s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.breadcrumb-nav ol {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    color: #94a3b8;
    margin: 0 12px;
    font-weight: 400;
}

.breadcrumb-item a {
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 4px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-item a:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.breadcrumb-item.active {
    color: #1e293b;
    font-weight: 600;
}

.breadcrumb-item i {
    font-size: 12px;
    opacity: 0.8;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .breadcrumb-nav {
        padding: 8px 16px;
        margin-bottom: 16px;
    }
    
    .breadcrumb-item {
        font-size: 13px;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        margin: 0 8px;
    }
    
    .breadcrumb-item a {
        padding: 3px 6px;
    }
    
    /* Mobile Form Enhancements */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
        min-height: 48px; /* Better touch targets */
    }
    
    .btn {
        min-height: 44px; /* Better touch targets */
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .btn-sm {
        min-height: 38px;
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* Table responsiveness */
    .table-responsive {
        border: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .table td, .table th {
        padding: 8px;
        font-size: 14px;
        white-space: nowrap;
    }
    
    /* Sidebar mobile improvements */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding-top: var(--header-height);
    }
    
    /* Mobile navigation improvements */
    .nav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-link {
        white-space: nowrap;
        min-width: 120px;
    }
    
    /* Auto-save status mobile optimization */
    .autosave-status {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .autosave-indicator {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .autosave-indicator .last-saved {
        width: 100%;
        margin-left: 0;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .breadcrumb-nav {
        padding: 6px 12px;
        margin-bottom: 12px;
    }
    
    .breadcrumb-item {
        font-size: 12px;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        margin: 0 6px;
        font-size: 11px;
    }
    
    /* Hide icons on very small screens to save space */
    .breadcrumb-item i {
        display: none;
    }
    
    .modal-dialog {
        margin: 5px;
        max-width: calc(100vw - 10px);
    }
    
    .modal-header, .modal-footer {
        padding: 12px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .form-control, .form-select {
        padding: 10px 14px;
        font-size: 16px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 15px;
    }
    
    /* Stack form elements on small screens */
    .row .col-md-6, .row .col-md-4, .row .col-md-3 {
        margin-bottom: 12px;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .btn:hover {
        transform: none; /* Disable hover animations on touch */
    }
    
    .card:hover {
        transform: none;
        box-shadow: inherit;
    }
    
    .expense-card:hover {
        transform: none;
        border-color: inherit;
    }
    
    /* Larger touch targets */
    .nav-link, .sidebar-item {
        padding: 12px 20px;
        min-height: 48px;
    }
    
    .dropdown-item {
        padding: 12px 20px;
        min-height: 44px;
    }
}

/* Step Progress Indicator */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e0e0e0;
    z-index: -1;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.step-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 3px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s ease;
}

.step.active .step-circle {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: scale(1.1);
}

.step.completed .step-circle {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.step-label {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

.step.active .step-label {
    color: #007bff;
    font-weight: 600;
}

/* Tooltip Help */
.help-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    cursor: help;
}

.help-tooltip i {
    color: #999;
    font-size: 0.9rem;
}

.help-tooltip .tooltip-content {
    visibility: hidden;
    width: 250px;
    background-color: #333;
    color: white;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
}

.help-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Action Cards */
.action-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    margin-bottom: 20px;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.action-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.action-card.primary .icon {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.action-card.success .icon {
    background: linear-gradient(135deg, #4caf50 0%, #81c784 100%);
    color: white;
}

.action-card.warning .icon {
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
    color: white;
}

/* Keyboard Shortcuts */
.keyboard-shortcuts {
    position: fixed;
    bottom: 20px;
    left: 270px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.85rem;
    display: none;
}

.keyboard-shortcuts.show {
    display: block;
}

.shortcut-key {
    background: #444;
    padding: 2px 6px;
    border-radius: 3px;
    margin: 0 3px;
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

.status-indicator.online {
    background: #4caf50;
}

.status-indicator.pending {
    background: #ff9800;
}

.status-indicator.offline {
    background: #f44336;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 currentColor;
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0,0,0,0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0,0,0,0);
    }
}

/* Single Floating Action Button */
.single-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.single-fab .fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    text-decoration: none;
}

.single-fab .fab-main:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    color: white;
}

/* Enhanced Navigation Sections */
.nav-section {
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.nav-section-header {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 0 8px;
}

.nav-section-header:hover {
    background: rgba(107, 114, 128, 0.05);
}

.section-icon {
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 8px;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-section-header:hover .section-icon::after {
    opacity: 1;
}

.nav-section-header:hover .section-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Navigation separators with improved styling */
.nav-separator {
    opacity: 0.6;
    transition: opacity 0.3s ease;
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

.nav-section:hover + li .nav-separator,
.nav-section:hover ~ li .nav-separator {
    opacity: 1;
}

/* Improved sidebar menu styling */
.sidebar-menu .sidebar-item {
    position: relative;
    margin: 0 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-menu .sidebar-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-radius: 0 2px 2px 0;
    transition: height 0.2s ease;
}

.sidebar-menu .sidebar-item:hover::before {
    height: 20px;
}

.sidebar-menu .sidebar-item.active::before {
    height: 24px;
    background: linear-gradient(135deg, #00c805, #00a804);
}

.sidebar-menu .sidebar-item:hover {
    background: rgba(107, 114, 128, 0.05);
    transform: translateX(2px);
}

.sidebar-menu .sidebar-item.active {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.sidebar-menu .sidebar-item.active i {
    color: #2563eb;
}

/* Enhanced hover effects for better interactivity */
.sidebar-menu .sidebar-item i {
    transition: all 0.2s ease;
}

.sidebar-menu .sidebar-item:hover i {
    transform: scale(1.1);
}

/* Sidebar scroll improvements */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 114, 128, 0.3) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.3);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.5);
}

/* Collapsible navigation sections (optional enhancement) */
.nav-section.collapsible .nav-section-header {
    cursor: pointer;
}

.nav-section.collapsible .nav-section-header::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 10px;
    color: #9ca3af;
}

.nav-section.collapsible.collapsed .nav-section-header::after {
    transform: rotate(-90deg);
}

.nav-section.collapsible.collapsed .nav-section-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.nav-section-content {
    max-height: 500px;
    transition: all 0.3s ease;
    opacity: 1;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .sidebar-menu span {
        display: none;
    }
    
    .sidebar-menu a {
        justify-content: center;
        padding: 15px 10px;
    }
    
    .sidebar-menu i {
        margin-right: 0;
    }
    
    /* Hide section headers on mobile */
    .nav-section-header {
        display: none;
    }
    
    /* Adjust separators for mobile */
    .nav-separator {
        margin: 8px 16px;
    }
    
    /* Make section icons smaller on mobile */
    .section-icon {
        width: 20px;
        height: 20px;
    }
    
    .section-icon i {
        font-size: 8px;
    }
    
    /* Adjust sidebar item spacing */
    .sidebar-menu .sidebar-item {
        margin: 0 4px;
    }
}

/* Enhanced active state animations */
@keyframes slideIn {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sidebar-menu .sidebar-item.active {
    animation: slideIn 0.3s ease;
}

/* Accessibility improvements */
.nav-section-header:focus,
.sidebar-menu .sidebar-item:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .nav-section-header:hover {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .sidebar-menu .sidebar-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }
}