/* YesGov Open Data — Design A (patriotic style.css complement) */

/* Sub-navigation */
.od-subnav {
    background: #001a4d;
    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;
    opacity: 0.9;
    font-size: 0.95rem;
}

.od-stat-blue { background: var(--primary-blue, #002868); }
.od-stat-red { background: var(--primary-red, #BF0A30); }
.od-stat-green { background: #155724; }
.od-stat-dark { background: #1a1a2e; }

/* 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, #CED4DA);
    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, #666);
    margin: 0;
}

.od-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--light-gray, #E9ECEF);
    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(--primary-red, #BF0A30); }
.od-red .od-bar-fill { background: var(--primary-red, #BF0A30); }

/* Section titles */
.od-section-title {
    color: var(--primary-blue, #002868);
    border-bottom: 3px solid var(--primary-blue, #002868);
    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, #002868);
    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, #CED4DA);
    font-size: 0.9rem;
}

.od-table tr:hover td { background: var(--off-white, #F8F9FA); }

.od-table a {
    color: var(--primary-blue, #002868);
    font-weight: 600;
    text-decoration: none;
}

.od-table a:hover { text-decoration: underline; }

/* Check badges */
.check-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 1px;
    white-space: nowrap;
}

.check-badge a { color: inherit; text-decoration: none; }
.badge-pass { background: #d4edda; color: #155724; }
.badge-fail { background: #f8d7da; color: #721c24; }
.badge-na { background: #e9ecef; color: #6c757d; }

/* Group grade badges (compact table view) */
.gg-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    min-width: 320px;
}
.gg-cell {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    cursor: default;
    position: relative;
}
.gg-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 0.35rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.gg-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}
.gg-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #1a2b4a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gg-count {
    font-size: 0.68rem;
    color: #6c757d;
    font-weight: 500;
}

/* Hover popup for check details — uses JS positioning to avoid overflow clipping */
.gg-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    min-width: 190px;
    background: #fff;
    border: 1px solid #c5ccd4;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    padding: 0.5rem 0;
}
.gg-popup.gg-popup-visible { display: block; }
.gg-popup-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1a2b4a;
    padding: 0.25rem 0.75rem 0.35rem;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 0.2rem;
}
.gg-popup-row {
    font-size: 0.78rem;
    padding: 0.2rem 0.75rem;
    white-space: nowrap;
    color: #333;
}
.gg-popup-row:hover { background: #f0f4f8; }
.gg-p { color: #28a745; font-weight: 700; }
.gg-f { color: #dc3545; font-weight: 700; }

/* Share buttons */
.share-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--border-color, #CED4DA);
    background: #fff;
    color: var(--text-dark, #1A1A1A);
    transition: background 0.15s;
}

.share-btn:hover { background: var(--off-white, #F8F9FA); text-decoration: none; color: inherit; }
.share-fb { color: #1877F2; border-color: #1877F2; }
.share-x { color: #000; border-color: #000; }
.share-copy { color: var(--primary-blue, #002868); border-color: var(--primary-blue, #002868); }

/* Breadcrumbs */
.od-breadcrumb {
    font-size: 0.9rem;
    color: var(--dark-gray, #666);
    margin-bottom: 1rem;
}

.od-breadcrumb a {
    color: var(--primary-blue, #002868);
    text-decoration: none;
}

.od-breadcrumb a:hover { text-decoration: underline; }
.od-breadcrumb .sep { margin: 0 0.35rem; color: #999; }

/* Card grid (for states, news) */
.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, #CED4DA);
    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, #002868);
    font-size: 1.2rem;
    border: none;
}

/* 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, #CED4DA);
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary-blue, #002868);
    font-weight: 600;
    font-size: 0.9rem;
}

.od-pagination a:hover { background: var(--off-white, #F8F9FA); }
.od-pagination .current { background: var(--primary-blue, #002868); color: #fff; border-color: var(--primary-blue, #002868); }
.od-pagination .ellipsis { border: none; color: var(--dark-gray, #666); 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(--off-white, #F8F9FA);
    border: 2px solid var(--border-color, #CED4DA);
    border-radius: 8px;
}

.od-filter label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    color: var(--text-dark, #1A1A1A);
}

.od-filter input,
.od-filter select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color, #CED4DA);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Alert/CTA box */
.od-alert {
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2.5rem;
}

.od-alert-danger {
    background: #f8d7da;
    border-left: 5px solid var(--primary-red, #BF0A30);
    color: #721c24;
}

.od-alert-info {
    background: #d1ecf1;
    border-left: 5px solid var(--primary-blue, #002868);
    color: #0c5460;
}

.od-alert h3 { margin-top: 0; color: inherit; border: none; }
.od-alert .btn-secondary,
.od-alert-danger .btn-secondary,
.od-alert-info .btn-secondary {
    background: #fff;
    color: var(--primary-blue, #002868);
    border-color: var(--primary-blue, #002868);
}
.od-alert .btn-secondary:hover,
.od-alert-danger .btn-secondary:hover,
.od-alert-info .btn-secondary:hover {
    background: var(--primary-blue, #002868);
    color: #fff;
}

/* Profile table (government detail) */
.od-profile-table { width: 100%; border-collapse: collapse; }
.od-profile-table th { text-align: left; padding: 0.6rem 1rem 0.6rem 0; color: var(--dark-gray, #666); font-weight: 600; white-space: nowrap; width: 140px; vertical-align: top; font-size: 0.9rem; border-bottom: 1px solid var(--border-color, #CED4DA); }
.od-profile-table td { padding: 0.6rem 0; font-size: 0.95rem; border-bottom: 1px solid var(--border-color, #CED4DA); }

/* 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, #002868); color: #fff; }
.od-badge-red { background: var(--primary-red, #BF0A30); color: #fff; }
.od-badge-green { background: #155724; color: #fff; }

/* Meta (dates, authors) */
.od-meta { font-size: 0.9rem; color: var(--dark-gray, #666); margin: 0.35rem 0 1rem; }

/* Card header/body */
.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, #666); }

/* Score chart (histogram) — new */
.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, #CED4DA);
}
.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, #002868);
    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;
}

/* Legacy histogram (keep for compat) */
.od-score-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 200px;
    margin: 1.5rem 0;
    padding: 0 0.5rem;
    border-bottom: 2px solid var(--border-color, #CED4DA);
}
.od-score-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}
.od-score-bar {
    width: 80%;
    border-radius: 3px 3px 0 0;
    transition: height 0.3s ease;
    min-height: 4px;
}
.od-score-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
    color: var(--text-dark, #1A1A1A);
}

/* 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;
}

/* Check group headings */
.od-check-group {
    margin-bottom: 1.25rem;
}
.od-check-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-blue, #002868);
    margin-bottom: 0.35rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--border-color, #CED4DA);
}

/* 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; }
    .share-buttons { gap: 0.35rem; }
    .share-btn { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
    .od-profile-table th { width: 110px; }
    .od-score-chart { height: 150px; }
    .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; }
    .check-badge { font-size: 0.68rem; padding: 0.1rem 0.3rem; }
    .od-breadcrumb { font-size: 0.82rem; }
    .od-profile-table th, .od-profile-table td { display: block; width: 100%; padding: 0.3rem 0; }
    .od-profile-table th { border-bottom: none; padding-bottom: 0; }
    .od-score-chart { height: 120px; gap: 2px; }
    .od-score-bar { width: 90%; }
    .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; }
}
