/* ========== Quick Links ========== */
.ts-home-quicklinks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.ts-home-quicklinks__card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--ts-border);
    border-radius: 18px;
    background: var(--ts-surface);
    color: var(--ts-text);
    text-decoration: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ts-home-quicklinks__card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 8px 28px rgba(29, 78, 216, 0.09);
    transform: translateY(-2px);
}

.ts-home-quicklinks__card--primary {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: transparent;
    color: white;
}

.ts-home-quicklinks__card--primary:hover {
    border-color: transparent;
    box-shadow: 0 8px 28px rgba(29, 78, 216, 0.3);
}

.ts-home-quicklinks__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
    color: inherit;
}

.ts-home-quicklinks__card:not(.ts-home-quicklinks__card--primary) .ts-home-quicklinks__icon {
    background: #eff6ff;
    color: var(--ts-primary);
}

.ts-home-quicklinks__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.ts-home-quicklinks__body strong {
    font-size: 0.975rem;
    font-weight: 700;
    line-height: 1.3;
}

.ts-home-quicklinks__body span {
    font-size: 0.85rem;
    opacity: 0.75;
    line-height: 1.4;
}

.ts-home-quicklinks__arrow {
    font-size: 1.1rem;
    flex-shrink: 0;
    opacity: 0.6;
    transition: transform 0.18s ease;
}

.ts-home-quicklinks__card:hover .ts-home-quicklinks__arrow {
    transform: translateX(3px);
    opacity: 1;
}

/* ========== Section wrapper ========== */
.ts-home-section {
    margin-top: 36px;
}

.ts-home-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.ts-home-section__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ts-text);
}

.ts-home-section__more {
    flex-shrink: 0;
    color: var(--ts-primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.ts-home-section__more:hover {
    text-decoration: underline;
}

/* ========== Benchmark table ========== */
.ts-home-benchmark-table td,
.ts-home-benchmark-table th {
    white-space: nowrap;
}

.ts-home-benchmark-table td:first-child,
.ts-home-benchmark-table th:first-child {
    white-space: normal;
}

.ts-home-benchmark-table a {
    color: var(--ts-primary);
    text-decoration: none;
    font-weight: 500;
}

.ts-home-benchmark-table a:hover {
    text-decoration: underline;
}

/* ========== Featured schools ========== */
.ts-home-schools {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    background: var(--ts-surface);
    overflow: hidden;
}

.ts-home-school {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: var(--ts-text);
    text-decoration: none;
    border-bottom: 1px solid var(--ts-border);
    transition: background 0.15s ease;
}

.ts-home-school:last-child {
    border-bottom: none;
}

.ts-home-school:hover {
    background: #f8fafc;
}

.ts-home-school__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eff6ff;
    color: var(--ts-primary-dark);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.ts-home-school__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.ts-home-school__info strong {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-home-school__info span {
    font-size: 0.8rem;
    color: var(--ts-muted);
}

.ts-home-school__score {
    flex-shrink: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--ts-primary-dark);
}

/* ========== Latest news ========== */
.ts-home-news {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    background: var(--ts-surface);
    overflow: hidden;
}

.ts-home-news__item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 10px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ts-border);
}

.ts-home-news__item:last-child {
    border-bottom: none;
}

.ts-home-news__date {
    font-size: 0.78rem;
    color: var(--ts-muted);
    white-space: nowrap;
    padding-top: 2px;
}

.ts-home-news__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ts-text);
    text-decoration: none;
    line-height: 1.45;
}

.ts-home-news__title:hover {
    color: var(--ts-primary);
    text-decoration: underline;
}

.ts-home-news__tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ts-primary-dark);
    background: #eff6ff;
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
    align-self: start;
}

/* ========== Twin-column layout (schools + news) ========== */
.ts-home-twin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    align-items: start;
    margin-top: 36px;
}

/* gap handles vertical spacing inside twin — cancel out section margin */
.ts-home-twin .ts-home-section {
    margin-top: 0;
}

/* ========== Responsive ========== */
@media (max-width: 860px) {
    .ts-home-quicklinks__card {
        padding: 14px 16px;
        gap: 12px;
    }

    .ts-home-quicklinks__icon {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 640px) {
    .ts-home-news__item {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    .ts-home-news__date {
        grid-column: 1;
        grid-row: 2;
    }

    .ts-home-news__title {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .ts-home-news__tag {
        grid-column: 2;
        grid-row: 2;
    }
}

/* ========== Home quick search form ========== */

.ts-home-search-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-top: 16px;
}

.ts-home-search-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.ts-home-search-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--ts-primary, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: var(--ts-radius, 10px);
    font-size: 0.975rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.ts-home-search-submit:hover {
    background: var(--ts-primary-dark, #1e40af);
    box-shadow: 0 4px 16px rgba(29, 78, 216, 0.25);
}

.ts-home-search-advanced {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ts-primary, #1d4ed8);
    text-decoration: none;
    white-space: nowrap;
}

.ts-home-search-advanced:hover {
    text-decoration: underline;
}

.ts-home-search-error {
    margin: 8px 0 0;
    font-size: 0.875rem;
    color: #ef4444;
}

.ts-home-search-note {
    margin: 12px 0 0;
    font-size: 0.8rem;
    color: var(--ts-muted, #94a3b8);
    line-height: 1.5;
}

@media (max-width: 600px) {
    .ts-home-search-grid {
        grid-template-columns: 1fr;
    }

    .ts-home-search-submit {
        width: 100%;
        justify-content: center;
    }

    .ts-home-search-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ts-home-search-advanced {
        text-align: center;
    }
}

/* ========== Home form: unified field system ========== */

.ts-home-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ts-home-field > span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ts-text, #0f172a);
    line-height: 1;
}

/* Shared control token — applied to all 4 control types */
.ts-home-field input[type="number"],
.ts-home-field select,
[data-home-score-form] .ts-combobox-wrap .ts-combobox-search {
    height: 48px;
    width: 100%;
    padding: 0 14px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #f8fafc;
    color: var(--ts-text, #0f172a);
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

/* Select: custom chevron arrow */
.ts-home-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* Combobox search: extra right-padding for clear button */
[data-home-score-form] .ts-combobox-wrap .ts-combobox-search {
    padding-right: 40px;
}

/* Focus state — same across all 4 controls */
.ts-home-field input[type="number"]:focus,
.ts-home-field select:focus,
[data-home-score-form] .ts-combobox-wrap .ts-combobox-search:focus {
    border-color: var(--ts-primary, #1d4ed8);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08);
}

/* Placeholder color */
.ts-home-field input[type="number"]::placeholder,
[data-home-score-form] .ts-combobox-wrap .ts-combobox-search::placeholder {
    color: #94a3b8;
}

/* Combobox wrap: position context for clear button */
[data-home-score-form] .ts-home-field .ts-combobox-wrap {
    position: relative;
}

/* ========== Home dynamic states ========== */
.ts-home-loading {
    text-align: center;
    color: var(--ts-muted, #94a3b8);
    padding: 1.5rem;
    font-size: .875rem;
}

.ts-home-empty {
    text-align: center;
    color: var(--ts-muted, #94a3b8);
    padding: 1.5rem;
    font-size: .875rem;
    font-style: italic;
}

.ts-home-empty--news {
    border: 1px solid var(--ts-border, #e2e8f0);
    border-radius: 10px;
    background: var(--ts-surface, #f8fafc);
}
