:root {
    /* Color Palette */
    --primary-blue: #1F4788;
    --secondary-blue: #0066CC;
    --success-green: #27AE60;
    --warning-orange: #F39C12;
    --danger-red: #E74C3C;
    --background: #F5F5F5;
    --card-background: #FFFFFF;
    --text-primary: #37474F;
    --text-secondary: #607D8B;

    /* Spacing & Layout */
    --card-padding: 16px;
    --section-spacing: 20px;
    --grid-gap: 18px;
    --border-radius: 8px;
    /* Using 8px for consistency */
    --max-width: 1200px;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 0.9rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--primary-blue);
    font-weight: 600;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 20px;
}

.section-header {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background-color: #163666;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #CFD8DC;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-blue);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

/* Utilities */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: var(--card-padding);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        /* Better for reading on mobile */
    }
}

/* =========================================
   DASHBOARD STYLES
   ========================================= */

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    background-color: var(--primary-blue);
    color: white;
    padding: 0 20px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-item {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-item:hover,
.nav-item.active {
    color: white;
}

/* =========================================
   DASHBOARD STYLES
   ========================================= */

.hero-section {
    position: relative;
    width: 100%;
    /* Constrain height to prevent it from dominating the screen */
    max-height: 480px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    margin-bottom: 25px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Subtle border */
    overflow: hidden;
}

.hero-bg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensure full image is visible without cropping */
    display: block;
}

/* Hero Animation Layer */
.hero-animation-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.flow-dot {
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

/* Pulse animation for dots at endpoints */
@keyframes dotPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Command Dashboard Grid */
.command-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-weight: 700;
    color: var(--primary-blue);
    font-size: 1rem;
}

.metric-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 1.2rem;
}

.icon-blue {
    background: #E3F2FD;
    color: #1976D2;
}

.icon-green {
    background: #E8F5E9;
    color: #388E3C;
}

.icon-orange {
    background: #FFF3E0;
    color: #F57C00;
}

.icon-red {
    background: #FFEBEE;
    color: #D32F2F;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 5px;
}

.metric-subtext {
    font-size: 0.85rem;
    color: #666;
}

/* Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1100px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 300px;
}

.chart-title {
    font-weight: 700;
    margin-bottom: 20px;
    color: #444;
}

/* CSS Donut Chart */
.donut-chart {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    margin: 20px auto;
    background: conic-gradient(#4285F4 0% 45%,
            #FBBC04 45% 75%,
            #9C27B0 75% 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-hole {
    width: 110px;
    height: 110px;
    background: white;
    border-radius: 50%;
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.legend {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Simple SVG Line Chart styles */
.line-chart-svg {
    width: 100%;
    height: 200px;
    overflow: visible;
}

.grid-line {
    stroke: #eee;
    stroke-width: 1;
}

.chart-line-red {
    fill: none;
    stroke: #D32F2F;
    stroke-width: 3;
    stroke-linecap: round;
}

.chart-line-green {
    fill: none;
    stroke: #388E3C;
    stroke-width: 3;
    stroke-linecap: round;
}

/* Map Placeholder */
.map-container {
    width: 100%;
    height: 200px;
    background: #E1F5FE;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0277BD;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.map-bg {
    opacity: 0.3;
    position: absolute;
    width: 100%;
    height: 100%;
    /* Basic pattern */
    background-image: radial-gradient(#0277BD 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--grid-gap);
    margin-bottom: var(--section-spacing);
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 5px;
}

.stat-trend {
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    color: var(--success-green);
}

.trend-down {
    color: var(--danger-red);
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: #f9f9f9;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-green {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success-green);
}

.badge-orange {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning-orange);
}

.badge-red {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-red);
}

.badge-purple {
    background: rgba(155, 89, 182, 0.1);
    color: #9B59B6;
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   ALERTS & RESPONSES STYLES
   ========================================= */

/* Tab System */
.tabs-container {
    margin-bottom: 20px;
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary-blue);
}

.tab-btn.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Filter Buttons */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: white;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

/* Alert Cards */
.alert-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.alert-card.medium {
    border-left-color: var(--secondary-blue);
}

.alert-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    transition: background-color 0.2s;
}

.alert-header:hover {
    background-color: #fcfcfc;
}

.alert-title-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.expand-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.alert-card.expanded .expand-icon {
    transform: rotate(180deg);
}

.alert-body {
    padding: 0 20px 20px;
    display: none;
    border-top: 1px solid #eee;
}

.alert-card.expanded .alert-body {
    display: block;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.meta-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.meta-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.response-section {
    margin-top: 25px;
    background: #f0f7ff;
    padding: 20px;
    border-radius: 8px;
}

/* Compliance Inbox */
.inbox-container {
    display: flex;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.inbox-list {
    width: 350px;
    border-right: 1px solid #eee;
    overflow-y: auto;
}

.message-item {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.message-item:hover {
    background-color: #f9f9f9;
}

.message-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid var(--primary-blue);
}

.message-item.unread .msg-title {
    font-weight: 700;
    color: var(--primary-blue);
}

.msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.msg-body-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-detail {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.detail-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.detail-subject {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 10px;
}

.detail-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.detail-content {
    line-height: 1.6;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .metadata-grid {
        grid-template-columns: 1fr;
    }

    .inbox-container {
        flex-direction: column;
        height: auto;
    }

    .inbox-list {
        width: 100%;
        height: 300px;
    }

    .inbox-detail {
        height: auto;
    }
}

/* =========================================
   REPOSITORY STYLES
   ========================================= */

/* Search Section */
.search-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.search-bar {
    display: flex;
    gap: 15px;
}

.search-input {
    flex: 1;
    font-size: 1.1rem;
    padding: 12px 15px;
}

.search-btn {
    min-width: 100px;
}

/* Identifier Cards Grid Style (resusing stats-grid logic but tailored) */
.identifier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.identifier-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    border-top: 4px solid transparent;
}

.identifier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.identifier-card.critical {
    border-top-color: var(--danger-red);
}

.identifier-card.high {
    border-top-color: var(--warning-orange);
}

.identifier-card.medium {
    border-top-color: var(--secondary-blue);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.metrics-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.metric-row:last-child {
    margin-bottom: 0;
}

.contributor-badge {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    color: #F39C12;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* =========================================
   GRIEVANCE & FEEDBACK STYLES
   ========================================= */

.grievance-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.form-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.file-upload-wrapper {
    position: relative;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s;
    cursor: pointer;
    background: #f9f9f9;
}

.file-upload-wrapper:hover {
    border-color: var(--primary-blue);
    background: #f0f7ff;
}

.file-upload-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.status-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: fit-content;
}

.status-list {
    list-style: none;
}

.status-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.status-item:last-child {
    border-bottom: none;
}

.status-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.status-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Responsive Grievance */
@media (max-width: 900px) {
    .grievance-container {
        grid-template-columns: 1fr;
    }
}

/* Collapsed State for Search Results */
.search-results-section.collapsed .table-container {
    display: none !important;
}