/* Custom Styles for Smart Inspector System */

:root {
    --primary-color: #059669;
    --secondary-color: #0EA5E9;
    --danger-color: #DC2626;
    --warning-color: #F59E0B;
    --success-color: #10B981;
}

/* RTL Support */
html[dir="rtl"] {
    font-family: 'Cairo', sans-serif;
}

html[dir="ltr"] {
    font-family: 'Inter', sans-serif;
}

/* Smooth transitions */
* {
    transition: all 0.2s ease-in-out;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

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

/* Card hover effects */
.card-hover {
    transition: transform 0.3s, box-shadow 0.3s;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Map container */
#map {
    height: 600px;
    width: 100%;
    border-radius: 8px;
    z-index: 1;
}

.leaflet-popup-content {
    font-size: 14px;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-critical {
    background-color: #FEE2E2;
    color: #991B1B;
}

.badge-high {
    background-color: #FED7AA;
    color: #9A3412;
}

.badge-medium {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-low {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-pending {
    background-color: #E0E7FF;
    color: #3730A3;
}

.badge-verified {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.badge-assigned {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-in-progress {
    background-color: #FEFCE8;
    color: #854D0E;
}

.badge-completed {
    background-color: #D1FAE5;
    color: #065F46;
}

/* Status colors */
.status-critical {
    color: #DC2626;
}

.status-high {
    color: #F59E0B;
}

.status-medium {
    color: #FBBF24;
}

.status-low {
    color: #10B981;
}

/* Image upload area */
.upload-area {
    border: 2px dashed #D1D5DB;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: #F0FDF4;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background-color: #ECFDF5;
    border-style: solid;
}

/* Notification toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: slideIn 0.3s ease-out;
}

html[dir="rtl"] .toast {
    right: auto;
    left: 20px;
}

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

.toast-success {
    background-color: #10B981;
    color: white;
}

.toast-error {
    background-color: #DC2626;
    color: white;
}

.toast-warning {
    background-color: #F59E0B;
    color: white;
}

.toast-info {
    background-color: #0EA5E9;
    color: white;
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: transform 0.3s;
}

html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-hidden {
    transform: translateX(-100%);
}

html[dir="rtl"] .sidebar-hidden {
    transform: translateX(100%);
}

.main-content {
    margin-left: 280px;
    padding: 2rem;
    min-height: 100vh;
}

html[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 280px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    html[dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    html[dir="rtl"] .main-content {
        margin-right: 0;
    }
    
    #map {
        height: 400px;
    }
}

/* Stats cards animation */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.stat-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Table styles */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #F9FAFB;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #E5E7EB;
}

html[dir="rtl"] th {
    text-align: right;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

html[dir="rtl"] td {
    text-align: right;
}

tr:hover {
    background-color: #F9FAFB;
}

/* Button styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #047857;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #0284C7;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #B91C1C;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #059669 0%, #0EA5E9 100%);
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
}

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Detection image preview */
.detection-image {
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.detection-image img {
    width: 100%;
    height: auto;
    display: block;
}

.detection-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    padding: 1rem;
}

/* Confidence score */
.confidence-bar {
    height: 8px;
    background-color: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #059669, #10B981);
    transition: width 0.5s ease;
}

/* Detection detail map */
#detection-detail-map {
    z-index: 1;
}

.custom-detection-icon {
    animation: markerPulse 2s ease-in-out infinite;
}

@keyframes markerPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.nearby-detection-icon {
    transition: transform 0.2s;
}

.nearby-detection-icon:hover {
    transform: scale(1.2);
}

/* Modal width adjustment for detection details */
.modal-content.detection-detail {
    max-width: 1200px !important;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        margin-right: 0;
    }
}
