/**
 * Pothole Detector Styles
 */

/* PWA Install Button Animation */
#installBtn {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    min-height: 100vh;
    padding: 20px;
}

/* Header */
header {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

header h1 {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.status {
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f0f0f0;
    display: inline-block;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

/* Acceleration Gauge */
.accel-gauge-card {
    position: relative;
}

.accel-gauge-container {
    width: 100%;
    height: 40px;
    background: #1a1a1a;
    border-radius: 8px;
    margin: 10px 0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.accel-gauge-bar {
    height: 100%;
    width: 0%;
    border-radius: 8px;
    transition: width 0.15s ease-out, background 0.15s ease-out;
    position: relative;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.accel-gauge-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 8px 8px 0 0;
}

/* LED segments overlay effect */
.accel-gauge-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 8px,
        rgba(0, 0, 0, 0.4) 8px,
        rgba(0, 0, 0, 0.4) 10px
    );
    pointer-events: none;
    z-index: 2;
}

.accel-gauge-value {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    margin-top: 8px;
}

/* Threshold Indicator Line on Gauge */
.threshold-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.9);
    z-index: 3;
    left: 25%; /* Updated dynamically by JS */
    pointer-events: none;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}

.threshold-indicator::after {
    content: '▼';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* Settings Panel */
.settings-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.settings-content {
    margin-top: 20px;
    transition: all 0.3s ease;
}

.settings-content.hidden {
    display: none;
}

.setting-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.setting-group:last-child {
    border-bottom: none;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.setting-group input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: border-color 0.3s ease;
}

.setting-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.setting-group input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.help-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.setting-group .btn {
    margin-right: 10px;
    margin-top: 10px;
    font-size: 14px;
    padding: 10px 20px;
}

/* Map Container */
#map {
    width: 100%;
    height: 400px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    z-index: 1;
}

/* Map Markers */
.user-location-marker {
    background: transparent;
    border: none;
}

.user-marker-dot {
    width: 20px;
    height: 20px;
    background: #4285F4;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(66, 133, 244, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
    }
}

.pothole-marker {
    background: transparent;
    border: none;
}

.pothole-marker-dot {
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: bounce 0.5s ease;
}

.pothole-marker-historic .pothole-marker-dot {
    font-size: 20px;
    opacity: 0.7;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Flash Overlay */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0);
    pointer-events: none;
    z-index: 9999;
    transition: background 0.1s ease;
}

.flash-overlay.flash-active {
    background: rgba(255, 0, 0, 0.5);
    animation: flashAnimation 0.5s ease;
}

@keyframes flashAnimation {
    0% {
        background: rgba(255, 0, 0, 0);
    }
    50% {
        background: rgba(255, 0, 0, 0.6);
    }
    100% {
        background: rgba(255, 0, 0, 0);
    }
}

/* Info Panel */
.info-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.info-panel p {
    margin-bottom: 10px;
    font-weight: 600;
    color: #667eea;
}

.info-panel ul {
    list-style: none;
    padding-left: 0;
}

.info-panel li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
    line-height: 1.5;
}

.info-panel li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* Help Content */
.help-content {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.help-content.hidden {
    display: none;
}

.help-content h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 18px;
}

.help-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.help-section:last-child {
    border-bottom: none;
}

.help-section h4 {
    color: #495057;
    font-size: 16px;
    margin-bottom: 8px;
}

.help-section p {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 8px;
}

.help-section ul {
    margin-left: 20px;
    list-style: disc;
}

.help-section li {
    color: #6c757d;
    padding: 4px 0;
}

.help-section li:before {
    content: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .status-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        width: 100%;
    }
    
    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #map {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .stats-panel {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 20px;
    }
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
}

.leaflet-popup-content {
    font-size: 14px;
    line-height: 1.6;
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.btn:focus,
input[type="range"]:focus,
input[type="checkbox"]:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .btn,
    .settings-panel,
    .flash-overlay {
        display: none;
    }
    
    #map {
        height: 500px;
    }
}
