/* Variables CSS */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Login Page */
.min-vh-100 {
    min-height: 100vh;
}

/* Vehicle Icon Animation */
.vehicle-icon {
    transition: transform 0.3s ease;
}

.vehicle-icon:hover {
    transform: scale(1.05);
}

.vehicle-icon.locked {
    color: var(--danger-color);
}

.vehicle-icon.unlocked {
    color: var(--success-color);
}

/* Action Buttons */
.action-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.action-btn:active {
    transform: scale(0.98);
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.action-btn .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Card Enhancements */
.card {
    border-radius: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

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

.status-indicator.active {
    background-color: var(--success-color);
}

.status-indicator.inactive {
    background-color: var(--danger-color);
}

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

/* Loading State */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Alert Animations */
.alert {
    animation: slideDown 0.3s ease;
}

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

/* Mobile Optimizations */
@media (max-width: 576px) {
    .card-body {
        padding: 1.5rem !important;
    }
    
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
}

/* Touch-friendly elements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* iOS recommended touch target */
    }
    
    .form-control {
        font-size: 16px; /* Prevent iOS zoom on input focus */
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Optionnel: styles pour le mode sombre */
}

/* Table Responsive */
.table-responsive {
    border-radius: 0.5rem;
}

.table td {
    vertical-align: middle;
}

/* Refresh Button */
#refreshBtn {
    transition: transform 0.3s ease;
}

#refreshBtn:active {
    transform: rotate(180deg);
}

#refreshBtn.spinning {
    animation: spin 1s linear infinite;
}

/* PWA Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 1050;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility */
.btn:focus,
.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Print Styles */
@media print {
    .navbar,
    .action-btn,
    #refreshBtn {
        display: none;
    }
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.25rem;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Carte Leaflet */
#map {
    width: 100%;
    height: 300px;
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    z-index: 1;
}

/* S'assurer que le conteneur Leaflet prend toute la taille */
#map .leaflet-container {
    height: 100%;
    width: 100%;
}

.leaflet-popup-content {
    font-size: 0.875rem;
    line-height: 1.5;
}

@media (max-width: 576px) {
    #map {
        height: 250px;
    }
}

