/* ========================================
   MTMS - Medical Transportation Management System
   Modern, HIPAA-Compliant Design System
   ======================================== */

:root {
    /* Primary Colors */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;

    /* Secondary Colors */
    --secondary: #64748b;
    --secondary-dark: #475569;
    --secondary-light: #94a3b8;

    /* Status Colors */
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #06b6d4;
    --info-bg: #cffafe;

    /* Trip Status Colors */
    --status-scheduled: #6366f1;
    --status-confirmed: #8b5cf6;
    --status-enroute: #f59e0b;
    --status-pickup: #06b6d4;
    --status-inprogress: #3b82f6;
    --status-near: #10b981;
    --status-arrived: #059669;
    --status-completed: #22c55e;
    --status-cancelled: #ef4444;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --footer-height: 48px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ========================================
   Base Styles
   ======================================== */
html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

@media (min-width: 1200px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.mtms-body {
    min-height: 100vh;
}

/* ========================================
   Layout Structure
   ======================================== */
.mtms-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.mtms-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================================
   Horizontal Top Navigation
   ======================================== */
.mtms-topnav {
    background: linear-gradient(90deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1040;
    box-shadow: var(--shadow-md);
    padding: 0;
}

.topnav-inner {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.25rem;
}

.mtms-topnav .sidebar-brand {
    color: white;
    flex-shrink: 0;
}

.mtms-topnav .navbar-toggler {
    color: white;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
    font-size: 1.25rem;
}

.mtms-topnav .navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.15);
}

.topnav-links {
    flex: 1;
    gap: 0.25rem;
}

.topnav-link {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem !important;
    color: rgba(255, 255, 255, 0.85) !important;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.topnav-link i {
    font-size: 1.05rem;
}

.topnav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.topnav-link.active {
    background: var(--primary);
    color: white !important;
}

.topnav-link.dropdown-toggle::after {
    margin-left: 0.35rem;
}

.topnav-dropdown {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    margin-top: 0.5rem !important;
}

.topnav-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
}

.topnav-dropdown .dropdown-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.topnav-dropdown .dropdown-item.active {
    background: var(--primary);
    color: white;
}

.topnav-dropdown .dropdown-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.topnav-right {
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ========================================
   Mobile Offcanvas Navigation
   ======================================== */
.mtms-offcanvas {
    width: 280px;
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: white;
}

.mtms-offcanvas .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mtms-offcanvas .offcanvas-body {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.mtms-offcanvas .sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 0.5rem;
}

.mtms-offcanvas .offcanvas-footer {
    padding: 0.75rem 1rem 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-section {
    padding: 0 0.25rem;
    margin-bottom: 1rem;
}

.nav-section-title {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--gray-300);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 0.125rem;
}

.sidebar-nav .nav-link i {
    font-size: 1.125rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav .nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    background: var(--primary);
    color: white;
}

.nav-badge:empty {
    display: none;
}

.nav-badge.badge-warning {
    background: var(--warning);
}

.nav-badge.badge-danger {
    background: var(--danger);
}

/* ========================================
   Header
   ======================================== */
.mtms-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
}

.page-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--gray-800);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Live Indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--success-bg);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--success);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Icon Button */
.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 1.25rem;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

/* Notifications Dropdown */
.notifications-dropdown {
    width: 360px;
    padding: 0;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
}

.notifications-dropdown .dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.notifications-dropdown .dropdown-header h6 {
    margin: 0;
    font-weight: 600;
}

.notifications-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--gray-500);
}

.notification-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.notifications-dropdown .dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
    text-align: center;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--gray-50);
}

.notification-item.unread {
    background: rgba(13, 110, 253, 0.06);
}

.notification-item .notification-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    padding-top: 0.1rem;
}

.notification-item .notification-body {
    min-width: 0;
}

.notification-item .notification-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-800);
}

.notification-item .notification-message {
    font-size: 0.8rem;
    color: var(--gray-600);
    white-space: normal;
}

.notification-item .notification-time {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 0.15rem;
}

/* ========================================
   Main Content
   ======================================== */
.mtms-content {
    flex: 1;
    padding: 1.5rem;
}

/* ========================================
   Footer
   ======================================== */
.mtms-footer {
    height: var(--footer-height);
    background: white;
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.hipaa-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: var(--success-bg);
    color: var(--success);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.hipaa-badge i {
    font-size: 0.9rem;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--primary);
}

.card-body {
    padding: 1.25rem;
}

/* ========================================
   Stats Cards
   ======================================== */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon.info {
    background: var(--info-bg);
    color: var(--info);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* ========================================
   Trip Cards & Status
   ======================================== */
.trip-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition);
    cursor: pointer;
}

.trip-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.trip-card.in-progress {
    border-left: 4px solid var(--status-inprogress);
}

.trip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.trip-number {
    font-weight: 600;
    color: var(--gray-800);
}

.trip-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.trip-status.scheduled {
    background: #e0e7ff;
    color: var(--status-scheduled);
}

.trip-status.confirmed {
    background: #ede9fe;
    color: var(--status-confirmed);
}

.trip-status.enroute {
    background: var(--warning-bg);
    color: var(--status-enroute);
}

.trip-status.pickup {
    background: var(--info-bg);
    color: var(--status-pickup);
}

.trip-status.inprogress {
    background: var(--primary-bg);
    color: var(--status-inprogress);
}

.trip-status.near {
    background: #d1fae5;
    color: var(--status-near);
}

.trip-status.completed {
    background: var(--success-bg);
    color: var(--status-completed);
}

.trip-status.cancelled {
    background: var(--danger-bg);
    color: var(--status-cancelled);
}

.trip-route {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.route-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
}

.route-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.route-dot.destination {
    background: var(--success);
}

.route-connector {
    flex: 1;
    width: 2px;
    background: var(--gray-300);
    margin: 4px 0;
}

.route-details {
    flex: 1;
}

.route-point {
    margin-bottom: 0.75rem;
}

.route-point:last-child {
    margin-bottom: 0;
}

.route-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.125rem;
}

.route-address {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.trip-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8rem;
    color: var(--gray-500);
}

.trip-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.trip-meta-item i {
    color: var(--gray-400);
}

.trip-view-map {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.trip-card.in-progress .trip-view-map {
    display: flex;
}

.trip-card.in-progress:hover .trip-view-map {
    background: var(--primary);
    color: white;
}

.live-status-badge {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: transform var(--transition-fast);
}

.live-status-badge:hover {
    transform: scale(1.05);
}

.live-dot-sm {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
    animation: live-pulse-sm 1.5s infinite;
}

@keyframes live-pulse-sm {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

/* Trip Progress Bar */
.trip-progress {
    margin: 0.75rem 0;
}

.progress {
    height: 6px;
    background: var(--gray-200);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

.progress-bar.animated {
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
    background-size: 200% 100%;
    animation: progress-animation 1.5s infinite;
}

@keyframes progress-animation {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* ========================================
   Live Tracking Animation
   ======================================== */
.vehicle-marker {
    position: relative;
}

.vehicle-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.2);
    transform: translate(-50%, -50%);
    animation: ripple 2s infinite;
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Moving Vehicle Animation */
.moving-vehicle {
    animation: vehicle-bounce 0.5s ease infinite;
}

@keyframes vehicle-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* ========================================
   Live Map Modal
   ======================================== */
.live-map-modal .modal-content {
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.live-map-modal .modal-header {
    background: linear-gradient(90deg, var(--gray-900), var(--gray-800));
    color: white;
    border-bottom: none;
}

.live-map-modal .modal-header .btn-close {
    filter: invert(1);
}

.live-map-container {
    height: 65vh;
    min-height: 320px;
    width: 100%;
    background: var(--gray-100);
    position: relative;
}

.live-map-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--gray-50, #f9fafb);
    border-top: 1px solid var(--gray-200);
}

.live-map-summary-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.live-map-summary-item i {
    color: var(--primary);
}

.live-map-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gray-400);
    text-align: center;
    padding: 1.5rem;
}

.live-map-placeholder i {
    font-size: 2.5rem;
    color: var(--primary-light);
}

.live-map-eta-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-800);
    z-index: 400;
}

/* ========================================
   Quick Action Cards (Dashboards)
   ======================================== */
.qa-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.qa-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.6rem;
    padding: 1.35rem 1rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: white;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.qa-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.qa-card i {
    font-size: 1.75rem;
}

.qa-card span {
    font-size: 0.9rem;
    font-weight: 600;
}

.qa-card .qa-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 9999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 700;
}

.qa-card.qa-blue { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.qa-card.qa-teal { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.qa-card.qa-orange { background: linear-gradient(135deg, #ea580c, #f97316); }
.qa-card.qa-pink { background: linear-gradient(135deg, #db2777, #ec4899); }
.qa-card.qa-purple { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.qa-card.qa-green { background: linear-gradient(135deg, #16a34a, #22c55e); }
.qa-card.qa-red { background: linear-gradient(135deg, #dc2626, #ef4444); }
.qa-card.qa-cyan { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.qa-card.qa-amber { background: linear-gradient(135deg, #d97706, #f59e0b); }

/* ========================================
   Address Input with Validation
   ======================================== */
.address-input-group {
    position: relative;
}

.address-input-group .form-control {
    padding-right: 2.5rem;
}

.address-validation-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.address-validation-icon.valid {
    color: var(--success);
}

.address-validation-icon.invalid {
    color: var(--danger);
}

.address-validation-icon.loading {
    color: var(--gray-400);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.address-suggestion-item {
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--gray-100);
}

.address-suggestion-item:last-child {
    border-bottom: none;
}

.address-suggestion-item:hover {
    background: var(--gray-50);
}

/* ========================================
   Odometer Input
   ======================================== */
.odometer-input {
    position: relative;
}

.odometer-display {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    background: var(--gray-900);
    color: #00ff00;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 0.5rem;
}

.odometer-input input {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    text-align: center;
}

/* ========================================
   Distance Calculator
   ======================================== */
.distance-result {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.distance-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.distance-label {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.pa-required-alert {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warning);
    font-weight: 500;
}

/* ========================================
   Multi-Leg Trip Visual
   ======================================== */
.trip-legs-visual {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    overflow-x: auto;
}

.leg-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.leg-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.leg-marker.start {
    background: var(--success);
}

.leg-marker.end {
    background: var(--danger);
}

.leg-marker.current {
    animation: pulse 1.5s infinite;
}

.leg-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 0.375rem;
    text-align: center;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leg-connector {
    flex: 1;
    height: 3px;
    background: var(--gray-300);
    min-width: 40px;
    position: relative;
}

.leg-connector.completed {
    background: var(--success);
}

.leg-connector.active {
    background: linear-gradient(90deg, var(--success), var(--primary));
    position: relative;
    overflow: hidden;
}

.leg-connector.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: leg-progress 1.5s infinite;
}

@keyframes leg-progress {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.leg-distance {
    font-size: 0.65rem;
    color: var(--gray-400);
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

/* ========================================
   Forms
   ======================================== */
.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-control {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control.is-valid {
    border-color: var(--success);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

/* ========================================
   Tables
   ======================================== */
.table {
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
}

.table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
}

/* ========================================
   Alerts
   ======================================== */
.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.alert-item.warning {
    background: var(--warning-bg);
}

.alert-item.danger {
    background: var(--danger-bg);
}

.alert-item.info {
    background: var(--info-bg);
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-item.warning .alert-icon {
    background: var(--warning);
    color: white;
}

.alert-item.danger .alert-icon {
    background: var(--danger);
    color: white;
}

.alert-item.info .alert-icon {
    background: var(--info);
    color: white;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.alert-message {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ========================================
   Utilities
   ======================================== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 767.98px) {
    .mtms-content {
        padding: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .card-body {
        padding: 1rem;
    }
}