/* Custom styles for the immigration data visualisation app */

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Mobile table improvements */
@media (max-width: 768px) {
    .table-responsive {
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        margin-bottom: 1rem;
    }
    
    .table-responsive table {
        margin-bottom: 0;
    }
    
    /* Ensure horizontal scrolling works on mobile */
    .table-responsive::-webkit-scrollbar {
        height: 8px;
        background-color: #f1f3f4;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background-color: #c1c8cd;
        border-radius: 4px;
    }
    
    /* Make table cells more readable on mobile */
    .table td, .table th {
        white-space: nowrap;
        padding: 0.75rem 0.5rem;
    }
}

/* Navbar styling */
.navbar {
    backdrop-filter: blur(10px);
    background: rgba(102, 126, 234, 0.9) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-brand {
    font-weight: 700;
    color: white !important;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
    margin: 0 0.25rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.card {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.card-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 700;
    border-radius: 1rem 1rem 0 0 !important;
}

.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.table th[title] {
    border-bottom: 1px dotted #6c757d;
}

.table th[title]:hover {
    background-color: #e9ecef;
    border-bottom: 1px solid #495057;
}

.table th:hover {
    background-color: #e9ecef;
}

.table th i {
    color: #6c757d;
    margin-left: 0.25rem;
}

.table-responsive {
    border-radius: 0.375rem;
}

.btn {
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

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

.btn-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
}

.form-control, .form-select {
    border-radius: 0.75rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.card[title] {
    cursor: help;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.sparkline {
    display: inline-block;
    margin-left: 0.5rem;
}

.change-positive {
    color: #198754;
}

.change-negative {
    color: #dc3545;
}

.change-neutral {
    color: #6c757d;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 0.125rem solid #f3f3f3;
    border-top: 0.125rem solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.opacity-75 {
    opacity: 0.75;
}

.modal-lg {
    max-width: 800px;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .kpi-card .card-body {
        padding: 1rem 0.75rem;
    }
    
    .kpi-card h3 {
        font-size: 1.5rem;
    }
}

/* Chart styling */
.chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    margin: 0.25rem 1rem;
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    margin-right: 0.5rem;
    border-radius: 2px;
}

/* Map styling */
#map {
    border-radius: 0.375rem;
}

.map-legend {
    background: white;
    padding: 1rem;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    margin: 1rem;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Modern data cards */
.stats-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 100%);
    border: none;
    transition: all 0.3s ease;
}

.stats-card:hover {
    background: rgba(255, 255, 255, 1);
}

/* Table improvements */
.table-responsive {
    border-radius: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.table th {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    font-weight: 600;
    border: none;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
    transform: scale(1.01);
}

/* Footer modernization */
footer {
    margin-top: auto;
    background: rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

/* Loading animations */
.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 0.2rem solid rgba(102, 126, 234, 0.2);
    border-top: 0.2rem solid #667eea;
    border-radius: 50%;
    animation: modernSpin 1s linear infinite;
}

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

/* Utility classes */
.cursor-pointer {
    cursor: pointer;
}

.border-start-primary {
    border-left: 0.25rem solid #667eea !important;
}

.border-start-warning {
    border-left: 0.25rem solid #ffc107 !important;
}

.border-start-success {
    border-left: 0.25rem solid #4facfe !important;
}

.border-start-info {
    border-left: 0.25rem solid #00f2fe !important;
}

/* Scroll improvements */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Hero Section Navigation Cards */
.hero-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    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 1000 100" fill="rgba(255,255,255,0.1)"><polygon points="0,100 1000,0 1000,100"/></svg>') no-repeat bottom;
    background-size: cover;
}

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

.hero-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.text-gradient {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.1rem;
    line-height: 1.5;
    opacity: 0.9;
}

.hero-stats {
    margin: 1.5rem 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 2rem 1rem;
    border-radius: 1.25rem;
    text-align: center;
    backdrop-filter: blur(10px);
    border: none;
    transition: all 0.3s ease;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 0.75rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(26, 26, 46, 0.8) !important;
    margin-bottom: 0.5rem;
}

.stat-date {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(26, 26, 46, 0.6) !important;
    margin-top: 0;
}

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

.nav-card {
    display: block;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1rem;
    padding: 1rem;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: #333;
}

.nav-card:hover::before {
    opacity: 1;
}

.nav-card-icon {
    position: relative;
    z-index: 2;
    width: 50px;
    height: 50px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

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

.crossings-card .nav-card-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.detention-card .nav-card-icon {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.authorities-card .nav-card-icon {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.nav-card-content {
    position: relative;
    z-index: 2;
    flex: 1;
}

.nav-card-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.nav-card-content p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.nav-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.stat-item {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-card-arrow {
    position: absolute;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: #667eea;
    opacity: 0.6;
    transition: all 0.3s ease;
    z-index: 2;
}

.nav-card:hover .nav-card-arrow {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

.nav-card:hover .nav-card-icon {
    transform: scale(1.1);
}

@media (max-width: 992px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .nav-card {
        padding: 1.25rem;
    }
    
    .nav-card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .nav-card-content h4 {
        font-size: 1.1rem;
    }
    
    .nav-card-content p {
        font-size: 0.9rem;
    }
}