/* PrismWeb Open Data — adapted from YesGov open-data.css */

/* Sub-navigation */
.od-subnav {
    background: #0f2b5e;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.od-subnav-inner {
    display: flex;
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    white-space: nowrap;
}

.od-subnav a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.od-subnav a:hover { color: #fff; }
.od-subnav a.active { color: #fff; border-bottom-color: #fff; font-weight: 700; }

/* Stat boxes (top overview row) */
.od-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}

.od-stat {
    border-radius: 8px;
    padding: 1.5rem;
    color: #fff;
}

.od-stat h2 {
    color: #fff;
    margin: 0;
    font-size: 2.5rem;
    border: none;
    line-height: 1.1;
}

.od-stat p {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    color: #fff;
    font-weight: 500;
}

.od-stat-blue { background: #1e3a8a; }
.od-stat-teal { background: #0f766e; }
.od-stat-green { background: #14532d; }
.od-stat-dark { background: #111827; }

/* Metric card grid (security posture) */
.od-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.25rem;
}
.od-metrics-5 { grid-template-columns: repeat(5, 1fr); }

.od-metric {
    border-radius: 8px;
    padding: 1.15rem;
    background: #fff;
    border: 2px solid var(--border-color, #e5e7eb);
    text-align: center;
}

.od-metric h3 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
    border: none;
}

.od-metric .od-metric-label {
    font-weight: 600;
    margin: 0.4rem 0 0.2rem;
    font-size: 0.9rem;
}

.od-metric .od-metric-label a {
    color: inherit;
    text-decoration: none;
}

.od-metric .od-metric-label a:hover { text-decoration: underline; }

.od-metric .od-metric-detail {
    font-size: 0.82rem;
    color: var(--dark-gray, #6b7280);
    margin: 0;
}

.od-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--light-gray, #f3f4f6);
    margin-top: 0.5rem;
    overflow: hidden;
}

.od-bar-fill {
    height: 100%;
    border-radius: 3px;
}

/* Color classes for metrics */
.od-green { color: #155724; }
.od-green .od-bar-fill { background: #155724; }
.od-yellow { color: #856404; }
.od-yellow .od-bar-fill { background: #856404; }
.od-red { color: var(--danger-red, #ef4444); }
.od-red .od-bar-fill { background: var(--danger-red, #ef4444); }

/* Section titles */
.od-section-title {
    color: var(--primary-blue, #1e40af);
    border-bottom: 3px solid var(--primary-blue, #1e40af);
    padding-bottom: 0.5rem;
    margin-top: 2.5rem;
    margin-bottom: 0;
    font-size: 1.5rem;
}

/* Data tables */
.od-table-wrap {
    overflow: visible;
    margin-top: 1rem;
}

.od-table {
    width: 100%;
    border-collapse: collapse;
}

.od-table th {
    background: var(--primary-blue, #1e40af);
    color: #fff;
    padding: 0.7rem 0.85rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.od-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    font-size: 0.9rem;
}

.od-table tr:hover td { background: var(--background-light, #f9fafb); }

.od-table a {
    color: var(--primary-blue, #1e40af);
    font-weight: 600;
    text-decoration: none;
}

.od-table a:hover { text-decoration: underline; }

/* Group grade badges */
.gg-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.gg-cell {
    display: flex; align-items: center; gap: 0.35rem;
    background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 6px;
    padding: 0.3rem 0.55rem; position: relative; cursor: default;
}
.gg-grade {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; height: 22px; border-radius: 4px;
    font-weight: 700; font-size: 0.72rem; color: #fff;
    padding: 0 4px;
}
.gg-info { display: flex; flex-direction: column; line-height: 1.15; }
.gg-label { font-size: 0.7rem; font-weight: 600; color: #333; white-space: nowrap; }
.gg-count { font-size: 0.62rem; color: #777; }
.grade-a { background: #1b7a2b; }
.grade-b { background: #1565c0; }
.grade-c { background: #c99700; }
.grade-d { background: #e65100; }
.grade-f { background: #b71c1c; }

/* Hover popup for group grades */
.gg-popup {
    display: none; position: fixed; z-index: 9999;
    background: #fff; border: 1px solid #ccc; border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15); padding: 0.6rem 0.75rem;
    min-width: 160px; font-size: 0.82rem;
}
.gg-popup-visible { display: block; }
.gg-popup-title { font-weight: 700; margin-bottom: 0.3rem; border-bottom: 1px solid #eee; padding-bottom: 0.25rem; }
.gg-popup-row { padding: 0.15rem 0; display: flex; align-items: center; gap: 0.35rem; }
.gg-p { color: #1b7a2b; font-weight: 700; }
.gg-f { color: #b71c1c; font-weight: 700; }

/* Breadcrumbs */
.od-breadcrumb {
    font-size: 0.9rem;
    color: var(--dark-gray, #6b7280);
    margin-bottom: 1rem;
}

.od-breadcrumb a {
    color: var(--primary-blue, #1e40af);
    text-decoration: none;
}

.od-breadcrumb a:hover { text-decoration: underline; }
.od-breadcrumb .sep { margin: 0 0.35rem; color: #999; }

/* Pagination */
.od-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.od-pagination a,
.od-pagination span {
    padding: 0.45rem 1rem;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary-blue, #1e40af);
    font-weight: 600;
    font-size: 0.9rem;
}

.od-pagination a:hover { background: var(--background-light, #f9fafb); }
.od-pagination .current { background: var(--primary-blue, #1e40af); color: #fff; border-color: var(--primary-blue, #1e40af); }
.od-pagination .ellipsis { border: none; color: var(--dark-gray, #6b7280); padding: 0.45rem 0.5rem; }

/* Filter form */
.od-filter {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--background-light, #f9fafb);
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
}

.od-filter label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    color: var(--text-dark, #1f2937);
}

.od-filter input,
.od-filter select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Alert/CTA box */
.od-alert {
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2.5rem;
}

.od-alert-info {
    background: #dbeafe;
    border-left: 5px solid var(--primary-blue, #1e40af);
    color: #1e3a5f;
}

.od-alert h3 { margin-top: 0; color: inherit; border: none; }

/* Score histogram */
.score-histogram {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 260px;
    margin: 1.5rem 0 2rem;
    padding: 0 0.25rem;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
}
.sh-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    text-decoration: none;
    gap: 2px;
}
.sh-bar-wrap:hover .sh-bar { opacity: 0.85; }
.sh-count {
    font-size: 0.65rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}
.sh-bar {
    width: 80%;
    border-radius: 3px 3px 0 0;
    min-height: 3px;
    transition: opacity 0.15s;
}
.sh-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-blue, #1e40af);
    padding-top: 4px;
}

/* Percentage inline bar in score table */
.score-pct-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 120px;
}
.score-pct-fill {
    height: 14px;
    border-radius: 3px;
    min-width: 2px;
}
.score-pct-text {
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

/* Letter grade badges */
.od-grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.od-grade-badge.od-grade-sm {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
}
.od-grade-badge.od-grade-lg {
    width: 72px;
    height: 72px;
    font-size: 1.75rem;
}
.grade-a { background: #1b7a2b; }
.grade-b { background: #1565c0; }
.grade-c { background: #c99700; }
.grade-d { background: #e65100; }
.grade-f { background: #b71c1c; }

.od-grade-inline {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

/* Honor roll card grid */
.od-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.od-card {
    background: #fff;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}

.od-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
}

.od-card h3 {
    margin-top: 0;
    color: var(--primary-blue, #1e40af);
    font-size: 1.2rem;
    border: none;
}

.od-card-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.od-card-body { font-size: 0.92rem; }
.od-card-body small { color: var(--dark-gray, #6b7280); }

/* Badges */
.od-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 3px; font-size: 0.8rem; font-weight: 700; }
.od-badge-blue { background: var(--primary-blue, #1e40af); color: #fff; }
.od-badge-green { background: #155724; color: #fff; }

/* Responsive: Tablet */
@media (max-width: 768px) {
    .od-stats { grid-template-columns: 1fr 1fr; }
    .od-metrics, .od-metrics-5 { grid-template-columns: 1fr 1fr; }
    .od-card-grid { grid-template-columns: 1fr; }
    .od-filter { grid-template-columns: 1fr; }
    .od-subnav-inner { padding: 0 0.75rem; }
    .od-subnav a { padding: 0.6rem 0.7rem; font-size: 0.82rem; }
    .od-stat h2 { font-size: 2rem; }
    .od-table th, .od-table td { padding: 0.5rem 0.6rem; font-size: 0.82rem; }
    .score-histogram { height: 180px; }
    h1 { font-size: 1.6rem; }
}

/* Responsive: Phone */
@media (max-width: 480px) {
    .od-stats { grid-template-columns: 1fr; }
    .od-metrics, .od-metrics-5 { grid-template-columns: 1fr; }
    .od-stat { padding: 1rem; }
    .od-metric { padding: 0.85rem; }
    .od-metric h3 { font-size: 1.6rem; }
    .od-subnav a { padding: 0.5rem 0.55rem; font-size: 0.78rem; }
    .od-table th, .od-table td { padding: 0.4rem 0.45rem; font-size: 0.78rem; }
    .gg-row { gap: 0.25rem; }
    .gg-cell { padding: 0.2rem 0.4rem; }
    .gg-grade { font-size: 0.65rem; min-width: 22px; height: 18px; }
    .gg-label { font-size: 0.6rem; }
    .gg-count { font-size: 0.55rem; }
    .od-breadcrumb { font-size: 0.82rem; }
    .score-histogram { height: 140px; gap: 2px; }
    .sh-count { font-size: 0.55rem; }
    .sh-bar { width: 90%; }
    .od-pagination a, .od-pagination span { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
    h1 { font-size: 1.35rem; }
}
