:root {
    --primary: #0D8F72;
    --primary-dark: #0a6b54;
    --primary-light: #e8f3f0;
    --secondary: #ffc107;
    --danger: #dc3545;
    --success: #28a745;
    --info: #17a2b8;
    --dark: #333;
    --light: #f5f7fb;
    --gray: #666;
    --border: #e0e0e0;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 24px rgba(13, 143, 114, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Page Visibility */
/* Fix for page display */
.page {
    display: none;
    min-height: 100vh;
    width: 100%;
}

.page.active {
    display: block !important;
}

#login-page {
    display: block;
}

#login-page.hidden {
    display: none !important;
}

#dashboard-container {
    display: none;
    width: 100%;
    min-height: 100vh;
}

#dashboard-container.visible {
    display: block !important;
}

/* Ensure dashboard takes full screen */
.dashboard-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    height: 100vh;
}

/* Fix for content sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Fix for stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}



/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--white);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.logo i {
    font-size: 1.5rem;
    color: var(--primary);
}

.logo span {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    margin: 0.25rem 1rem;
    border-radius: 8px;
}

.nav-item:hover {
    background: var(--light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.nav-item i {
    width: 20px;
}

.badge {
    background: var(--primary);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-left: auto;
}

.badge.warning {
    background: var(--secondary);
    color: var(--dark);
}

.badge.critical {
    background: var(--danger);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.user-role {
    font-size: 0.8rem;
    color: var(--gray);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 1.1rem;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: var(--light);
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title h1 {
    font-size: 1.75rem;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.page-title p {
    color: var(--gray);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.search-box input {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    width: 300px;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.notification-btn {
    background: var(--white);
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    color: var(--gray);
    transition: all 0.3s;
}

.notification-btn:hover {
    background: var(--light);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: var(--white);
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    transform: translate(25%, -25%);
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    font-size: 1.5rem;
    color: var(--primary);
}

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.stat-change {
    font-size: 0.8rem;
    color: var(--gray);
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Tables */
.table-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-header h3 {
    font-size: 1.1rem;
    color: var(--dark);
}

.view-all-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.view-all-btn:hover {
    text-decoration: underline;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    background: var(--light);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: var(--light);
    cursor: pointer;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-assigned {
    background: #cce5ff;
    color: #004085;
}

.status-in_progress {
    background: #d1ecf1;
    color: #0c5460;
}

.status-resolved {
    background: #d4edda;
    color: #155724;
}

.status-verified {
    background: #d4edda;
    color: #155724;
}

.status-critical {
    background: #f8d7da;
    color: #721c24;
}

/* Priority Badges */
.priority-low {
    color: #28a745;
    font-weight: 500;
}

.priority-medium {
    color: #17a2b8;
    font-weight: 500;
}

.priority-high {
    color: #ffc107;
    font-weight: 500;
}

.priority-critical {
    color: #dc3545;
    font-weight: 600;
}



/* Map */
.map-container {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.map-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.map-controls select,
.map-controls button {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--white);
    cursor: pointer;
    transition: all 0.3s;
}

.map-controls select:hover,
.map-controls button:hover {
    border-color: var(--primary);
}

#map,
#userMap,
#contractorMap,
#adminMap,
#mainLiveMap {
    height: 500px;
    min-height: 500px;
    width: 100%;
    border-radius: 12px;
    margin-bottom: 1rem;
    z-index: 10;
    background: #f8f9fa;
}

/* Map Search Bar Styles */
.map-controls-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.map-search-bar {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.map-search-bar .input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 auto;
}

.map-search-bar label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.map-search-bar label i {
    color: #0D8F72;
    margin-right: 5px;
}

.map-search-bar input {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background: #f8fafc;
}

.map-search-bar input:focus {
    border-color: #0D8F72;
    box-shadow: 0 0 0 3px rgba(13, 143, 114, 0.1);
    outline: none;
    background: white;
}

.map-legend {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: var(--light);
    border-radius: 8px;
    flex-wrap: wrap;
}

.map-legend span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: var(--gray);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #555;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: var(--white);
    color: var(--dark);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-warning {
    border-left-color: var(--secondary);
}

.toast-info {
    border-left-color: var(--info);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar .logo span,
    .sidebar .nav-item span,
    .sidebar .user-info div {
        display: none;
    }

    .main-content {
        margin-left: 80px;
    }

    .search-box input {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box input {
        width: 100%;
    }

    .map-controls {
        flex-direction: column;
    }

    .task-grid {
        grid-template-columns: 1fr;
    }
}


/* Simple Modal Styles */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 750px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
}

.modal-header h3 i {
    color: #0D8F72;
    margin-right: 0.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

.incident-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group label i {
    color: #0D8F72;
    margin-right: 0.5rem;
    width: 16px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #0D8F72;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary {
    flex: 2;
    padding: 0.75rem;
    background: #0D8F72;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #0a735c;
}

.btn-secondary {
    flex: 1;
    padding: 0.75rem;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-add-incident {
    background: #0D8F72;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add-incident:hover {
    background: #0a735c;
}

/* SRT Plot */
.srt-panel {
    max-width: 1100px;
    margin: 24px auto 60px;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.srt-controls {
    display: grid;
    grid-template-columns: 1fr 140px 140px;
    gap: 12px;
    align-items: end;
}

.srt-controls label {
    font-size: 12px;
    color: #64748b;
    display: block;
    margin-bottom: 6px;
}

.srt-controls input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.srt-meta {
    margin-top: 10px;
    font-size: 12px;
    color: #475569;
}

.srt-map {
    height: 60vh;
    margin-top: 16px;
    border-radius: 12px;
    overflow: hidden;
}

@media (max-width: 900px) {
    .srt-controls {
        grid-template-columns: 1fr;
    }
}
