/* Import Modern Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* Modern App Color Palette */
    --primary: #0EA5E9;
    --primary-dark: #0284C7;
    --primary-light: #38BDF8;
    --secondary: #8B5CF6;
    --secondary-dark: #7C3AED;
    --accent: #10B981;
    --accent-orange: #F59E0B;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #EF4444;
    --info: #06b6d4;
    --dark: #1E293B;
    --text: #334155;
    --text-light: #64748B;
    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --card-bg: #FFFFFF;

    /* Typography */
    --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Poppins', sans-serif;

    /* Spacing & Sizing */
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-colored: 0 10px 15px -3px rgba(14, 165, 233, 0.2), 0 4px 6px -2px rgba(14, 165, 233, 0.1);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    --gradient-secondary: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    --gradient-accent: linear-gradient(135deg, #10B981 0%, #059669 100%);
    --gradient-vibrant: linear-gradient(135deg, #0EA5E9 0%, #8B5CF6 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
    font-weight: 400;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-primary);
    /* Changed from font-display to primary for cleaner look */
    font-weight: 600;
    color: var(--dark);
    line-height: 1.3;
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}


/* Sidebar - Clean */
.sidebar {
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    background: var(--card-bg);
    border-right: 1px solid #E2E8F0;
    /* Removed box-shadow for cleaner look */
}

/* ... Sidebar links unchanged ... */

/* Section Headers - Muted */
.nav-section-header {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94A3B8;
    margin-top: 0.5rem;
    font-family: var(--font-primary);
}

/* Cards - Clean & Minimal */
.card {
    border: 1px solid #E2E8F0;
    /* Subtle border instead of shadow */
    border-radius: var(--border-radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    /* Minimal shadow */
    transition: var(--transition);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: #CBD5E1;
}

.card-header {
    background: #FFFFFF;
    /* White background */
    border-bottom: 1px solid #E2E8F0;
    font-weight: 600;
    font-family: var(--font-primary);
    padding: 1rem 1.5rem;
    color: var(--dark);
    font-size: 1rem;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons - Touch Friendly */
.btn {
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-family: var(--font-primary);
    transition: var(--transition);
    border: none;
    min-height: 44px;
    font-size: 0.95rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-colored);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
    box-shadow: 0 15px 20px -5px rgba(14, 165, 233, 0.3);
}

.btn-secondary {
    background: var(--gradient-secondary);
    color: white;
}

.btn-success {
    background: var(--gradient-accent);
    color: white;
}

/* Forms - Modern & Clean */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 2px solid #E2E8F0;
    padding: 0.75rem 1rem;
    transition: var(--transition);
    font-family: var(--font-primary);
    min-height: 44px;
    background: var(--card-bg);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
    font-size: 0.9rem;
}

/* Tables - Clean & Modern */
.table {
    background-color: var(--card-bg);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
}

.table thead th {
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid #E2E8F0;
    padding: 1rem;
}

.table tbody tr {
    transition: var(--transition-fast);
    border-bottom: 1px solid #F1F5F9;
}

.table tbody tr:hover {
    background: rgba(14, 165, 233, 0.03);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* Badges - Pill Style */
.badge {
    padding: 0.4em 0.8em;
    font-weight: 600;
    border-radius: 50px;
    font-size: 0.85rem;
}

/* Dashboard Stats - App Style */
.dashboard-stat {
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    /* Reduced shadow */
    border: 1px solid #E2E8F0;
    /* Replaced left border with full border */
    transition: var(--transition);
}

.dashboard-stat:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: #CBD5E1;
}

/* ... content skipped ... */

/* Alerts - Modern Style */
.alert {
    border-radius: var(--border-radius-lg);
    border: 1px solid transparent;
    /* Replaced left border */
    padding: 1rem 1.25rem;
    box-shadow: none;
}

.alert-success {
    background: #DCFCE7;
    border-color: #86EFAC;
    color: #166534;
}

.alert-danger {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #991B1B;
}

.alert-warning {
    background: #FEF3C7;
    border-color: #FDE68A;
    color: #92400E;
}

/* Accordion - Clean Style */
.accordion-button {
    background: var(--card-bg);
    color: var(--dark);
    font-weight: 600;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.1) 0%, rgba(14, 165, 233, 0.05) 100%);
    color: var(--primary);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

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

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        height: auto;
    }

    /* Mobile Menu: Always show all items without accordion collapse */
    .sidebar .accordion-collapse {
        display: block !important;
        visibility: visible !important;
    }

    /* Style accordion buttons as section headers on mobile */
    .sidebar .accordion-button {
        pointer-events: none;
        background: transparent !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.75rem !important;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #64748B !important;
        font-weight: 600;
        border: none !important;
        box-shadow: none !important;
    }

    .sidebar .accordion-button::after {
        display: none !important;
    }

    .dashboard-stat {
        margin-bottom: 1rem;
    }

    .navbar-brand {
        font-size: 0.9rem;
    }

    .navbar-brand img {
        height: 28px !important;
    }

    .card {
        margin-bottom: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }

    .card-body {
        padding: 1rem;
    }

    .dashboard-stat {
        padding: 1.25rem;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .navbar,
    .btn,
    .footer {
        display: none !important;
    }

    .col-md-9 {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* Bottom Navigation Bar - Mobile App Style */
.bottom-nav {
    position: fixed;
    bottom: 24px;
    /* Increased from 12px for better floating effect */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    /* More opaque for pop */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 16px;
    /* Slightly larger padding */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15),
        /* Deeper shadow */
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 1030;
    border-radius: 24px;
    /* Rounder */
    border: 1px solid rgba(255, 255, 255, 0.6);
    gap: 8px;
    /* More spacing between items */
    max-width: 90%;
    width: auto;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    color: #64748B !important;
    font-size: 0.6rem;
    font-weight: 500;
    padding: 6px 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 0 0 auto;
    border-radius: 14px;
    position: relative;
}

.bottom-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #64748B;
}

.bottom-nav-item span {
    font-family: var(--font-primary);
    font-size: 0.6rem;
    color: #64748B;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.9;
}

.bottom-nav-item:hover,
.bottom-nav-item:active,
.bottom-nav-item:focus {
    color: #0EA5E9 !important;
    text-decoration: none !important;
    outline: none;
    background: rgba(14, 165, 233, 0.1);
    transform: translateY(-4px) scale(1.05);
}

.bottom-nav-item:hover i,
.bottom-nav-item:active i,
.bottom-nav-item:focus i {
    color: #0EA5E9;
    transform: scale(1.15);
}

.bottom-nav-item:hover span,
.bottom-nav-item:active span,
.bottom-nav-item:focus span {
    color: #0EA5E9;
    opacity: 1;
}

.bottom-nav-item.active {
    color: #0EA5E9 !important;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
}

.bottom-nav-item.active i {
    color: #0EA5E9;
    transform: scale(1.2);
    filter: drop-shadow(0 2px 4px rgba(14, 165, 233, 0.3));
}

.bottom-nav-item.active span {
    color: #0EA5E9;
    opacity: 1;
    font-weight: 600;
}

/* Add bottom padding to body when bottom nav is visible - ALL SCREENS */
body {
    padding-bottom: 70px;
}

.footer {
    display: none;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .bottom-nav {
        bottom: 8px;
        padding: 6px 12px;
        border-radius: 18px;
    }

    .bottom-nav-item {
        padding: 8px 12px;
    }

    .bottom-nav-item i {
        font-size: 1.4rem;
    }

    .bottom-nav-item span {
        font-size: 0.6rem;
    }
}

/* Enhanced styling for desktop */
@media (min-width: 769px) {
    body {
        padding-bottom: 100px;
    }

    .bottom-nav {
        bottom: 16px;
        padding: 10px 20px;
        border-radius: 22px;
    }

    .bottom-nav-item {
        padding: 12px 16px;
    }

    .bottom-nav-item i {
        font-size: 1.4rem;
    }
}

/* Floating Action Button (Optional) */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-vibrant);
    color: white;
    border: none;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 30px -5px rgba(14, 165, 233, 0.4);
}

/* --- END OF VALID CSS --- */
/* The 'Royal' theme duplicates have been removed to fix conflicts. */

/* GPS Map Container */
.gps-container {
    margin-bottom: 1.5rem;
}

.gps-container #map {
    height: 400px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.location-controls {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.location-details {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

/* Footer */
.footer {
    display: none;
}