@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── Base ── */
.fgf-wrap {
    font-family: 'DM Sans', sans-serif;
    max-width: 900px;
    margin: 0 auto 48px;
    color: #1a1f2e;
    box-sizing: border-box;
}
.fgf-wrap *, .fgf-wrap *::before, .fgf-wrap *::after { box-sizing: inherit; }

/* ── Mode Tabs ── */
.fgf-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid #e2e8f0;
}
.fgf-mode-tab {
    background: none;
    border: none;
    padding: 13px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.fgf-mode-tab:hover { color: #1d4ed8; }
.fgf-mode-tab--active { color: #1d4ed8; border-bottom-color: #1d4ed8; }

/* ── Panel ── */
.fgf-panel { padding: 24px 0 0; }
.fgf-panel-intro {
    font-size: 15px;
    color: #374151;
    line-height: 1.65;
    margin: 0 0 22px;
    padding: 16px 20px;
    background: #f8faff;
    border-left: 4px solid #2563eb;
    border-radius: 0 10px 10px 0;
}
.fgf-panel-intro strong { color: #1d4ed8; }

/* ── Filters Grid ── */
.fgf-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.fgf-filter-group { display: flex; flex-direction: column; gap: 8px; }
.fgf-filter-label {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.fgf-filter-hint { font-size: 11px; font-weight: 400; color: #94a3b8; text-transform: none; letter-spacing: 0; }

/* Select */
.fgf-select-wrap { position: relative; }
.fgf-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 36px 11px 14px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: #1a1f2e;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.fgf-select:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.fgf-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 14px;
}
.fgf-select-wrap--sm { display: inline-block; min-width: 200px; }
.fgf-select--sm { padding: 8px 32px 8px 12px; font-size: 13px; border-radius: 8px; }

/* Range sliders */
.fgf-range-wrap { display: flex; align-items: center; gap: 12px; }
.fgf-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    background: #e2e8f0;
    border-radius: 50px;
    outline: none;
    cursor: pointer;
}
.fgf-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    background: #2563eb;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.4);
    cursor: pointer;
    transition: transform 0.15s;
}
.fgf-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.fgf-range::-moz-range-thumb {
    width: 20px; height: 20px;
    background: #2563eb;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: pointer;
}
.fgf-range-val {
    font-size: 13px;
    font-weight: 700;
    color: #1d4ed8;
    min-width: 58px;
    text-align: right;
    white-space: nowrap;
}

/* ── Action Row ── */
.fgf-action-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.fgf-search-btn {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 13px 28px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}
.fgf-search-btn:hover {
    background: linear-gradient(135deg, #166534 0%, #15803d 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(21,128,61,0.35);
}
.fgf-search-btn--inline {
    padding: 11px 22px;
    font-size: 14px;
    border-radius: 10px;
    flex-shrink: 0;
}
.fgf-sort-label { font-size: 13px; font-weight: 600; color: #64748b; }
.fgf-sort-wrap { display: flex; align-items: center; gap: 10px; }

@keyframes fgf-spin { to { transform: rotate(360deg); } }
.fgf-spin { animation: fgf-spin 0.75s linear infinite; display: inline-flex; }

/* ── Single School Mode ── */
.fgf-single-search { position: relative; max-width: 560px; }
.fgf-single-inner {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 8px 8px 16px;
    gap: 10px;
    box-shadow: 0 2px 14px rgba(0,0,0,0.07);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.fgf-single-inner:focus-within {
    border-color: #15803d;
    box-shadow: 0 4px 20px rgba(21,128,61,0.15);
}
.fgf-search-icon { color: #94a3b8; flex-shrink: 0; display: flex; align-items: center; }
.fgf-single-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: 'DM Sans', sans-serif;
    color: #1a1f2e;
    background: transparent;
    padding: 5px 0;
    min-width: 0;
}
.fgf-single-input::placeholder { color: #94a3b8; }

/* Dropdown */
.fgf-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 999;
}
.fgf-dropdown-item {
    padding: 11px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
    font-size: 14px;
    gap: 10px;
}
.fgf-dropdown-item:last-child { border-bottom: none; }
.fgf-dropdown-item:hover { background: #f0fdf4; }
.fgf-dropdown-item strong { color: #14532d; }
.fgf-dropdown-item span { font-size: 12px; color: #64748b; flex-shrink: 0; }

/* ── Error ── */
.fgf-error {
    margin: 16px 0;
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    border-radius: 10px;
    padding: 14px 18px;
    color: #b91c1c;
    font-size: 14px;
    font-weight: 500;
}

/* ── Results Meta Bar ── */
.fgf-results-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 0 14px;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 20px;
}
.fgf-results-count { font-size: 14px; font-weight: 600; color: #374151; }
.fgf-score-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
}
.fgf-legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 3px;
    vertical-align: middle;
}
.fgf-dot--excellent { background: #16a34a; }
.fgf-dot--good      { background: #2563eb; }
.fgf-dot--fair      { background: #d97706; }
.fgf-dot--low       { background: #dc2626; }

/* ── Cards ── */
@keyframes fgf-fadeup {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fgf-cards { display: flex; flex-direction: column; gap: 16px; }

.fgf-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 18px;
    overflow: hidden;
    animation: fgf-fadeup 0.4s ease both;
    transition: box-shadow 0.2s, transform 0.2s;
}
.fgf-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.1); transform: translateY(-2px); }

/* Card left accent by tier */
.fgf-card--excellent { border-left: 5px solid #16a34a; }
.fgf-card--good      { border-left: 5px solid #2563eb; }
.fgf-card--fair      { border-left: 5px solid #d97706; }
.fgf-card--low       { border-left: 5px solid #dc2626; }

.fgf-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px 16px;
    flex-wrap: wrap;
}

/* Rank badge */
.fgf-rank {
    width: 36px; height: 36px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #475569;
    flex-shrink: 0;
}
.fgf-rank--1 { background: #fef9c3; color: #a16207; border: 2px solid #fde047; }
.fgf-rank--2 { background: #f1f5f9; color: #475569; border: 2px solid #cbd5e1; }
.fgf-rank--3 { background: #fef3c7; color: #92400e; border: 2px solid #fcd34d; }

.fgf-card-title-block { flex: 1; min-width: 0; }
.fgf-card-name {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    font-weight: 400;
    color: #0f172a;
    margin: 0 0 4px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fgf-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.fgf-card-loc { font-size: 13px; color: #64748b; }
.fgf-card-type-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 2px 9px;
    border-radius: 50px;
}
.fgf-tag--pub    { background: #dbeafe; color: #1d4ed8; }
.fgf-tag--privnp { background: #fce7f3; color: #be185d; }
.fgf-tag--privfp { background: #f1f5f9; color: #475569; }
.fgf-tag--hbcu   { background: #fef9c3; color: #a16207; }
.fgf-tag--hsi    { background: #dcfce7; color: #15803d; }

/* Score Dial */
.fgf-score-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.fgf-score-dial {
    width: 68px; height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 4px solid;
}
.fgf-dial--excellent { border-color: #16a34a; background: #f0fdf4; }
.fgf-dial--good      { border-color: #2563eb; background: #eff6ff; }
.fgf-dial--fair      { border-color: #d97706; background: #fffbeb; }
.fgf-dial--low       { border-color: #dc2626; background: #fef2f2; }
.fgf-score-num {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    line-height: 1;
    color: #0f172a;
}
.fgf-score-of { font-size: 10px; color: #94a3b8; }
.fgf-score-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.fgf-label--excellent { color: #16a34a; }
.fgf-label--good      { color: #2563eb; }
.fgf-label--fair      { color: #d97706; }
.fgf-label--low       { color: #dc2626; }

/* Card metrics row */
.fgf-card-metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid #f1f5f9;
}
.fgf-metric {
    padding: 14px 12px;
    text-align: center;
    border-right: 1px solid #f1f5f9;
}
.fgf-metric:last-child { border-right: none; }
.fgf-metric-label {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}
.fgf-metric-value {
    font-family: 'DM Serif Display', serif;
    font-size: 18px;
    color: #0f172a;
    margin-bottom: 2px;
}
.fgf-metric-sub { font-size: 10px; color: #cbd5e1; }

/* Score breakdown bar inside card */
.fgf-card-bar-section {
    padding: 12px 24px 18px;
    background: #fafbfc;
    border-top: 1px solid #f1f5f9;
}
.fgf-card-bar-row {
    display: grid;
    grid-template-columns: 180px 1fr 46px;
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
}
.fgf-card-bar-row:last-child { margin-bottom: 0; }
.fgf-card-bar-label { font-size: 11px; color: #64748b; font-weight: 500; }
.fgf-card-bar-track {
    background: #e2e8f0;
    border-radius: 50px;
    height: 8px;
    overflow: hidden;
}
.fgf-card-bar-fill {
    height: 100%;
    border-radius: 50px;
    background: linear-gradient(90deg, #34d399, #10b981);
    width: 0%;
    transition: width 1s cubic-bezier(0.22,1,0.36,1);
}
.fgf-card-bar-val { font-size: 11px; font-weight: 700; color: #374151; text-align: right; }

/* Single school detail card */
.fgf-single-card { margin-top: 20px; }

/* Attribution */
.fgf-attribution { font-size: 11.5px; color: #94a3b8; text-align: center; margin-top: 20px; }
.fgf-attribution a { color: #60a5fb; text-decoration: none; }
.fgf-attribution a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 700px) {
    .fgf-filters-grid { grid-template-columns: 1fr 1fr; }
    .fgf-card-metrics { grid-template-columns: repeat(3, 1fr); }
    .fgf-card-metrics .fgf-metric:nth-child(4),
    .fgf-card-metrics .fgf-metric:nth-child(5) { border-top: 1px solid #f1f5f9; }
    .fgf-card-bar-row { grid-template-columns: 130px 1fr 40px; }
    .fgf-card-name { font-size: 17px; }
}
@media (max-width: 480px) {
    .fgf-filters-grid { grid-template-columns: 1fr; }
    .fgf-card-metrics { grid-template-columns: 1fr 1fr; }
    .fgf-mode-tab { padding: 11px 14px; font-size: 13px; }
}
