/* Apple-Style Color Theme */
:root {
    /* Apple System Colors - Light Mode */
    --apple-blue: #007AFF;
    --apple-green: #34C759;
    --apple-red: #FF3B30;
    --apple-orange: #FF9500;
    --apple-yellow: #FFCC00;
    --apple-purple: #AF52DE;
    --apple-teal: #5AC8FA;
    --apple-gray: #8E8E93;

    /* Apple Background Colors - Light Mode */
    --apple-bg-primary: #FFFFFF;
    --apple-bg-secondary: #F2F2F7;
    --apple-bg-tertiary: #FFFFFF;
    --apple-bg-grouped: #EFEFF4;

    /* Apple Text Colors - Light Mode */
    --apple-text-primary: #000000;
    --apple-text-secondary: rgba(60, 60, 67, 0.6);
    --apple-text-tertiary: rgba(60, 60, 67, 0.3);
    --apple-text-quaternary: rgba(60, 60, 67, 0.18);

    /* Apple Separator */
    --apple-separator: #C6C6C8;
    --apple-fill: rgba(120, 120, 128, 0.16);
}

/* Dark Mode Colors */
@media (prefers-color-scheme: dark) {
    :root {
        /* Apple Background Colors - Dark Mode */
        --apple-bg-primary: #000000;
        --apple-bg-secondary: #1C1C1E;
        --apple-bg-tertiary: #2C2C2E;
        --apple-bg-grouped: #000000;

        /* Apple Text Colors - Dark Mode */
        --apple-text-primary: #FFFFFF;
        --apple-text-secondary: rgba(235, 235, 245, 0.6);
        --apple-text-tertiary: rgba(235, 235, 245, 0.3);
        --apple-text-quaternary: rgba(235, 235, 245, 0.18);

        /* Apple Separator - Dark Mode */
        --apple-separator: #38383A;
        --apple-fill: rgba(120, 120, 128, 0.36);
    }
}

/* Google Maps Style Layout */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--apple-bg-primary);
    color: var(--apple-text-primary);
}

/* Sidebar Styles */
#sidebar {
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Map Styles */
#map {
    position: relative;
    z-index: 1;
}

/* Custom Leaflet Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: none;
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

.leaflet-popup-tip {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Custom Marker Styles - Apple Colors */
.marker-green {
    background-color: var(--apple-green);
    border: 2px solid var(--apple-bg-primary);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.marker-red {
    background-color: var(--apple-red);
    border: 2px solid var(--apple-bg-primary);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.marker-gray {
    background-color: var(--apple-gray);
    border: 2px solid var(--apple-bg-primary);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Popup Content Styles - Apple Design */
.popup-header {
    background: var(--apple-blue);
    color: var(--apple-bg-primary);
    padding: 12px 16px;
    margin: 0;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
}

.popup-body {
    padding: 16px;
    background-color: var(--apple-bg-primary);
    color: var(--apple-text-primary);
}

.popup-footer {
    padding: 12px 16px;
    background-color: var(--apple-bg-secondary);
    border-radius: 0 0 12px 12px;
    border-top: 1px solid var(--apple-separator);
}

/* Stats Cards Animation */
.stats-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Filter Form Styles - Apple Design */
.filter-section {
    backdrop-filter: blur(20px);
    background-color: rgba(242, 242, 247, 0.8);
    border-radius: 16px;
    border: 1px solid var(--apple-separator);
}

/* Mobile Responsive */
@media (max-width: 640px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    #sidebar.show {
        transform: translateX(0);
    }

    .sm\:ml-80 {
        margin-left: 0 !important;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Custom Scrollbar */
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Map Controls - Apple Design */
.map-controls {
    backdrop-filter: blur(20px);
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    border: 1px solid var(--apple-separator);
}

/* Legend Styles */
.legend-item {
    transition: background-color 0.2s ease-in-out;
}

.legend-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Button Hover Effects - Apple Design */
.btn-primary {
    transition: all 0.2s ease-in-out;
    background-color: var(--apple-blue);
    border-radius: 12px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    background-color: var(--apple-blue);
    opacity: 0.8;
}

/* Navigation Styles - Apple Design */
nav {
    backdrop-filter: blur(20px);
    background-color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid var(--apple-separator);
}

/* Status Badge Styles - Apple Design */
.status-badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active {
    background-color: rgba(52, 199, 89, 0.15);
    color: var(--apple-green);
}

.status-inactive {
    background-color: rgba(255, 59, 48, 0.15);
    color: var(--apple-red);
}

.status-trained {
    background-color: rgba(0, 122, 255, 0.15);
    color: var(--apple-blue);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Apple-Style Smooth Animations */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.scale-on-hover:hover {
    transform: scale(1.02);
}

.button-press:active {
    transform: scale(0.98);
}

/* Input Focus Styles */
.input-focus:focus {
    transform: scale(1.01);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg,
        var(--apple-bg-secondary) 25%,
        var(--apple-bg-grouped) 50%,
        var(--apple-bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

/* Glass Effect */
.glass-effect {
    backdrop-filter: blur(20px) saturate(180%);
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-effect-dark {
    backdrop-filter: blur(20px) saturate(180%);
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Smooth Scrollbar */
.smooth-scroll {
    scroll-behavior: smooth;
}

.smooth-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.smooth-scroll::-webkit-scrollbar-track {
    background: var(--apple-bg-secondary);
    border-radius: 10px;
}

.smooth-scroll::-webkit-scrollbar-thumb {
    background: var(--apple-gray);
    border-radius: 10px;
    border: 2px solid var(--apple-bg-secondary);
}

.smooth-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--apple-text-secondary);
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

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

.ripple:active::before {
    width: 300px;
    height: 300px;
}
