
/* ========================================
   Fardagam - Performance Comparison
   Responsive layout + landing page card style
======================================== */

/* ========================================
   Reset and Base
======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: #f5f7fb;
    color: #172033;
    font-family: inherit;
    overflow-x: hidden;
}

.performance-page {
    box-sizing: border-box;
    width: 100%;
    min-height: 100vh;
    padding: 112px 24px 48px;
}

/* ========================================
   Shared Card Style
======================================== */

.performance-page > .page-intro,
.performance-page .ranking-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.07);
}

/* ========================================
   Page Intro
======================================== */

.performance-page > .page-intro {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 28px;
    padding: clamp(24px, 4vw, 40px);
    text-align: right;
    overflow-wrap: anywhere;
}

.page-intro h1 {
    margin: 0 0 12px;
    color: #172554;
    font-size: clamp(25px, 3vw, 34px);
    font-weight: 800;
    line-height: 1.8;
}

.page-intro > p {
    margin: 0;
    color: #64748b;
    font-size: 15px;
    line-height: 2.1;
}

/* ========================================
   Scoring Criteria
======================================== */

.scoring-criteria {
    margin-top: 24px;
    padding: 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
}

.scoring-criteria h2 {
    margin: 0 0 8px;
    color: #172554;
    font-size: 19px;
    font-weight: 800;
    line-height: 1.8;
}

.scoring-description {
    margin: 0 0 18px;
    color: #64748b;
    font-size: 13px;
    line-height: 2;
}

.criteria-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.criteria-item {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.criteria-item > span:first-child {
    min-width: 0;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.9;
}

.criteria-weight {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    min-height: 34px;
    padding: 6px 10px;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.criteria-note {
    margin-top: 16px;
    padding: 14px 16px;
    background: #ffffff;
    border-right: 3px solid #54258f;
    border-radius: 10px;
    color: #475569;
    font-size: 13px;
    line-height: 2;
}

/* ========================================
   Rankings Container
======================================== */

.performance-page > .rankings-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 24px;
}

.ranking-card {
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

/* ========================================
   Ranking Header
======================================== */

.ranking-header {
    min-height: 104px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #eef2f7;
}

.ranking-label {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.8;
}

.ranking-header h2 {
    color: #172554;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.7;
}

.period-badge {
    flex-shrink: 0;
    min-width: 60px;
    min-height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

/* ========================================
   Table Wrapper
======================================== */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

/* ========================================
   Ranking Table
======================================== */

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.ranking-table thead {
    background: #f8fafc;
}

.ranking-table th {
    height: 50px;
    padding: 0 14px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.ranking-table th.rank-column {
    width: 68px;
    text-align: center;
}

.ranking-table th.score-column {
    width: 126px;
    text-align: center;
}

.ranking-table tbody tr {
    border-top: 1px solid #eef2f7;
    transition: background-color 0.2s ease;
}

.ranking-table tbody tr:not(.ranking-ellipsis-row):hover {
    background: #f8fafc;
}

.ranking-table td {
    min-height: 64px;
    height: 64px;
    padding: 10px 14px;
    font-size: 14px;
    vertical-align: middle;
}

.ranking-table tbody tr.top-four {
    border-bottom: 1px solid #eef2f7;
}

/* ========================================
   Rank
======================================== */

.rank-cell {
    text-align: center;
}

.rank-number {
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
}

.rank-medal {
    width: 31px;
    height: 31px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #172554;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
}

/* ========================================
   Top Ranking Rows
======================================== */

.ranking-table tbody tr.top-one {
    background: #fafbff;
}

.ranking-table tbody tr.top-two {
    background: #fcfcfd;
}

.ranking-table tbody tr.top-three {
    background: #fdfdfd;
}

.top-one .rank-medal {
    background: #172554;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(23, 37, 84, 0.16);
}

.top-two .rank-medal {
    background: #e2e8f0;
    color: #334155;
}

.top-three .rank-medal {
    background: #f1f5f9;
    color: #475569;
}

/* ========================================
   Student Information
======================================== */

.student-cell {
    min-width: 0;
    text-align: right;
}

.student-name {
    display: block;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: anywhere;
}

.top-one .student-name {
    color: #172554;
    font-weight: 800;
}

.top-two .student-name,
.top-three .student-name {
    font-weight: 700;
}

.student-info {
    display: block;
    margin-top: 2px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Score
======================================== */

.score-cell {
    text-align: center;
}

.score {
    min-width: 58px;
    min-height: 32px;
    padding: 5px 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #172554;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.top-one .score {
    background: #172554;
    color: #ffffff;
}

/* ========================================
   Ellipsis Separator
======================================== */

.ranking-table tbody tr.ranking-ellipsis-row {
    border-top: none;
    background: transparent;
}

.ranking-table tbody tr.ranking-ellipsis-row:hover {
    background: transparent;
}

.ranking-ellipsis-row .ellipsis-cell {
    height: 40px;
    padding: 0;
    text-align: center;
}

.ellipsis-dots {
    display: inline-block;
    color: #cbd5e1;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 4px;
}

/* ========================================
   Hidden Rank - if used by the template
======================================== */

.hidden-rank-row {
    background: #f8fafc;
    border-top: 1px solid #eef2f7;
}

.hidden-rank-row:hover {
    background: #f1f5f9;
}

.rank-hidden {
    min-width: 30px;
    min-height: 30px;
    padding: 0 10px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #475569;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* ========================================
   Viewer Highlight
======================================== */

.ranking-table tbody tr.row-self {
    background: #ecfdf5;
}

.ranking-table tbody tr.row-self:hover {
    background: #d1fae5;
}

.ranking-table tbody tr.row-self .student-name {
    color: #065f46;
}

.ranking-table tbody tr.row-self .rank-medal,
.ranking-table tbody tr.row-self .score {
    background: #047857;
    color: #ffffff;
}

/* ========================================
   Consultant's Students Highlight
======================================== */

.ranking-table tbody tr.row-mine {
    background: #f5f3ff;
}

.ranking-table tbody tr.row-mine:hover {
    background: #ede9fe;
}

.ranking-table tbody tr.row-mine .student-name {
    color: #5b21b6;
}

.ranking-table tbody tr.row-mine .rank-medal,
.ranking-table tbody tr.row-mine .score {
    background: #6d28d9;
    color: #ffffff;
}

/* Highlighted names and badges must remain visible */

.ranking-table tbody tr.row-self .student-name,
.ranking-table tbody tr.row-mine .student-name {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
}

.row-badge {
    max-width: 100%;
    margin-inline-start: 6px;
    margin-top: 3px;
    padding: 3px 8px;
    display: inline-block;
    color: #ffffff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.7;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
}

.row-self .row-badge {
    background: #047857;
}

.row-mine .row-badge {
    background: #6d28d9;
}

/* ========================================
   Empty State
======================================== */

.empty-state {
    min-height: 250px;
    padding: 36px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.empty-icon {
    width: 46px;
    height: 46px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #94a3b8;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 800;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: #374151;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.8;
}

.empty-state p {
    color: #9ca3af;
    font-size: 13px;
    line-height: 2;
}

/* ========================================
   Footer
======================================== */

.performance-page > .page-footer {
    width: 100%;
    max-width: 1200px;
    margin: 28px auto 0;
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    color: #9ca3af;
    font-size: 12px;
    line-height: 1.8;
}

.footer-separator {
    color: #cbd5e1;
}

/* ========================================
   Tablet
======================================== */

@media (max-width: 900px) {
    .performance-page {
        padding: 96px 20px 40px;
    }

    .performance-page > .page-intro {
        margin-bottom: 24px;
        padding: 28px 24px;
        border-radius: 20px;
    }

    .performance-page > .rankings-container {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .ranking-card {
        border-radius: 20px;
    }

    .ranking-header {
        min-height: 96px;
    }
}

/* ========================================
   Mobile
======================================== */

@media (max-width: 600px) {
    .performance-page {
        padding: 84px 12px 28px;
    }

    .performance-page > .page-intro {
        margin-bottom: 18px;
        padding: 22px 18px;
        border-radius: 18px;
    }

    .page-intro h1 {
        margin-bottom: 10px;
        font-size: clamp(22px, 5.5vw, 27px);
        line-height: 1.8;
    }

    .page-intro > p {
        font-size: 13px;
        line-height: 2;
    }

    .scoring-criteria {
        margin-top: 18px;
        padding: 16px 14px;
        border-radius: 14px;
    }

    .scoring-criteria h2 {
        font-size: 16px;
        line-height: 1.9;
    }

    .scoring-description {
        margin-bottom: 12px;
        font-size: 12px;
    }

    .criteria-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
    }

    .criteria-item {
        padding: 12px;
        gap: 8px;
        border-radius: 12px;
    }

    .criteria-item > span:first-child {
        font-size: 12px;
        line-height: 1.9;
    }

    .criteria-weight {
        min-width: 70px;
        min-height: 31px;
        padding: 5px 8px;
        font-size: 11px;
    }

    .criteria-note {
        margin-top: 12px;
        padding: 11px 12px;
        font-size: 12px;
    }

    .performance-page > .rankings-container {
        gap: 16px;
    }

    .ranking-card {
        border-radius: 18px;
    }

    .ranking-header {
        min-height: 84px;
        padding: 17px 14px;
        gap: 10px;
    }

    .ranking-label {
        margin-bottom: 4px;
        font-size: 11px;
    }

    .ranking-header h2 {
        font-size: 16px;
        line-height: 1.8;
    }

    .period-badge {
        min-width: 49px;
        min-height: 30px;
        padding: 0 8px;
        border-radius: 8px;
        font-size: 10px;
    }

    .ranking-table th {
        height: 44px;
        padding: 0 9px;
        font-size: 10px;
        white-space: normal;
        line-height: 1.7;
    }

    .ranking-table th.rank-column {
        width: 52px;
    }

    .ranking-table th.score-column {
        width: 91px;
    }

    .ranking-table td {
        height: 58px;
        padding: 9px 9px;
        font-size: 12px;
    }

    .rank-medal {
        width: 27px;
        height: 27px;
        font-size: 11px;
    }

    .student-name {
        font-size: 12px;
        line-height: 1.9;
    }

    .student-info {
        font-size: 10px;
        line-height: 1.6;
    }

    .score {
        min-width: 47px;
        min-height: 28px;
        padding: 4px 6px;
        font-size: 11px;
    }

    .rank-hidden {
        min-width: 26px;
        min-height: 26px;
        padding: 0 6px;
        font-size: 10px;
    }

    .rank-number {
        font-size: 11px;
    }

    .ranking-ellipsis-row .ellipsis-cell {
        height: 34px;
    }

    .ellipsis-dots {
        font-size: 17px;
    }

    .row-badge {
        margin-inline-start: 3px;
        padding: 2px 6px;
        font-size: 9px;
    }

    .empty-state {
        min-height: 210px;
        padding: 28px 16px;
    }

    .empty-state h3 {
        font-size: 14px;
    }

    .empty-state p {
        font-size: 12px;
    }

    .performance-page > .page-footer {
        margin-top: 22px;
        padding: 12px 0;
        font-size: 11px;
    }
}

/* ========================================
   Extra Small Mobile
======================================== */

@media (max-width: 360px) {
    .performance-page {
        padding-right: 9px;
        padding-left: 9px;
    }

    .performance-page > .page-intro {
        padding: 18px 13px;
    }

    .page-intro h1 {
        font-size: 21px;
    }

    .scoring-criteria {
        padding: 13px 10px;
    }

    .criteria-item {
        padding: 10px;
    }

    .ranking-header {
        padding: 15px 11px;
    }

    .ranking-header h2 {
        font-size: 15px;
    }

    .ranking-table th {
        padding-right: 6px;
        padding-left: 6px;
        font-size: 9px;
    }

    .ranking-table th.rank-column {
        width: 44px;
    }

    .ranking-table th.score-column {
        width: 82px;
    }

    .ranking-table td {
        padding-right: 6px;
        padding-left: 6px;
    }

    .student-name {
        font-size: 11px;
    }

    .student-info {
        font-size: 9px;
    }

    .score {
        min-width: 43px;
        padding-right: 5px;
        padding-left: 5px;
        font-size: 10px;
    }
}

/* ========================================
   Reduced Motion
======================================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .ranking-table tbody tr {
        transition: none;
    }
}
