/* Custom CSS for RapidReport Admin Dashboard */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5; /* Light grey background */
    margin: 0;
    overflow: hidden; /* Prevent body scroll, layout handles it */
}

/* Explicitly ensure Font Awesome icons render */
.fas {
    font-family: 'Font Awesome 6 Free' !important; /* Use !important to override potential conflicts */
    font-weight: 900 !important; /* Solid icons are usually 900 */
}

.dashboard-container {
    display: flex;
    height: 100vh; /* Full viewport height */
}

.sidebar {
    width: 250px; /* Fixed width for sidebar */
    background-color: #ffffff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Prevent shrinking */
}

.header {
    position: sticky; /* Make header sticky */
    top: 0; /* Stick to the top */
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    flex-shrink: 0; /* Prevent shrinking */
}

.main-content-area {
    flex-grow: 1; /* Takes remaining space */
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Allow scrolling for main content */
    padding: 1.5rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 2rem;
    color: #4b5563; /* Gray-700 */
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
}

.sidebar-item.active,
.sidebar-item:hover {
    background-color: #eef2ff; /* Light blue/purple */
    color: #6c5ce7; /* Primary purple */
}

.sidebar-item.active i,
.sidebar-item:hover i {
    color: #6c5ce7; /* Primary purple for icon */
}

.sidebar-item i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    color: #9ca3af; /* Gray-400 for icons */
}

/* KPI Card styling (Dashboard) */
.kpi-card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px; /* Ensure consistent height */
}

.kpi-title {
    font-size: 0.9rem;
    color: #6b7280; /* Gray-600 */
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2.25rem; /* text-4xl */
    font-weight: 700; /* font-bold */
    color: #1f2937; /* Gray-900 */
    line-height: 1;
    margin-bottom: 0.5rem;
}

.kpi-icon {
    font-size: 1.5rem;
    color: #9ca3af; /* Default icon color */
    transition: color 0.2s ease-in-out;
}
/* Specific colorful KPI icons (Dashboard) */
.kpi-card:nth-child(1) .kpi-icon { color: #8B5CF6; /* Purple for Total Incidents */ }
.kpi-card:nth-child(2) .kpi-icon { color: #F59E0B; /* Amber for Open Incidents */ }
.kpi-card:nth-child(3) .kpi-icon { color: #10B981; /* Emerald for Resolved Today */ }
.kpi-card:nth-child(4) .kpi-icon { color: #3B82F6; /* Blue for Avg. Resolution Time */ }


/* KPI Card styling (Map-specific) */
.map-kpi-card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem; /* Made smaller */
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Adjusted gap */
    cursor: pointer; /* Indicate clickable */
    transition: background-color 0.2s ease-in-out;
}
.map-kpi-card:hover {
    background-color: #f3f4f6; /* Light gray on hover */
}
.map-kpi-circle {
    width: 12px; /* Made smaller */
    height: 12px; /* Made smaller */
    border-radius: 50%;
    flex-shrink: 0;
}
.map-kpi-value {
    font-size: 1.25rem; /* text-xl, Made smaller */
    font-weight: 700; /* font-bold */
    color: #1f2937;
    line-height: 1;
}
.map-kpi-label {
    font-size: 0.8rem; /* Made smaller */
    color: #6b7280;
    flex-grow: 1;
}

/* Dropdown styling */
.custom-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="w-4 h-4"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem; /* Make space for the arrow */
}

/* Table styling (Dashboard) */
.incident-table {
    width: 100%;
    border-collapse: separate; /* Allows for rounded corners on cells */
    border-spacing: 0;
    margin-top: 1.5rem;
    background-color: white;
    border-radius: 0.75rem;
    overflow: hidden; /* Ensures rounded corners are visible */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.incident-table th,
.incident-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb; /* Gray-200 */
}

.incident-table th {
    background-color: #f9fafb; /* Gray-50 */
    font-size: 0.8rem;
    color: #6b7280; /* Gray-600 */
    text-transform: uppercase;
    font-weight: 600;
}

.incident-table tbody tr {
    cursor: pointer; /* Indicate clickable rows */
    transition: background-color 0.2s ease-in-out;
}
.incident-table tbody tr:hover {
    background-color: #f3f4f6; /* Light gray on hover */
}
.incident-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px; /* Full rounded */
    font-size: 0.75rem;
    font-weight: 600;
}
/* Status Colors (Dashboard Table) */
.status-badge.new {
    background-color: #dbeafe; /* Blue-100 */
    color: #1e40af; /* Blue-800 */
}
.status-badge.in-progress {
    background-color: #fef3c7; /* Yellow-100 */
    color: #92400e; /* Yellow-800 */
}
.status-badge.resolved {
    background-color: #d1fae5; /* Green-100 */
    color: #065f46; /* Green-800 */
}

/* Priority-like badges, now used for Status on detail page */
.status-badge.medium { /* Fallback for 'Medium' status if it were used */
    background-color: #fef3c7;
    color: #92400e;
}
.status-badge.low { /* Fallback for 'Low' status if it were used */
    background-color: #dbeafe;
    color: #1e40af;
}
.status-badge.high { /* Fallback for 'High' status if it were used */
    background-color: #fee2e2;
    color: #991b1b;
}

/* Map Container */
#mapid {
    min-height: 400px; /* Ensure map has a height */
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    z-index: 1; /* Ensure map layers are above other content if necessary */
}

/* Custom Leaflet marker icon size */
.custom-div-icon {
    background-color: transparent;
    border: none;
}
.custom-div-icon div {
    border: 3px solid white; /* White border for visibility */
    box-shadow: 0 0 5px rgba(0,0,0,0.5); /* Add shadow for better visibility */
}


/* Legend */
.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #4b5563;
}
.legend-color-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* Status Colors for Map Markers and Legend */
.bg-status-new { background-color: #3B82F6; /* Blue */ }
.bg-status-in-progress { background-color: #6c5ce7; /* Purple */ }
.bg-status-resolved { background-color: #10B981; /* Green */ }

/* Detail Page specific styles */
.detail-card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.detail-item-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.detail-item-value {
    font-size: 0.95rem;
    color: #1f2937;
    font-weight: 400; /* Changed from 600 to 400 for accessibility */
    margin-bottom: 1rem;
}
.detail-item-value.multiline {
    white-space: pre-wrap; /* Preserve whitespace and line breaks */
}

.media-thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}
.media-thumbnail:hover {
    transform: scale(1.05);
}

/* Activity Timeline */
.timeline-item {
    display: flex;
    margin-bottom: 1.5rem;
}
.timeline-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #6c5ce7;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-right: 1rem;
}
.timeline-content {
    flex-grow: 1;
}
.timeline-date {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 0.25rem;
}
.timeline-title {
    font-weight: 600; /* Keep bold for titles */
    color: #1f2937;
    margin-bottom: 0.25rem;
}
.timeline-description {
    font-size: 0.875rem;
    color: #4b5563;
    font-weight: 400; /* Ensure description is regular */
}

/* Custom message box for feedback */
.feedback-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4CAF50; /* Green */
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out;
    font-size: 0.9rem;
}
.feedback-message.error {
    background-color: #f44336; /* Red */
}
.feedback-message.info {
    background-color: #2196F3; /* Blue */
}

/* Modal specific styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    transform: translateY(-20px);
    transition: transform 0.3s ease-in-out;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 1024px) { /* Adjust for smaller desktops/tablets */
    .map-main-grid {
        grid-template-columns: 1fr; /* Map takes full width */
    }
    #mapid {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    .header > div {
        margin-bottom: 0.5rem;
    }
    .map-filters-grid {
        grid-template-columns: 1fr; /* Stack filters vertically */
        gap: 0.75rem;
    }
    .map-kpi-grid {
        grid-template-columns: 1fr; /* Stack KPIs vertically */
    }
    #mapid {
        min-height: 250px;
    }
}

/* Specific styles for QR code creation page */
.file-upload-area {
    border: 2px dashed #cbd5e1; /* border-gray-300 */
    border-radius: 0.5rem; /* rounded-md */
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}
.file-upload-area:hover {
    border-color: #a78bfa; /* purple-400 */
    background-color: #f5f3ff; /* purple-50 */
}
.file-upload-area i {
    font-size: 2rem;
    color: #9ca3af; /* gray-400 */
    margin-bottom: 0.5rem;
}
.file-upload-area input[type="file"] {
    display: none;
}
.qr-preview-box {
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background-color: #f9fafb;
}
.qr-preview-box img {
    max-width: 150px;
    height: auto;
    margin-bottom: 1rem;
}
