/* SafeScape Custom Styles */
:root {
    /* City of Minneapolis Government Color Palette - Clean & Professional */
    --primary-color: #003865;     /* Navy Blue - Primary brand color */
    --secondary-color: #005696;    /* Medium Blue - Links and accents */
    --accent-color: #0077C0;       /* Bright Blue - Interactive elements */
    --success-color: #008542;     /* Green - Success states */
    --warning-color: #FFA500;     /* Orange - Warnings (accessible) */
    --danger-color: #C41E3A;      /* Red - Errors/alerts */
    --info-color: #0096D6;        /* Light Blue - Information */
    
    /* Gray scale - Government standard */
    --light-color: #FFFFFF;
    --gray-100: #F7F7F7;
    --gray-200: #EFEFEF;
    --gray-300: #E0E0E0;
    --gray-400: #CCCCCC;
    --gray-500: #999999;
    --gray-600: #666666;
    --gray-700: #424242;
    --gray-800: #333333;
    --dark-color: #212121;
    
    /* Gradients and Effects */
    --primary-gradient: linear-gradient(135deg, #003865 0%, #005696 100%);
    --light-gradient: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
    
    /* Shadows - softer for professional look */
    --shadow-xs: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-light: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-medium: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-heavy: 0 8px 25px rgba(0,0,0,0.12);
    --shadow-color: 0 8px 25px rgba(0,56,101,0.15);
    
    /* Design System */
    --border-radius: 0.5rem;
    --border-radius-sm: 0.25rem;
    --border-radius-lg: 0.75rem;
    --transition: all 0.2s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
}

/* Base Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #212121;
    background-color: #FFFFFF;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-inter {
    font-family: 'Inter', sans-serif;
}

/* Enhanced Card Styles */
.card {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    background-color: #ffffff;
}

.card:hover {
    box-shadow: var(--shadow-heavy);
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.card-header {
    border-bottom: 1px solid var(--gray-200);
    background-color: var(--gray-100);
    color: var(--secondary-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* Hero Section */
.hero-section {
    background: var(--primary-gradient);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

/* Navigation Enhancements */
.navbar {
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-light);
}

.navbar-brand {
    font-weight: 900;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    transform: translateY(-1px);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 100%;
}

/* Statistics Cards */
.stat-card {
    border: none;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-heavy);
}

/* Feature Cards */
.feature-card {
    padding: 2rem;
    transition: var(--transition);
    border-radius: var(--border-radius);
}

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

.feature-card i {
    margin-bottom: 1rem;
    transition: var(--transition);
}

.feature-card:hover i {
    transform: scale(1.1);
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 1rem;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Main section chart containers */
.section-chart-container {
    position: relative;
    width: 100%;
    min-height: 350px;
    height: 350px;
    padding: 10px;
}

/* Responsive chart sizing */
@media (max-width: 992px) {
    .section-chart-container {
        min-height: 300px;
        height: 300px;
    }
}

@media (min-width: 1200px) {
    .section-chart-container {
        min-height: 400px;
        height: 400px;
    }
}

.roi-chart-container {
    height: 300px;
}

/* Main dashboard sections styling */
.dashboard-section {
    padding: 3rem 0;
}

.dashboard-section h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

/* Card consistency for main sections */
.dashboard-card {
    height: 100%;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-heavy);
    transform: translateY(-3px);
}

/* Map Styles */
#map {
    height: 500px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(0,0,0,0.1);
}

.leaflet-popup-content {
    font-family: 'Inter', sans-serif;
    line-height: 1.4;
}

.map-marker {
    background-color: var(--primary-color);
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: var(--shadow-medium);
}

/* AI Assistant Styles */
.ai-chat {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: #ffffff;
    border-radius: var(--border-radius);
    color: #1a1a1a;
    border: 1px solid rgba(0,0,0,0.1);
}

.ai-chat::-webkit-scrollbar {
    width: 6px;
}

.ai-chat::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-chat::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ai-chat::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.message {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    animation: fadeInUp 0.3s ease;
}

.user-message {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    margin-left: 2rem;
    border-left: 4px solid var(--primary-color);
    color: #1a1a1a;
}

.ai-message {
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%);
    margin-right: 2rem;
    border-left: 4px solid var(--success-color);
    color: #1a1a1a;
}

/* Survey Styles */
.survey-question {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-light);
    border-left: 4px solid var(--primary-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Policy Analysis Styles */
.policy-card {
    border: none;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.policy-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.policy-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.roi-indicator {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 2rem;
    line-height: 1;
}

.scenario-builder {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    color: #1a1a1a;
    border: 1px solid rgba(0,0,0,0.1);
}

.scenario-builder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(13,110,253,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>');
    opacity: 0.5;
}

.scenario-builder > * {
    position: relative;
    z-index: 2;
}

/* Button Enhancements */
.btn {
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.btn:hover::before {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
}

.btn > * {
    position: relative;
    z-index: 1;
}

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

.btn-primary {
    background: var(--primary-gradient);
    border: none;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Progress Bars */
.progress {
    border-radius: var(--border-radius);
    background-color: rgba(0,0,0,0.1);
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Badges */
.badge {
    font-weight: 600;
    padding: 0.5em 0.8em;
    border-radius: var(--border-radius);
}

/* Form Enhancements */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid rgba(0,0,0,0.15);
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.input-group-text {
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.15);
    font-weight: 600;
    color: #343a40;
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    background: var(--primary-gradient);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Footer */
footer {
    background: #e6f3ff !important;
    color: #212121 !important;
}

footer a {
    color: #003865;
    transition: var(--transition);
}

footer a:hover {
    color: #0077C0;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section .display-4 {
        font-size: 2.5rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .chart-container {
        height: 300px;
    }
    
    #map {
        height: 400px;
    }
    
    .scenario-builder {
        padding: 1rem;
    }
    
    .roi-indicator {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 3rem 0;
    }
    
    .feature-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .ai-chat {
        max-height: 300px;
    }
    
    .user-message, .ai-message {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #212529;
        --dark-color: #f8f9fa;
    }
    
    body {
        background-color: #ffffff !important;
        color: #1a1a1a !important;
    }
    
    .card {
        background-color: #ffffff !important;
        border-color: rgba(0,0,0,0.1) !important;
        color: #1a1a1a !important;
    }
    
    .navbar {
        background-color: rgba(255, 255, 255, 0.95) !important;
    }
}

/* Print Styles */
@media print {
    .navbar, footer, .btn, .modal {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .hero-section {
        background: #f8f9fa !important;
        color: #212529 !important;
    }
}

/* Accessibility Enhancements */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus states */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Enhanced contrast improvements for professional readability */
.text-muted {
    color: #495057 !important;
}

.display-4, .display-3, .display-2, .display-1 {
    color: #1a1a1a;
    font-weight: 700;
}

.small, small {
    color: #495057;
}

.form-control, .form-select, .form-control:focus, .form-select:focus {
    color: #1a1a1a;
}

.badge {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Statistics text contrast */
.stat-value {
    color: #1a1a1a;
    font-weight: 700;
}

/* Navigation text improvements */
.navbar-nav .nav-link {
    color: rgba(0,0,0,0.85) !important;
}

.navbar-nav .nav-link:hover {
    color: rgba(0,0,0,1) !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
