/* ABG Mobile Layout Styles */
/* Import centralized color system */
@import url('./abg-colors.css');

/* Additional layout-specific variables if needed */

/* Mobile App Header */
.abg-mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050; /* Lower than sidebar/overlay */
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    /* Ensure header is always visible */
    will-change: transform;
}

.abg-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    max-width: 100%;
    /* Ensure proper flex behavior */
    width: 100%;
    min-height: 60px;
}

.abg-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* Ensure it doesn't take too much space */
    flex: 0 1 auto;
}

.abg-logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--abg-white);
}

.abg-logo-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--abg-white);
    padding: 4px;
}

.abg-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--abg-white);
}

/* Menu Toggle Container */
.abg-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Ensure it stays on the right */
    flex: 0 0 auto;
    min-width: 48px;
}

/* Bootstrap-based menu button styling */
.navbar-toggler.abg-menu-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.6);
    width: 48px;
    height: 48px;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 10;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
}

.navbar-toggler.abg-menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

.navbar-toggler.abg-menu-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    outline: none;
}

/* Fallback button styling */
#menuToggleAlt {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 2px solid white !important;
    color: white !important;
    font-size: 1.2rem;
    font-weight: bold;
}

.abg-menu-btn {
    background: rgba(30, 64, 175, 0.15);
    border: 2px solid var(--abg-primary);
    width: 48px;
    height: 48px;
    display: flex !important; /* Force display */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
    /* Ensure visibility */
    position: relative;
    z-index: 10;
    min-width: 48px;
    min-height: 48px;
}

.abg-menu-btn:hover {
    background: var(--abg-primary);
    border-color: var(--abg-primary);
    transform: scale(1.05);
    box-shadow: var(--shadow-primary);
}

.abg-menu-icon {
    width: 22px;
    height: 3px;
    background: var(--abg-white);
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: block !important; /* Force display */
    /* Ensure visibility */
    opacity: 1;
    visibility: visible;
}

.abg-menu-btn.active .abg-menu-icon:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.abg-menu-btn.active .abg-menu-icon:nth-child(2) {
    opacity: 0;
}

.abg-menu-btn.active .abg-menu-icon:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Modern Sliding Sidebar */
.abg-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6); /* Darker background */
    backdrop-filter: blur(4px);
    z-index: 2000; /* Higher than everything */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    /* Ensure overlay blocks all interactions */
    pointer-events: none;
}

.abg-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Enable clicks when visible */
}

.abg-sidebar {
    position: fixed;
    top: 0;
    right: -320px; /* Initially hidden off-screen */
    width: 320px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.95) 0%, rgba(59, 130, 246, 0.95) 100%);
    backdrop-filter: var(--glass-backdrop);
    border-left: 1px solid var(--glass-border);
    z-index: 2001; /* Highest z-index */
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
    /* Ensure proper layering */
    will-change: transform;
    transform: translateZ(0); /* Force hardware acceleration */
    /* Prevent background interactions */
    pointer-events: auto;
}

.abg-sidebar.show {
    right: 0; /* Slide in from right */
}

.abg-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(30, 64, 175, 0.2);
}

.abg-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.abg-sidebar-logo-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--abg-white);
    padding: 6px;
}

.abg-sidebar-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--abg-white);
}

.abg-sidebar-close {
    background: none;
    border: none;
    color: var(--abg-white);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.abg-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Fallback for when Font Awesome doesn't load */
.abg-sidebar-close .sr-only {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.abg-sidebar-close:not(:has(.fas)) .sr-only {
    opacity: 1;
}

.abg-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.abg-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

.abg-sidebar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--abg-white);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.abg-sidebar-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.abg-sidebar-item:hover::before {
    left: 100%;
}

.abg-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(8px);
    color: var(--abg-white);
}

.abg-sidebar-item-danger:hover {
    background: rgba(220, 38, 38, 0.2);
    color: var(--abg-danger-light);
}

.abg-sidebar-item-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.abg-sidebar-item:hover .abg-sidebar-item-icon {
    background: var(--abg-primary);
    transform: scale(1.1);
}

.abg-sidebar-item-danger:hover .abg-sidebar-item-icon {
    background: var(--abg-danger);
}

.abg-sidebar-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.abg-sidebar-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: inherit;
}

.abg-sidebar-item-desc {
    font-size: 0.875rem;
    opacity: 0.8;
    color: inherit;
}

.abg-sidebar-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 1rem 0;
}

/* Main Container */
.abg-main-container {
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 80px 0 80px 0; /* Space for header and footer */
    background: var(--abg-gradient-primary);
    position: relative;
    z-index: 1; /* Low z-index to stay behind sidebar */
}

.abg-content-area {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: calc(100vh - 160px);
}

/* Mobile Footer */
.abg-mobile-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040; /* Lower than sidebar/overlay */
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -8px 32px 0 rgba(30, 64, 175, 0.37);
}

.abg-footer-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.75rem 1rem;
}

.abg-footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 16px;
    transition: all 0.3s ease;
    min-width: 70px;
    font-size: 0.875rem;
    position: relative;
    cursor: pointer;
    border: none;
    background: transparent;
}

.abg-footer-item:hover,
.abg-footer-item.active {
    color: var(--abg-white);
    background: var(--glass-bg);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.abg-footer-item i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    transition: all 0.3s ease;
}

.abg-footer-item span {
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Special styling for add vehicle button */
.abg-footer-item.add-vehicle {
    background: var(--abg-gradient-primary);
    color: var(--abg-white);
    border-radius: 20px;
    transform: scale(1.1);
    box-shadow: var(--shadow-primary);
}

.abg-footer-item.add-vehicle:hover {
    transform: scale(1.15) translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.abg-footer-item.add-vehicle i {
    font-size: 1.75rem;
}

/* Add vehicle dropdown menu */
.abg-add-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.95) 0%, rgba(59, 130, 246, 0.95) 100%);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.3s ease;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1100; /* Ensure it's above other elements */
}

.abg-add-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.abg-add-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--abg-white);
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.abg-add-option:last-child {
    margin-bottom: 0;
}

.abg-add-option:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateX(4px);
    color: var(--abg-white);
}

.abg-add-option i {
    font-size: 1.25rem;
    width: 20px;
    text-align: center;
}

/* Remove any default Bootstrap container constraints */
.abg-main-container .container,
.abg-main-container .container-fluid {
    max-width: 100%;
    padding: 0;
}

/* Responsive behavior */
/* Responsive behavior */
@media (max-width: 767px) {
    .abg-sidebar {
        width: 280px; /* Slightly smaller on very small screens */
        right: -280px;
        z-index: 2001; /* Ensure highest priority */
    }
    
    .abg-sidebar.show {
        right: 0;
    }
    
    /* Ensure sidebar and overlay are above everything else on mobile */
    .abg-sidebar-overlay {
        z-index: 2000;
    }
    
    .abg-sidebar {
        z-index: 2001;
    }
    
    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        /* Prevent all interactions with background */
        touch-action: none;
    }
    
    /* Ensure main content can't be interacted with when sidebar is open */
    body.sidebar-open .abg-main-container,
    body.sidebar-open .abg-mobile-footer {
        pointer-events: none;
    }
}

@media (min-width: 768px) {
    .abg-header-content,
    .abg-menu-items {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .abg-content-area {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 1rem;
    }
    
    .abg-footer-nav {
        max-width: 1200px;
        margin: 0 auto;
    }
}

@media (min-width: 1024px) {
    .abg-mobile-footer {
        display: none; /* Hide footer on desktop */
    }
    
    .abg-main-container {
        padding-bottom: 0; /* Remove bottom padding on desktop */
    }
}