/* ============================================================================
   Ranking page redesign — ENGINEERING ONLY (for now)
   Loaded via $extraCss on education/engineering/ranking.php.
   Other categories don't load this file, so their tables are unaffected.
   Pairs with renderRedesignRow() in js/rankings.js + the SEO rows in ranking.php.

   Colours/fonts reuse the existing site palette (CSS vars from styles.css and
   the conventions already in page-layout.css) — nothing new is introduced.
   ========================================================================= */

/* ── Logo cell ─────────────────────────────────────────────────────────── */
.logo-cell {
    width: 64px;
}

.college-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: contain;
}

/* Only the initials placeholder gets the box (background + border); real logo
   images sit on transparent, borderless. */
.college-logo-placeholder {
    background: var(--bg-light, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light, #6b7280);
    letter-spacing: 0.5px;
}

/* ── Name cell (clickable → college detail page) ───────────────────────── */
.name-cell {
    min-width: 220px;
}

/* Matches .institution-name weight; primary colour signals it's a link. */
.college-link {
    display: block;
    color: var(--primary-color, #1e40af);
    font-weight: 600;
    text-decoration: none;
    line-height: 1.4;
}

.college-link:hover {
    text-decoration: underline;
}

/* Same treatment as the existing .institution-location. */
.college-city {
    display: block;
    margin-top: 2px;
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 400;
}

/* ── Fees / NIRF / review cells ────────────────────────────────────────── */
.fees-cell {
    font-weight: 600;
    white-space: nowrap;
}

.nirf-cell,
.review-cell {
    white-space: nowrap;
}

.user-review {
    color: var(--secondary-color, #059669);
    font-weight: 600;
}

/* ── Post Review button ────────────────────────────────────────────────── */
.btn-post-review {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    background: var(--bg-white, #ffffff);
    color: var(--text-dark, #1f2937);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition, all 0.3s ease);
}

.btn-post-review:hover {
    background: var(--bg-light, #f9fafb);
    border-color: var(--primary-color, #1e40af);
    color: var(--primary-color, #1e40af);
}

/* ── Compare checkbox ──────────────────────────────────────────────────── */
.compare-cell {
    text-align: center;
}

.compare-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color, #1e40af);
}

/* ── CSV + ZIP logo upload (engineering admin) ─────────────────────────── */
#luDropZone.lu-drag {
    border-color: var(--primary-color, #1e40af);
    background: var(--light-blue, #dbeafe);
}

.lu-file {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lu-file-ok   { background: var(--light-green, #d1fae5); color: var(--dark-green, #047857); }
.lu-file-need { background: #fee2e2; color: #b91c1c; }
.lu-file-opt  { background: var(--bg-light, #f9fafb); color: var(--text-light, #6b7280); }
.lu-clear {
    margin-left: auto; border: 0; background: none; cursor: pointer;
    color: inherit; font-size: 0.9rem; opacity: 0.7;
}
.lu-clear:hover { opacity: 1; }
.lu-note { font-size: 0.82rem; color: #b45309; margin-top: 6px; }

.lu-summary { border-radius: 8px; padding: 16px; font-size: 0.9rem; }
.lu-summary-ok  { background: var(--bg-light, #f9fafb); border: 1px solid var(--border-color, #e5e7eb); }
.lu-summary-err { background: #fee2e2; color: #b91c1c; }
.lu-summary-done{ background: var(--light-green, #d1fae5); border: 1px solid var(--secondary-color, #059669); }
.lu-summary-warn{ background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; margin-bottom: 16px; }
.lu-pending-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap; padding: 8px 0; border-top: 1px solid rgba(146,64,14,.2);
}
.lu-pending-row:first-of-type { border-top: 0; }
.lu-pending-row code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 3px; }

.lu-stats { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.lu-stats span { color: var(--text-dark, #1f2937); }

.lu-block { margin-top: 10px; padding: 10px 12px; border-radius: 6px; }
.lu-block.lu-warn { background: #fef3c7; color: #92400e; }
.lu-block.lu-info { background: var(--light-blue, #dbeafe); color: #1e3a8a; }
.lu-block.lu-err  { background: #fee2e2; color: #b91c1c; }
.lu-list { margin: 6px 0 0; padding-left: 20px; font-size: 0.85rem; }
.lu-next { margin: 12px 0 0; color: var(--text-light, #6b7280); font-size: 0.85rem; }

/* ── Compare: bottom tray ──────────────────────────────────────────────── */
.compare-tray {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 24px;
    background: var(--dark-blue, #1e3a8a);
    color: #fff;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}
.compare-tray.show { display: flex; }
.compare-tray-limit { animation: compareShake 0.5s; }
@keyframes compareShake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-6px); } 75% { transform: translateX(6px); }
}

.compare-chips { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compare-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    padding: 5px 12px; font-size: 0.82rem; font-weight: 600;
}
.compare-chip button {
    background: none; border: 0; color: #cbd5e1; cursor: pointer; font-size: 1rem; line-height: 1;
}
.compare-chip button:hover { color: #fff; }

.compare-tray-actions { display: flex; gap: 10px; align-items: center; }
.btn-tray-clear {
    background: none; border: 1px solid rgba(255,255,255,.4); color: #fff;
    border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: 0.85rem;
}
.btn-tray-clear:hover { background: rgba(255,255,255,.12); }
.btn-tray-go {
    background: #fff; color: var(--dark-blue, #1e3a8a); border: 0;
    border-radius: 6px; padding: 8px 18px; cursor: pointer; font-weight: 700; font-size: 0.85rem;
}
.btn-tray-go:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Compare: modal ────────────────────────────────────────────────────── */
.compare-modal-overlay {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(15, 23, 42, 0.55);
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.compare-modal-overlay.show { display: flex; }
.compare-modal {
    background: #fff; border-radius: 10px; width: 100%; max-width: 860px;
    max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.compare-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.compare-modal-head h3 { margin: 0; font-size: 1.1rem; color: var(--text-dark, #1f2937); }
.compare-modal-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--text-light, #6b7280); }
/* No top padding: the sticky header row sits flush under the modal's head bar
   (the 8px gap above it read as stray white space). */
.compare-modal-body { overflow: auto; padding: 0 8px 8px; }

.compare-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.compare-table th, .compare-table td {
    padding: 12px 14px; text-align: left;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    border-right: 1px solid var(--border-color, #e5e7eb); /* column separators */
    vertical-align: middle;
}
.compare-table th:last-child, .compare-table td:last-child { border-right: 0; }

/* Sticky header so labels stay visible while scrolling the comparison. */
.compare-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: #eef2f7;
    border-bottom: 2px solid var(--border-color, #d1d5db);
}
/* Zebra rows. */
.compare-table tbody tr:nth-child(even) td { background: var(--bg-light, #f9fafb); }
.compare-table tbody tr:hover td { background: var(--light-blue, #dbeafe); }
.compare-col { position: relative; min-width: 190px; }
.compare-corner { width: 150px; }
.compare-label { font-weight: 600; color: var(--text-dark, #1f2937); white-space: nowrap; background: #fff; }
.compare-table tbody tr:nth-child(even) .compare-label { background: var(--bg-light, #f9fafb); }

.compare-col-name { display: flex; align-items: center; gap: 10px; color: var(--primary-color, #1e40af); text-decoration: none; font-weight: 700; padding-right: 20px; }
.compare-col-name:hover span { text-decoration: underline; }
.compare-logo { width: 32px; height: 32px; object-fit: contain; flex: 0 0 auto; }

/* Remove-column (×) button in the header. */
.compare-col-remove {
    position: absolute; top: 6px; right: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    border: 1px solid var(--border-color, #e5e7eb); background: #fff;
    color: var(--text-light, #6b7280); cursor: pointer; font-size: 1rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.compare-col-remove:hover { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

/* Add-college column + button. */
.compare-col-add { min-width: 150px; text-align: center; }
.compare-add-btn {
    border: 1px dashed var(--primary-color, #1e40af); background: var(--bg-white, #fff);
    color: var(--primary-color, #1e40af); border-radius: 6px; padding: 8px 14px;
    cursor: pointer; font-weight: 600; font-size: 0.82rem;
}
.compare-add-btn:hover { background: var(--light-blue, #dbeafe); }

/* Best value per row. */
.compare-best { background: var(--light-green, #d1fae5); color: var(--dark-green, #047857); font-weight: 700; }

/* Add-college picker (floats over the modal). */
.compare-add-picker {
    position: absolute; top: 64px; right: 16px; z-index: 5;
    width: 300px; max-width: calc(100% - 32px);
    background: #fff; border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); overflow: hidden;
}
.compare-add-search { width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border-color, #e5e7eb); font: inherit; outline: none; }
.compare-add-results { max-height: 280px; overflow-y: auto; }
.compare-add-item {
    display: block; width: 100%; text-align: left; padding: 9px 12px;
    border: 0; border-bottom: 1px solid var(--bg-light, #f9fafb); background: #fff;
    cursor: pointer; font-size: 0.85rem; color: var(--text-dark, #1f2937);
}
.compare-add-item:hover { background: var(--light-blue, #dbeafe); }
.compare-add-rank { display: inline-block; min-width: 34px; color: var(--text-light, #6b7280); font-weight: 600; }
.compare-add-empty { padding: 12px; color: var(--text-light, #6b7280); font-size: 0.85rem; }
.compare-add-more { padding: 8px 12px; font-size: 0.75rem; color: var(--text-light, #6b7280); background: var(--bg-light, #f9fafb); text-align: center; }
.compare-modal { position: relative; } /* anchor for the picker */

/* ── Sort control (above the ranking list) ─────────────────────────────── */
.ranking-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.ranking-sort-label {
    font-size: 0.85rem;
    color: var(--text-light, #6b7280);
}

.ranking-sort .filter-select {
    width: auto;
    min-width: 150px;
}

/* ── Max course fee slider (filter sidebar) ────────────────────────────── */
.filter-range {
    width: 100%;
    margin: 4px 0 2px;
    accent-color: var(--primary-color, #1e40af);
    cursor: pointer;
}

.filter-range:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.filter-range-labels {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-light, #6b7280);
}

/* The middle label is the live value — give it emphasis. */
#feeFilterValue {
    font-weight: 600;
    color: var(--text-dark, #1f2937);
}

/* ── Mobile: the redesigned table has more columns than the old one, so let
      it scroll horizontally rather than squashing. Card view still wins at
      the existing breakpoint handled by page-layout.css. ───────────────── */
@media (max-width: 1024px) {
    #tableView {
        overflow-x: auto;
    }

    #tableView .rankings-table {
        min-width: 860px;
    }
}
