/* Garissa County Project Monitoring Dashboard - Enhanced Modern Styles */

:root {
    --primary-color: #8B0000; /* Maroon */
    --secondary-color: #006400; /* Dark Green */
    --accent-color: #FFD700; /* Gold */
    --garissa-red: #DC2626;
    --garissa-green: #059669;
    
    /* Modern Color Palette */
    --gradient-primary: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
    --gradient-secondary: linear-gradient(135deg, #059669 0%, #047857 100%);
    --gradient-accent: linear-gradient(135deg, #FFD700 0%, #F59E0B 100%);
    --gradient-background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    
    /* Glass morphism */
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    
    /* Smooth transitions */
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
    
    /* Modern shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Section transition improvements */
.section {
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    opacity: 1;
    transform: translateY(0);
    min-height: calc(100vh - 140px);
    overflow-y: auto;
    position: relative;
    width: 100%;
    z-index: 1;
}

.section.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    position: absolute;
    top: -9999px;
    left: -9999px;
}

/* Navigation improvements */
.nav-link {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.nav-link::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 var(--transition-slow);
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link.active {
    background: var(--gradient-primary);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-background);
    min-height: 100vh;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Login page styling */
#login-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: linear-gradient(135deg, #991B1B 0%, #7C2D12 50%, #166534 100%);
}

#login-page.hidden {
    display: none !important;
    visibility: hidden;
    opacity: 0;
}

/* Dashboard styling */
#dashboard {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

#dashboard.hidden {
    display: none !important;
    visibility: hidden;
    opacity: 0;
}

/* Main content area improvements */
main {
    background: transparent;
    min-height: calc(100vh - 80px);
    padding: 1.5rem;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    flex: 1;
}

/* Sidebar positioning */
#dashboard > div:first-child {
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

/* Main content container */
#dashboard > div:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: #f8fafc;
}

/* Ensure content stays in main area */
main .section {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0;
}

/* Fix any positioning issues */
.section.hidden {
    display: none !important;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: -9999px;
    left: -9999px;
    pointer-events: none;
}

.section:not(.hidden) {
    display: block !important;
    visibility: visible;
    opacity: 1;
    position: relative;
    top: auto;
    left: auto;
    pointer-events: auto;
}

/* Form improvements */
input, select, textarea {
    transition: all var(--transition-fast);
    border-radius: 0.5rem;
}

input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    border-color: var(--garissa-red);
    transform: translateY(-1px);
}

/* Button improvements */
button {
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

button:active {
    transform: translateY(0);
}

/* Card improvements */
.bg-white {
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(229, 231, 235, 0.5);
    border-radius: 0.75rem;
    backdrop-filter: blur(10px);
}

/* Header improvements */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    box-shadow: var(--shadow-sm);
}

/* Map container improvements */
#map {
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(229, 231, 235, 0.5);
}

/* Table improvements */
table {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: white;
}

/* Excel table improvements */
#excel-table input {
    border: none;
    background: transparent;
    padding: 0.5rem;
    width: 100%;
    height: 100%;
    min-height: 2.5rem;
    border-radius: 0.25rem;
    transition: all var(--transition-fast);
}

#excel-table input:focus {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* Notification improvements */
.notification {
    animation: slideInRight var(--transition-normal) ease-out;
}

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

/* Responsive design improvements */
@media (max-width: 768px) {
    #dashboard {
        flex-direction: column;
    }
    
    #dashboard > div:first-child {
        width: 100%;
        height: auto;
        flex-shrink: 0;
    }
    
    #dashboard > div:last-child {
        flex: 1;
        height: calc(100vh - 200px);
    }
    
    .nav-link {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .section {
        min-height: auto;
    }
}

@media (max-width: 480px) {
    #login-page > div {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-4 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .grid-cols-1.lg\\:grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* Ensure proper layout on all devices */
* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

/* Modern background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(220, 38, 38, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(5, 150, 105, 0.1) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* Enhanced Sidebar Styles */
.sidebar {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(220, 38, 38, 0.05) 50%, transparent 100%);
    pointer-events: none;
}

.sidebar-link {
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.sidebar-link::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;
}

.sidebar-link:hover::before {
    left: 100%;
}

.sidebar-link:hover, .sidebar-link.active {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border-left: 4px solid var(--garissa-red);
    transform: translateX(5px);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--garissa-red) 0%, #991b1b 100%);
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--garissa-green) 0%, #047857 100%);
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

/* Enhanced Card Styles */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-2xl);
    border-color: rgba(220, 38, 38, 0.3);
}

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

/* Glass morphism cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 1.5rem;
}

/* Modal Styles */
.modal-backdrop {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

/* Map Styles */
#map {
    height: 500px;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* Chart Container Styles */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

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

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

/* Garissa County Branding */
.garissa-gradient {
    background: linear-gradient(135deg, var(--garissa-red) 0%, var(--garissa-green) 100%);
}

.garissa-text-gradient {
    background: linear-gradient(135deg, var(--garissa-red) 0%, var(--garissa-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Status Badge Styles */
.status-ongoing {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #92400e;
}

.status-completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #064e3b;
}

.status-stalled {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #7f1d1d;
}

/* Form Styles */
.form-input {
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
}

.form-input:focus {
    border-color: var(--garissa-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    outline: none;
}

/* Enhanced Table Styles */
.table-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
}

.table-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid rgba(220, 38, 38, 0.2);
    position: relative;
}

thead th:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(220, 38, 38, 0.3), transparent);
}

tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    position: relative;
}

tbody tr:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.05) 0%, rgba(5, 150, 105, 0.05) 100%);
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

tbody tr:hover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-primary);
}

tbody td {
    padding: 1rem;
    border-bottom: 1px solid rgba(229, 231, 235, 0.3);
    transition: all 0.2s ease;
}

tbody tr:hover td {
    color: #1f2937;
    font-weight: 500;
}

/* Enhanced table row styles */
.table-row {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.table-row:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, rgba(5, 150, 105, 0.08) 100%);
    transform: translateX(4px);
    box-shadow: inset 3px 0 0 var(--garissa-red);
}

.table-row:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

.table-row:nth-child(even):hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
}

/* Navigation Styles */
.nav-item {
    position: relative;
    overflow: hidden;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--garissa-red);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-item.active::after {
    width: 80%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .card {
        margin: 10px 0;
    }
    
    #map {
        height: 300px;
    }
}

/* Print Styles */
@media print {
    .sidebar, .modal-backdrop, #loading-screen {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

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

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--garissa-red);
    outline-offset: 2px;
}

/* Animation for page transitions */
.page-view {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--garissa-red) 0%, var(--garissa-green) 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #991b1b 0%, #047857 100%);
}

/* Enhanced Button Styles */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    color: white;
}

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

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, #991B1B 0%, #7F1D1D 100%);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(-1px) scale(1.02);
}

.btn-secondary {
    background: var(--gradient-secondary);
    border: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

.btn-accent {
    background: var(--gradient-accent);
    border: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    color: #1f2937;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

/* Loading spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--garissa-red);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Enhanced Form Styles */
.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(229, 231, 235, 0.5);
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 0.875rem;
    color: #374151;
}

.form-control:focus {
    border-color: var(--garissa-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Enhanced Modal Styles */
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-2xl);
    position: relative;
    overflow: hidden;
}

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

.modal-header {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.8) 100%);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    padding: 1.5rem;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.8) 100%);
    border-top: 1px solid rgba(229, 231, 235, 0.5);
    padding: 1.5rem;
}

/* Enhanced Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
}

.status-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
    background: currentColor;
}

.status-completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.status-ongoing {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.status-stalled {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.status-planned {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

/* Error states */
.error-input {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success states */
.success-input {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

.success-message {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

