/* ===== MODERN DFU-TRACK STYLES ===== */

/* Global Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --white: #ffffff;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== GLOBAL STYLES ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
    margin: 0;
    padding: 0;
}

/* ===== SPLASH SCREEN STYLES ===== */
.splash-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.splash-container {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 4rem 3rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    min-width: 350px;
}

.logo-container {
    position: relative;
    display: inline-block;
}

.splash-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    animation: logoFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow 2s ease-in-out infinite alternate;
}

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

@keyframes glow {
    0% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.custom-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.spinner-circle {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spinnerBounce 1.4s ease-in-out infinite both;
}

.delay-1 { animation-delay: 0.16s; }
.delay-2 { animation-delay: 0.32s; }

@keyframes spinnerBounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* ===== NAVBAR STYLES ===== */
.custom-navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg);
    padding: 1rem 0;
    z-index: 1000;
}

.navbar-brand {
    text-decoration: none;
    color: var(--white) !important;
    font-weight: 600;
}

.brand-logo-container {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 8px;
}

.brand-text {
    line-height: 1.2;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    display: block;
}

.brand-subtitle {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 400;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white) !important;
}

.navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white) !important;
}

/* ===== HOME PAGE STYLES ===== */
.home-body {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    padding-top: 80px;
}

.hero-section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(37, 99, 235, 0.05) 100%);
    pointer-events: none;
}

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

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.hero-description {
    font-size: 1.125rem;
    color: var(--secondary-color);
    line-height: 1.8;
    max-width: 500px;
}

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

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
}

.stat-label {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.875rem;
}

.hero-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-left: 2rem;
}

.feature-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.primary-card .card-gradient-bg {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.secondary-card .card-gradient-bg {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--dark-color) 100%);
}

.card-gradient-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.card-content {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.card-icon-container {
    position: relative;
    flex-shrink: 0;
}

.card-icon-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 50%;
    opacity: 0.1;
}

.disabled-card .card-icon-bg {
    background: linear-gradient(135deg, var(--secondary-color), var(--dark-color));
}

.card-text {
    flex-grow: 1;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--dark-color);
}

.card-description {
    color: var(--secondary-color);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.card-features {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.feature-tag {
    background: var(--light-color);
    color: var(--secondary-color);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.feature-tag.disabled {
    opacity: 0.6;
}

.card-action {
    margin-top: auto;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light)) !important;
    color: var(--white) !important;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.action-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color)) !important;
    transform: translateX(4px);
    color: var(--white) !important;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.action-btn.disabled {
    background: linear-gradient(135deg, var(--secondary-color), #94a3b8) !important;
    cursor: not-allowed;
    color: var(--white) !important;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

.action-btn.disabled:hover {
    transform: none !important;
    background: linear-gradient(135deg, var(--secondary-color), #94a3b8) !important;
}

.coming-soon-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, var(--warning-color), #ea580c);
    color: var(--white);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== MAPPING PAGE STYLES ===== */
.mapping-body {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    padding-top: 80px;
}

/* Select2 Z-index and Height Fixes */
.select2-container {
    z-index: 9999 !important;
}

.select2-dropdown {
    z-index: 9999 !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-lg) !important;
}

.select2-container--bootstrap-5 .select2-selection--single {
    height: 58px !important; /* Match button height */
    border: 2px solid #e2e8f0 !important;
    border-radius: var(--border-radius) !important;
    font-size: 1rem !important;
    line-height: 54px !important; /* Adjust for border */
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 54px !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    color: var(--dark-color) !important;
    text-align: center !important; /* Center align text */
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    text-align: center !important; /* Center align placeholder */
    color: var(--secondary-color) !important;
}

.select2-results__option {
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem !important;
    text-align: center !important; /* Center align dropdown options */
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 54px !important;
    right: 1rem !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25) !important;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 0.5rem !important;
    font-size: 0.95rem !important;
    text-align: center !important; /* Center align search field */
}

.select2-results__option--highlighted {
    background-color: var(--primary-color) !important;
    color: white !important;
}

/* Mobile responsive Select2 center alignment */
@media (max-width: 992px) {
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        line-height: 50px !important;
        text-align: center !important;
    }
}

@media (max-width: 768px) {
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        line-height: 46px !important;
        text-align: center !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

@media (max-width: 576px) {
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        line-height: 44px !important;
        text-align: center !important;
    }
}

.select2-dropdown-custom {
    z-index: 99999 !important;
}

.select2-container--open .select2-dropdown {
    z-index: 99999 !important;
}

/* Ensure Select2 dropdown is always on top */
.select2-dropdown {
    z-index: 99999 !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-xl) !important;
    margin-top: 2px !important;
}

.main-content {
    min-height: calc(100vh - 80px);
    position: relative;
    z-index: 1;
}

.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 2.5rem 0;
    margin-bottom: 3rem;
}

.page-title-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-icon-container {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.breadcrumb-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-link:hover {
    color: var(--white);
}

.breadcrumb-separator {
    color: rgba(255, 255, 255, 0.6);
}

.breadcrumb-current {
    color: var(--white);
    font-weight: 600;
}

.search-section {
    margin-bottom: 3rem;
    position: relative;
    z-index: 1000; /* High z-index for Select2 */
}

.search-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    z-index: 1000;
}

.search-card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.search-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
}

.search-card-body {
    padding: 2rem;
}

.select-container {
    position: relative;
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.select2-custom {
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.custom-search-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: var(--border-radius);
    padding: 0;
    height: 58px; /* Match Select2 height exactly */
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-search-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.custom-search-btn:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
}

.results-section {
    margin-bottom: 3rem;
}

.result-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.result-card:hover {
    box-shadow: var(--shadow-lg);
}

.result-card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.result-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
}

.map-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.analysis-icon {
    background: linear-gradient(135deg, var(--success-color), #10b981);
}

.result-card-body {
    padding: 2rem;
}

.interactive-map {
    height: 450px;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.stat-card {
    background: var(--white);
    border: 2px solid #f1f5f9;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.prevalence-card::before {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.control-card::before {
    background: linear-gradient(135deg, var(--warning-color), #ea580c);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--secondary-color);
    font-size: 1.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.stat-unit {
    font-size: 0.875rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* Cluster-specific styling */
.cluster-card.cluster-1 {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.cluster-card.cluster-1::before {
    background: linear-gradient(135deg, var(--success-color), #10b981);
}

.cluster-card.cluster-1 .stat-value {
    color: var(--success-color);
}

.cluster-card.cluster-2 {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.cluster-card.cluster-2::before {
    background: linear-gradient(135deg, var(--warning-color), #ea580c);
}

.cluster-card.cluster-2 .stat-value {
    color: var(--warning-color);
}

.cluster-card.cluster-3 {
    border-color: var(--danger-color);
    background: linear-gradient(135deg, #fef2f2, #fecaca);
}

.cluster-card.cluster-3::before {
    background: linear-gradient(135deg, var(--danger-color), #b91c1c);
}

.cluster-card.cluster-3 .stat-value {
    color: var(--danger-color);
}

.cluster-card.cluster-4 {
    border-color: var(--dark-color);
    background: linear-gradient(135deg, #f9fafb, #e5e7eb);
}

.cluster-card.cluster-4::before {
    background: linear-gradient(135deg, var(--dark-color), #111827);
}

.cluster-card.cluster-4 .stat-value {
    color: var(--dark-color);
}

.analysis-description {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #bfdbfe;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.description-header {
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.description-content {
    color: var(--secondary-color);
    line-height: 1.7;
    margin: 0;
}

.risk-legend {
    background: #f8fafc;
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.legend-header {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--white);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.risk-1 { background: linear-gradient(135deg, var(--success-color), #10b981); }
.risk-2 { background: linear-gradient(135deg, var(--warning-color), #ea580c); }
.risk-3 { background: linear-gradient(135deg, var(--danger-color), #b91c1c); }
.risk-4 { background: linear-gradient(135deg, var(--dark-color), #111827); }

.legend-text strong {
    display: block;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.875rem;
}

.legend-text small {
    color: var(--secondary-color);
    font-size: 0.75rem;
}

/* ===== FOOTER STYLES ===== */
.custom-footer {
    background: var(--white);
    border-top: 1px solid #e2e8f0;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.footer-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.footer-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.footer-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.footer-link:hover {
    color: var(--primary-color);
}

/* Mobile Footer Styles */
@media (max-width: 768px) {
    .custom-footer {
        padding: 1.5rem 0;
        text-align: center;
    }
    
    .footer-brand {
        justify-content: center;
        margin-bottom: 1.5rem;
    }
    
    .footer-brand h6 {
        font-size: 1rem;
    }
    
    .footer-brand small {
        font-size: 0.8rem;
    }
    
    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .footer-link {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    .custom-footer .row > div {
        text-align: center !important;
    }
    
    .custom-footer p {
        font-size: 0.8rem;
        margin-bottom: 0;
    }
}

/* ===== CUSTOM MAP STYLES ===== */
.custom-marker {
    background: none;
    border: none;
}

.marker-pin {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--danger-color), #b91c1c);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    animation: markerBounce 2s ease-in-out infinite;
}

.marker-pin i {
    color: var(--white);
    transform: rotate(45deg);
    font-size: 14px;
}

@keyframes markerBounce {
    0%, 100% { transform: rotate(-45deg) translateY(0); }
    50% { transform: rotate(-45deg) translateY(-5px); }
}

.custom-popup {
    text-align: center;
    padding: 0.5rem;
}

/* ===== NOTIFICATIONS ===== */
.notification-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1050;
    min-width: 300px;
    animation: slideInRight 0.3s ease;
}

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

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .hero-cards {
        padding-left: 0;
    }
    
    .hero-title {
        font-size: 3rem;
    }
}

@media (max-width: 992px) {
    .page-title {
        font-size: 2rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .search-card-body,
    .result-card-body {
        padding: 1.5rem;
    }
    
    .legend-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    /* Select2 mobile adjustments */
    .select2-container--bootstrap-5 .select2-selection--single {
        height: 54px !important;
        line-height: 50px !important;
    }
    
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        line-height: 50px !important;
    }
    
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
        height: 50px !important;
    }
    
    .custom-search-btn {
        height: 54px;
    }
}

@media (max-width: 768px) {
    .splash-container {
        margin: 1rem;
        padding: 2rem;
    }
    
    .splash-logo {
        width: 80px;
        height: 80px;
    }
    
    .hero-title {
        font-size: 2rem;
        text-align: center;
    }
    
    .hero-description {
        text-align: center;
    }
    
    .page-header {
        padding: 1.5rem 0;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .page-title-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .breadcrumb-nav {
        align-self: flex-start;
        margin-top: 1rem;
    }
    
    .search-card-header,
    .search-card-body,
    .result-card-header,
    .result-card-body {
        padding: 1rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    .card-content {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .legend-grid {
        grid-template-columns: 1fr;
    }
    
    .interactive-map {
        height: 300px;
    }
    
    /* Mobile Select2 and Button adjustments */
    .search-section .row.g-3 {
        gap: 1rem !important;
    }
    
    .select2-container--bootstrap-5 .select2-selection--single {
        height: 50px !important;
        line-height: 46px !important;
        font-size: 0.9rem !important;
    }
    
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        line-height: 46px !important;
        padding-left: 0.75rem !important;
    }
    
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
        height: 46px !important;
        right: 0.75rem !important;
    }
    
    .custom-search-btn {
        height: 50px;
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }
    
    .select-container .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .button-container .form-label {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .brand-title {
        font-size: 1rem;
    }
    
    .brand-subtitle {
        font-size: 0.7rem;
    }
    
    .hero-stats {
        margin: 1rem 0;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .custom-search-btn {
        font-size: 0.85rem;
    }
    
    /* Very small mobile adjustments */
    .search-card-header h5 {
        font-size: 1rem;
    }
    
    .search-card-header small {
        font-size: 0.8rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .page-subtitle {
        font-size: 0.9rem;
    }
    
    .select2-container--bootstrap-5 .select2-selection--single {
        height: 48px !important;
        line-height: 44px !important;
        font-size: 0.85rem !important;
    }
    
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        line-height: 44px !important;
    }
    
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
        height: 44px !important;
    }
    
    .custom-search-btn {
        height: 48px;
        font-size: 0.8rem;
    }
}

/* ===== UTILITIES ===== */
.bg-primary-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light)) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== ANALYTICS SECTION STYLES ===== */
.analytics-section {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    padding: 80px 0;
}

.section-header {
    max-width: 800px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.section-description {
    font-size: 1.1rem;
    color: var(--secondary-color);
    line-height: 1.7;
}

/* Summary Statistics Cards */
.stat-summary-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.stat-icon-container {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-content .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-content .stat-label {
    font-size: 1rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin-bottom: 1rem;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-trend.positive {
    color: var(--success-color);
}

.stat-trend.warning {
    color: var(--warning-color);
}

.stat-trend.danger {
    color: var(--danger-color);
}

/* Chart Cards */
.chart-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    height: 100%;
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: var(--shadow-lg);
}

.chart-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: between;
    background: linear-gradient(135deg, #f8fafc, #ffffff);
}

.chart-title-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.chart-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.chart-subtitle {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--dark-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.chart-controls .btn-group {
    display: flex;
    gap: 5px;
}

.chart-controls .btn-group .btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.chart-controls .btn-group .btn:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--dark-bg);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.chart-controls .btn-group .btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--dark-bg);
    border-color: var(--primary-color);
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.4);
}

.chart-body {
    padding: 1.5rem;
}

/* Insights Section */
.insights-section {
    margin-top: 4rem;
}

.insights-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #e2e8f0;
    height: 100%;
}

.insights-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.insights-icon {
    background: linear-gradient(135deg, var(--warning-color), #fbbf24);
    color: var(--white);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.insights-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.insights-subtitle {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    background: #f8fafc;
    border-left: 4px solid var(--primary-color);
}

.insight-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--white);
    flex-shrink: 0;
}

.insight-icon.risk-high {
    background: var(--danger-color);
}

.insight-icon.risk-medium {
    background: var(--warning-color);
}

.insight-icon.risk-low {
    background: var(--success-color);
}

.insight-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--dark-color);
}

/* Action Card */
.action-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.action-header {
    margin-bottom: 1.5rem;
}

.action-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0;
}

.action-description {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.action-btn {
    background: var(--white);
    color: var(--primary-color);
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn:hover {
    background: #f1f5f9;
    color: var(--primary-dark);
    transform: translateY(-2px);
    text-decoration: none;
}

/* Custom Tooltip Styles */
.custom-tooltip {
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }
    
    .stat-summary-card {
        padding: 1.5rem;
    }
    
    .stat-content .stat-number {
        font-size: 2rem;
    }
}

/* Option Cards Styling */
.option-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.option-card:hover::before {
    left: 100%;
}

.option-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 35px rgba(52, 152, 219, 0.2);
    background: linear-gradient(135deg, var(--card-bg), rgba(52, 152, 219, 0.05));
}

.option-icon {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.option-content {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.option-title {
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.option-description {
    color: var(--secondary-color);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0;
}

.option-arrow {
    margin-top: auto;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.option-card:hover .option-arrow {
    opacity: 1;
    transform: translateX(5px);
}

/* Info Card Styling */
.info-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    margin-top: 2rem;
}

.info-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-header h4 {
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    color: var(--secondary-color);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.info-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

/* Responsive Design for Options */
@media (max-width: 768px) {
    .option-card {
        margin-bottom: 1.5rem;
        padding: 1.5rem;
    }
    
    .option-title {
        font-size: 1.25rem;
    }
    
    .option-description {
        font-size: 0.9rem;
    }
    
    .info-card {
        padding: 1.5rem;
        margin-top: 1.5rem;
    }
}

/* Hero Tips Styling */
.hero-tips {
    background: rgba(52, 152, 219, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    border-left: 4px solid var(--primary-color);
    margin-top: 2rem;
}

.tips-header {
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: var(--text-color);
}

.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-list li {
    color: var(--dark-color);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.tips-list li span {
    color: var(--dark-color);
    font-weight: 500;
}

.tips-list li:last-child {
    margin-bottom: 0;
}

/* Upload Form Styling */
.upload-area {
    border: 2px dashed rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.upload-content {
    width: 100%;
    z-index: 2;
    position: relative;
}

.upload-icon {
    font-size: 3.5rem;
    color: #6c757d;
    margin-bottom: 1rem;
    display: block;
}

.upload-title {
    color: #343a40 !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
}

.upload-description {
    color: #6c757d !important;
    font-size: 1rem !important;
    margin-bottom: 1.5rem !important;
}

.upload-formats {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.format-tag {
    background: rgba(0, 0, 0, 0.1);
    color: #495057;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.image-preview {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 250px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

.btn-loader {
    margin-left: 0.5rem;
}

/* Results Styling */
.result-image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.result-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.detection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.detection-info {
    margin-top: 1rem;
}

.grade-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1.1rem;
}

.grade-badge.grade-1 {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.grade-badge.grade-2 {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.grade-badge.grade-3 {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
}

.grade-badge.grade-4 {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.grade-badge.grade-5 {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
}

.grade-badge.grade-none {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.confidence-score {
    font-size: 1rem;
    color: var(--secondary-color);
}

.confidence-label {
    font-weight: 500;
}

.confidence-value {
    font-weight: 600;
    color: var(--primary-color);
}

.cluster-visualization {
    margin-bottom: 1.5rem;
}

.cluster-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--success-color), #27ae60);
    color: white;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1.1rem;
}

.cluster-description {
    margin: 1rem 0;
}

.severity-indicator {
    width: 100%;
}

.severity-bar {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.severity-fill {
    height: 100%;
    transition: width 1s ease;
    border-radius: 6px;
}

.severity-fill.severity-1 {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.severity-fill.severity-2 {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.severity-fill.severity-3 {
    background: linear-gradient(90deg, #e67e22, #d35400);
}

.severity-fill.severity-4 {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.severity-fill.severity-5 {
    background: linear-gradient(90deg, #8e44ad, #9b59b6);
}

.severity-fill.severity-none {
    background: linear-gradient(90deg, #95a5a6, #7f8c8d);
}

.severity-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary-color);
}

/* Success gradient for results section */
.bg-success-gradient {
    background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .upload-area {
        min-height: 250px;
        padding: 1.5rem;
    }
    
    .upload-title {
        font-size: 1.25rem;
    }
    
    .upload-description {
        font-size: 0.9rem;
    }
    
    .result-image {
        max-height: 200px;
    }
}    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .chart-controls {
        width: 100%;
        justify-content: flex-end;
    }
    
    .insights-card,
    .action-card {
        padding: 1.5rem;
    }
    
    .insight-item {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 576px) {
    .analytics-section {
        padding: 60px 0;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .chart-body {
        padding: 1rem;
    }
}

/* ===== CAMERA REALTIME STYLING ===== */

/* Camera Container */
.camera-container {
    width: 100%;
}

.camera-area {
    position: relative;
    width: 100%;
    min-height: 300px;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    background: rgba(255, 255, 255, 0.95);
    text-align: center;
    border-radius: var(--border-radius);
}

.camera-placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.camera-placeholder-title {
    color: var(--dark-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.camera-placeholder-description {
    color: var(--secondary-color);
    font-size: 1rem;
    margin: 0;
}

#cameraVideo {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
}

#detectionCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Camera Controls */
.camera-controls {
    padding: 1rem 0;
}

.detection-toggle .form-check {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.detection-toggle .form-check-label {
    color: var(--dark-color);
    font-weight: 500;
}

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

/* Realtime Results Styling */
.current-detection {
    padding: 1rem;
}

.grade-badge {
    margin-bottom: 1rem;
}

.detection-status {
    font-size: 0.9rem;
}

.status-indicator {
    font-weight: 500;
}

/* Detection History */
.detection-history {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.history-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
}

.grade-mini {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.grade-mini.grade-1 { background: var(--success-color); }
.grade-mini.grade-2 { background: #f39c12; }
.grade-mini.grade-3 { background: #e67e22; }
.grade-mini.grade-4 { background: #e74c3c; }
.grade-mini.grade-5 { background: #8e44ad; }

.confidence-mini {
    font-weight: 600;
    color: var(--primary-color);
}

.time-mini {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* Statistics */
.stats-list {
    padding: 0.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: var(--secondary-color);
}

.stat-value {
    font-weight: 600;
    color: var(--primary-color);
}

/* Enhanced status indicators */
.status-indicator {
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-indicator i {
    animation: pulse 2s infinite;
}

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

/* Enhanced grade badges */
.grade-badge {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
}

.grade-none {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: var(--secondary-color);
    border-color: #e2e8f0;
}

.grade-1 {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    border-color: #22c55e;
}

.grade-2 {
    background: linear-gradient(135deg, #fef3c7, #fed7aa);
    color: #92400e;
    border-color: #f59e0b;
}

.grade-3 {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #991b1b;
    border-color: #ef4444;
}

.grade-4 {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    border-color: #7f1d1d;
}

.grade-5 {
    background: linear-gradient(135deg, #7c2d12, #581c87);
    color: white;
    border-color: #3c1a78;
}

.grade-face {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #92400e;
    border-color: #d97706;
    animation: faceWarning 2s infinite;
}

@keyframes faceWarning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Enhanced Detection Cards */
.detection-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

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

.detection-image-container {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.detection-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.detection-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-md);
}

.severity-ringan {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    border: 2px solid #22c55e;
}

.severity-sedang {
    background: linear-gradient(135deg, #fef3c7, #fed7aa);
    color: #92400e;
    border: 2px solid #f59e0b;
}

.severity-berat {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #991b1b;
    border: 2px solid #ef4444;
}

.severity-sangat-berat {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    border: 2px solid #7f1d1d;
}

.severity-kritis {
    background: linear-gradient(135deg, #7c2d12, #581c87);
    color: white;
    border: 2px solid #3c1a78;
}

.detection-info {
    padding: 1.25rem;
}

.detection-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.detection-title {
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    font-size: 1rem;
}

.detection-time {
    font-size: 0.8rem;
    color: var(--secondary-color);
    background: rgba(0, 0, 0, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.detection-stats {
    margin-bottom: 1rem;
}

.detection-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.detection-stats .stat-item:last-child {
    border-bottom: none;
}

.detection-stats .stat-label {
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.detection-stats .stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-color);
}

.stat-value.severity-1 { color: #059669; }
.stat-value.severity-2 { color: #d97706; }
.stat-value.severity-3 { color: #dc2626; }
.stat-value.severity-4 { color: #991b1b; }
.stat-value.severity-5 { color: #7c2d12; }

.detection-recommendations {
    background: rgba(59, 130, 246, 0.05);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
}

.recommendations-title {
    font-weight: 600;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.recommendations-list {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.8rem;
    color: var(--dark-color);
}

.recommendations-list li {
    margin-bottom: 0.25rem;
}

.recommendations-list li:last-child {
    margin-bottom: 0;
}

/* Status Items */
.status-item {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Detection Card Animation */
.detection-card-item {
    transition: all 0.3s ease;
}

/* Responsive Camera */
@media (max-width: 768px) {
    .camera-area {
        min-height: 250px;
    }
    
    .camera-placeholder {
        height: 250px;
    }
    
    .camera-placeholder-icon {
        font-size: 2.5rem;
    }
    
    .camera-placeholder-title {
        font-size: 1.25rem;
    }
    
    #cameraVideo {
        max-height: 300px;
    }
    
    /* Responsive Detection Cards */
    .detection-card {
        margin-bottom: 1rem;
    }
    
    .detection-info {
        padding: 1rem;
    }
    
    .detection-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .detection-stats .stat-item {
        padding: 0.4rem 0;
    }
    
    .detection-badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
}
