:root {
    --primary-color: #0d8abc;
    /* ROP Blue/Brand */
    --secondary-color: #1e293b;
    --bg-color: #f3f4f6;
    --white: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;

    /* Status Colors */
    --green: #10b981;
    --green-light: #d1fae5;
    --red: #ef4444;
    --red-light: #fee2e2;
    --orange: #f59e0b;
    --orange-light: #fef3c7;
    --blue: #3b82f6;
    --blue-light: #dbeafe;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --radius-lg: 16px;
    --radius-md: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.5;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--white);
    border-left: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.logo-area {
    margin-bottom: 3rem;
    text-align: center;
}

.sidebar-logo {
    width: 92px;
    height: 92px;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.65rem;
    border-radius: 14px;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(13, 138, 188, 0.28);
    box-shadow:
        0 10px 24px rgba(13, 138, 188, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.38);
    animation: sidebarLogoFloat 4.5s ease-in-out infinite;
}

@keyframes sidebarLogoFloat {
    0% {
        transform: translateY(0) scale(1);
        filter: saturate(1);
    }
    50% {
        transform: translateY(-3px) scale(1.01);
        filter: saturate(1.08);
    }
    100% {
        transform: translateY(0) scale(1);
        filter: saturate(1);
    }
}

.logo-area h2 {
    color: var(--primary-color);
    font-weight: 800;
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
    line-height: 1.25;
}

.logo-area .subtitle {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 600;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--blue-light);
    color: var(--primary-color);
}

.nav-item i {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-display {
    background: var(--white);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn:hover {
    opacity: 0.9;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

/* Cards & Layout Shared */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Executive Summary */
.summary-cards {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-grid-2 {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 1.5rem;
}

.summary-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) {
    .summary-grid-4 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {

    .summary-grid-2,
    .summary-grid-4 {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--secondary-color);
    margin-bottom: 0.2rem;
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-trend.positive {
    color: var(--green);
}

.stat-trend.negative {
    color: var(--red);
}

.stat-trend.neutral {
    color: var(--text-secondary);
}

/* Color Utilities */
.text-green {
    color: var(--green);
}

.text-red {
    color: var(--red);
}

.text-orange {
    color: var(--orange);
}

.text-blue {
    color: var(--blue);
}

.bg-green-light {
    background-color: var(--green-light);
}

.bg-red-light {
    background-color: var(--red-light);
}

.bg-orange-light {
    background-color: var(--orange-light);
}

.bg-blue-light {
    background-color: var(--blue-light);
}

/* Middle Section */
.middle-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .middle-section {
        grid-template-columns: 1fr;
    }
}

.map-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
    position: relative;
    min-height: 300px;
}

.oman-svg {
    height: 250px;
    width: auto;
}

.map-pin {
    cursor: pointer;
    transition: r 0.3s;
}

.map-pin:hover {
    r: 8;
    stroke: #fff;
    stroke-width: 2px;
}

.map-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.green {
    background: var(--green);
}

.dot.orange {
    background: var(--orange);
}

.dot.red {
    background: var(--red);
}

/* Bottom Section */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .bottom-section {
        grid-template-columns: 1fr;
    }
}

/* Timeline */
.timeline {
    position: relative;
    border-right: 2px solid var(--border-color);
    padding-right: 1.5rem;
    margin-right: 0.5rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    right: -24px;
    /* Adjust based on border + padding */
    top: 0;
    width: 14px;
    height: 14px;
    background: var(--white);
    border: 3px solid var(--border-color);
    border-radius: 50%;
    z-index: 1;
}

.timeline-item.completed .timeline-marker {
    border-color: var(--green);
    background: var(--green);
}

.timeline-item.active .timeline-marker {
    border-color: var(--primary-color);
    background: var(--white);
}

.timeline-content h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.timeline-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-bar-mini {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-bar-mini .fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
}

/* Risk List - Full Width Modern Grid */
.risk-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.risk-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid #f1f5f9;
}

.risk-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--secondary-color);
    box-shadow: var(--shadow-sm);
}

.risk-details {
    flex: 1;
}

.risk-details h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.risk-details p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-red {
    background: var(--red-light);
    color: var(--red);
}

.badge-orange {
    background: var(--orange-light);
    color: var(--orange);
}

.view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Map Popup Styles (Migrated from maps.html) */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    text-align: right;
}

.popup-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #1e293b;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.popup-info {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 2px;
}

.popup-progress {
    margin-top: 8px;
}

.progress-bar-bg {
    background: #e2e8f0;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    background: #14b8a6;
    height: 100%;
}

/* Collapsible Sidebar Styles */
.sidebar {
    transition: width 0.3s ease;
    overflow: hidden;
}

.logo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-color);
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .subtitle,
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar.collapsed .logo-header {
    justify-content: center;
}

.sidebar.collapsed .btn-icon {
    margin: 0;
}

/* Rotate icon or change it when collapsed? */
.sidebar.collapsed .logo-header h2 {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem 0;
}

.sidebar.collapsed .nav-item i {
    font-size: 1.5rem;
    margin: 0;
}

.sidebar.collapsed .logo-area {
    text-align: center;
    padding: 0;
}

/* PIP Dashboard Redesign - Professional View */
.pip-dashboard-grid {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 2rem;
}

.pip-top-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 2rem;
}

.pip-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 1200px) {
    .pip-top-row {
        grid-template-columns: 1fr;
    }

    .pip-bottom-row {
        grid-template-columns: 1fr;
    }
}

/* Card Refinements */
.card {
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.pip-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 1.25rem;
    text-align: center;
    background: linear-gradient(to left, #f8fafc, #f1f5f9, #f8fafc);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Checklist Styling - Modernized */
.checklist-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-right: 4px solid var(--primary-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #334155;
    transition: background 0.2s;
}

.checklist-item:hover {
    background: #f8fafc;
}

.checklist-item i {
    color: var(--green);
    font-size: 1.3rem;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Tracking Table Styling - Professional */
.tracking-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.5rem;
}

.tracking-table th {
    background: #f8fafc;
    padding: 1rem 0.75rem;
    text-align: center;
    font-size: 0.85rem;
    color: #475569;
    font-weight: 700;
    border-bottom: 2px solid #e2e8f0;
}

.tracking-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    color: #1e293b;
    vertical-align: middle;
}

.tracking-table tr:last-child td {
    border-bottom: none;
}

.tracking-table tr:hover td {
    background-color: #f8fafc;
}

/* Phase Header Row */
.phase-header {
    background: #eff6ff;
    color: #1e40af;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.75rem 1rem !important;
    border-top: 1px solid #dbeafe;
    border-bottom: 1px solid #dbeafe;
}

/* Status Cells */
.status-cell {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    margin: 0 auto;
}

.bg-blue-status {
    background-color: #0ea5e9;
    border: 1px solid #0284c7;
    box-shadow: 0 1px 2px rgba(14, 165, 233, 0.3);
}

.bg-green-status {
    background-color: #84cc16;
    border: 1px solid #65a30d;
    box-shadow: 0 1px 2px rgba(132, 204, 22, 0.3);
}

.bg-white-status {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
}

.bg-yellow-status {
    background-color: #facc15;
    border: 1px solid #ca8a04;
    box-shadow: 0 1px 2px rgba(250, 204, 21, 0.35);
}

.bg-red-status {
    background-color: #ef4444;
    border: 1px solid #dc2626;
    box-shadow: 0 1px 2px rgba(239, 68, 68, 0.3);
}

.platform-table th,
.platform-table td {
    text-align: right;
    padding-right: 1.5rem;
}

.platform-table .status-col {
    width: 50px;
    padding: 0;
    text-align: center;
}

/* Typography Enhancements */
.card-note {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0369a1;
    font-size: 0.85rem;
    line-height: 1.6;
    text-align: center;
    position: relative;
    font-weight: 500;
}

.card-note::before {
    content: "ⓘ";
    font-weight: bold;
    margin-left: 6px;
    font-size: 1rem;
}