﻿/* ═══════════════════════════════════════════════
   SHAKEEL INSTITUTE — Results Page
   Perfect Mobile Layout with Animations
   ═══════════════════════════════════════════════ */

/* ═══ RESET ═══ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

/* ═══ CSS VARIABLES ═══ */
:root {
    /* Colors */
    --bg-page: #faf9f7;
    --bg-surface: #ffffff;
    --bg-soft: #f4f2ef;
    --bg-accent: #fff8f0;
    --text-dark: #1e1b18;
    --text-medium: #6b6560;
    --text-light: #9c9691;
    --border-1: #ebe8e3;
    --border-2: #dad6d0;
    --border-3: #c4bfb8;
    --accent-gold: #d4a373;
    --accent-deep: #b8885a;
    --accent-rich: #a07550;
    --rank-gold: #d4a373;
    --rank-silver: #9ca3af;
    --rank-bronze: #d97757;
    /* Typography */
    --font-display: 'Lora', Georgia, serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    --font-sans: 'Manrope', -apple-system, system-ui, sans-serif;
    /* Shadows */
    --shadow-1: 0 1px 2px rgba(30, 27, 24, 0.06);
    --shadow-2: 0 2px 4px rgba(30, 27, 24, 0.08);
    --shadow-3: 0 4px 8px rgba(30, 27, 24, 0.1);
    --shadow-4: 0 8px 16px rgba(30, 27, 24, 0.12);
}

/* ═══ BASE ═══ */
body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-dark);
    line-height: 1.6;
    font-weight: 400;
}

/* ═══ HEADER ═══ */
.page-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-1);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-2);
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.header-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex: 1;
    min-width: 0;
}

.brand-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-deep));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: var(--shadow-3);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

    .brand-logo:hover {
        transform: rotate(5deg) scale(1.05);
    }

.brand-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
    white-space: nowrap;
}

.brand-tag {
    font-size: 0.6875rem;
    color: var(--text-light);
    font-weight: 500;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.header-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-soft);
    border: 1px solid var(--border-1);
    border-radius: 50px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-medium);
    font-weight: 500;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

    .header-date:hover {
        background: var(--bg-accent);
        border-color: var(--accent-gold);
    }

    .header-date svg {
        opacity: 0.6;
    }

/* ═══ HERO BANNER ═══ */
.hero-banner {
    padding: 2.5rem 2rem;
    background: linear-gradient(to bottom, var(--bg-page), var(--bg-surface));
    animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.program-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1.25rem;
    background: var(--bg-accent);
    border: 1px solid var(--border-1);
    border-radius: 50px;
    margin-bottom: 1.25rem;
    animation: fadeIn 0.8s ease 0.2s backwards;
}

.badge-pulse {
    width: 8px;
    height: 8px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: pulse-animation 2s ease-in-out infinite;
}

@keyframes pulse-animation {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(212, 163, 115, 0.7);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.9);
        box-shadow: 0 0 0 6px rgba(212, 163, 115, 0);
    }
}

.badge-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-medium);
}

.page-heading {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.15;
    margin-bottom: 0.875rem;
    letter-spacing: -0.02em;
    animation: fadeIn 0.8s ease 0.3s backwards;
}

.page-desc {
    font-size: 1.0625rem;
    color: var(--text-medium);
    font-weight: 400;
    max-width: 580px;
    margin: 0 auto;
    animation: fadeIn 0.8s ease 0.4s backwards;
}

/* ═══ SEARCH PANEL ═══ */
.search-panel {
    padding: 0 2rem 2rem;
    animation: fadeIn 0.8s ease 0.5s backwards;
}

.panel-wrap {
    max-width: 1100px;
    margin: 0 auto;
}

.search-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: 1.25rem;
    padding: 2rem;
    box-shadow: var(--shadow-4);
    transition: all 0.3s ease;
}

    .search-container:hover {
        box-shadow: 0 12px 24px rgba(30, 27, 24, 0.15);
        transform: translateY(-2px);
    }

.form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1.25rem;
    align-items: end;
}

.field-box {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.field-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-medium);
}

    .field-tag svg {
        opacity: 0.5;
    }

.field-control {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.875rem 1.125rem;
    background: var(--bg-soft);
    border: 1.5px solid var(--border-2);
    border-radius: 10px;
    color: var(--text-dark);
    outline: none;
    transition: all 0.2s ease;
}

    .field-control:focus {
        border-color: var(--accent-gold);
        background: var(--bg-surface);
        box-shadow: 0 0 0 4px rgba(212, 163, 115, 0.1);
        transform: translateY(-1px);
    }

.select-field {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%236b6560' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.125rem center;
    padding-right: 3rem;
}

.field-control::placeholder {
    color: var(--text-light);
}

.submit-btn {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 0.9375rem 1.875rem;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-deep));
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(212, 163, 115, 0.35);
    white-space: nowrap;
}

    .submit-btn:hover {
        background: linear-gradient(135deg, var(--accent-deep), var(--accent-rich));
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(212, 163, 115, 0.45);
    }

    .submit-btn:active {
        transform: translateY(-1px);
    }

    .submit-btn svg {
        transition: transform 0.3s ease;
    }

    .submit-btn:hover svg {
        transform: rotate(90deg);
    }

/* ═══ CLASS TAG ═══ */
.class-tag {
    text-align: center;
    padding: 1.5rem 1rem;
    animation: fadeIn 0.6s ease;
}

.tag-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: 50px;
    box-shadow: var(--shadow-2);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--accent-gold);
}

    .tag-inner svg {
        opacity: 0.6;
    }

/* ═══ RESULTS AREA ═══ */
.results-area {
    padding: 1.5rem 2rem 3rem;
    animation: fadeIn 0.8s ease;
}

.results-wrap {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: var(--shadow-4);
}

.results-header {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--border-1);
    background: var(--bg-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.section-heading {
    font-family: var(--font-display);
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.02em;
}

.section-info {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-medium);
    font-weight: 500;
}

.rank-legend {
    display: flex;
    gap: 1.25rem;
}

.legend-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-medium);
    font-weight: 600;
}

.rank-dot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    box-shadow: var(--shadow-2);
}

/* ═══ DESKTOP TABLE ═══ */
.desktop-layout {
    display: block;
    overflow-x: auto;
}

.data-grid {
    width: 100%;
    border-collapse: collapse;
}

    .data-grid thead {
        background: var(--bg-soft);
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .data-grid th {
        font-family: var(--font-mono);
        font-size: 0.6875rem;
        font-weight: 700;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        text-align: left;
        padding: 1.25rem 1.75rem;
        color: var(--text-medium);
        border-bottom: 2px solid var(--border-1);
    }

.grid-row {
    border-bottom: 1px solid var(--border-1);
    transition: all 0.2s ease;
}

    .grid-row:hover {
        background: var(--bg-accent);
        transform: scale(1.01);
    }

    .grid-row:last-child {
        border-bottom: none;
    }

.data-grid td {
    padding: 1.25rem 1.75rem;
    font-size: 0.9375rem;
}

.col-rank,
.cell-rank {
    width: 100px;
}

.cell-name {
    font-weight: 600;
    color: var(--text-dark);
}

.col-roll,
.cell-roll {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-medium);
    font-weight: 500;
    width: 140px;
}

.col-marks,
.cell-marks {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-medium);
    width: 100px;
}

.col-total,
.cell-total {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent-gold);
    width: 110px;
}

/* Rank Number Badge */
.rank-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--text-dark);
    border: 2px solid var(--border-2);
    transition: all 0.3s ease;
}

    .rank-num:hover {
        transform: rotate(5deg) scale(1.1);
    }

.rank-1 {
    background: var(--rank-gold);
    color: white;
    border-color: var(--rank-gold);
    box-shadow: 0 4px 12px rgba(212, 163, 115, 0.35);
}

.rank-2 {
    background: var(--rank-silver);
    color: white;
    border-color: var(--rank-silver);
    box-shadow: 0 4px 12px rgba(156, 163, 175, 0.35);
}

.rank-3 {
    background: var(--rank-bronze);
    color: white;
    border-color: var(--rank-bronze);
    box-shadow: 0 4px 12px rgba(217, 119, 87, 0.35);
}

/* ═══ MOBILE LAYOUT ═══ */
.mobile-layout {
    display: none;
}

/* ═══ EMPTY STATE ═══ */
.empty-area {
    padding: 3rem 2rem;
    animation: fadeIn 0.8s ease;
}

.empty-box {
    max-width: 560px;
    margin: 0 auto;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-3);
}

.empty-visual {
    margin-bottom: 1.75rem;
    opacity: 0.2;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.empty-visual svg {
    stroke: var(--text-medium);
}

.empty-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.875rem;
    color: var(--text-dark);
}

.empty-msg {
    font-size: 1.0625rem;
    color: var(--text-medium);
    line-height: 1.7;
    margin-bottom: 1.75rem;
}

.reset-btn {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.875rem 1.75rem;
    background: var(--accent-gold);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
}

    .reset-btn:hover {
        background: var(--accent-deep);
        transform: translateY(-2px);
        box-shadow: var(--shadow-3);
    }

/* ═══ FOOTER ═══ */
.page-footer {
    border-top: 1px solid var(--border-1);
    background: var(--bg-surface);
    padding: 2rem;
    margin-top: 2rem;
}

.footer-wrap {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-info {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-medium);
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.footer-link {
    color: var(--text-medium);
    text-decoration: none;
    transition: color 0.2s ease;
}

    .footer-link:hover {
        color: var(--accent-gold);
    }

/* ═══════════════════════════════════════════════
   RESPONSIVE - MOBILE
   ═══════════════════════════════════════════════ */

@media (max-width: 900px) {
    /* Hide desktop */
    .desktop-layout {
        display: none;
    }

    /* Show mobile */
    .mobile-layout {
        display: block;
    }

    /* Mobile Header - Sticky with proper spacing */
    .mobile-head {
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr) 58px 58px 68px;
        gap: 6px;
        padding: 1rem 1.25rem;
        background: var(--bg-soft);
        border-bottom: 2px solid var(--border-1);
        position: sticky;
        top: 73px;
        z-index: 50;
        font-family: var(--font-mono);
        font-size: 0.6875rem;
        font-weight: 700;
        letter-spacing: 0.5px;
        color: var(--text-medium);
        text-transform: uppercase;
    }

    .mobile-list {
        /* Container */
    }

    .mobile-item {
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr) 58px 58px 68px;
        gap: 6px;
        padding: 1rem 1.25rem;
        border-bottom: 1px solid var(--border-1);
        align-items: center;
        transition: all 0.2s ease;
    }

        .mobile-item:hover {
            background: var(--bg-accent);
            transform: translateX(4px);
        }

        .mobile-item:last-child {
            border-bottom: none;
        }

    /* Mobile Columns - CRITICAL FIX FOR NAME TRUNCATION */
    .m-rank,
    .m-name,
    .m-essay,
    .m-mcq,
    .m-total {
        display: flex;
        align-items: center;
        min-width: 0; /* CRITICAL: Allows text-overflow to work */
    }

    .m-rank {
        justify-content: center;
    }

        .m-rank .rank-num {
            width: 42px;
            height: 42px;
            font-size: 1rem;
        }

    .m-name {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
        min-width: 0; /* CRITICAL */
        overflow: hidden; /* CRITICAL */
    }

    .student-title {
        font-weight: 600;
        font-size: 0.9375rem;
        line-height: 1.3;
        color: var(--text-dark);
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block; /* CRITICAL */
    }

    .student-id {
        font-family: var(--font-mono);
        font-size: 0.75rem;
        color: var(--text-light);
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block; /* CRITICAL */
    }

    .m-essay,
    .m-mcq {
        font-family: var(--font-mono);
        font-size: 0.9375rem;
        font-weight: 600;
        color: var(--text-medium);
        justify-content: center;
    }

    .m-total {
        font-family: var(--font-mono);
        font-size: 1.125rem;
        font-weight: 700;
        color: var(--accent-gold);
        justify-content: center;
    }

    /* Adjust other sections */
    .header-wrap {
        padding: 1rem 1.25rem;
    }

    .brand-logo {
        width: 40px;
        height: 40px;
    }

    .brand-name {
        font-size: 1rem;
    }

    .brand-tag {
        font-size: 0.625rem;
    }

    .header-date {
        font-size: 0.6875rem;
        padding: 0.4rem 0.875rem;
    }

        .header-date svg {
            width: 12px;
            height: 12px;
        }

    .hero-banner {
        padding: 2rem 1.25rem;
    }

    .page-heading {
        font-size: 2.25rem;
    }

    .page-desc {
        font-size: 1rem;
    }

    .search-panel {
        padding: 0 1.25rem 1.75rem;
    }

    .search-container {
        padding: 1.75rem;
    }

    .form-fields {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .submit-btn {
        width: 100%;
        justify-content: center;
    }

    .results-area {
        padding: 1.25rem 1rem 2.5rem;
    }

    .results-header {
        padding: 1.5rem 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-heading {
        font-size: 1.625rem;
    }

    .rank-legend {
        gap: 1rem;
    }

    .rank-dot {
        width: 24px;
        height: 24px;
    }

    .empty-area {
        padding: 2.5rem 1.25rem;
    }

    .empty-box {
        padding: 2.5rem 1.75rem;
    }

    .footer-wrap {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .mobile-head,
    .mobile-item {
        grid-template-columns: 42px minmax(0, 1fr) 52px 52px 62px;
        gap: 5px;
        padding: 0.875rem 1rem;
    }

    .mobile-head {
        font-size: 0.625rem;
        top: 69px;
    }

    .m-rank .rank-num {
        width: 38px;
        height: 38px;
        font-size: 0.9375rem;
    }

    .student-title {
        font-size: 0.875rem;
    }

    .student-id {
        font-size: 0.6875rem;
    }

    .m-essay,
    .m-mcq {
        font-size: 0.875rem;
    }

    .m-total {
        font-size: 1rem;
    }

    .page-heading {
        font-size: 2rem;
    }

    .section-heading {
        font-size: 1.5rem;
    }

    .brand-tag {
        display: none;
    }

    .rank-legend {
        display: none;
    }
}

@media (max-width: 380px) {
    .mobile-head,
    .mobile-item {
        grid-template-columns: 38px minmax(0, 1fr) 48px 48px 58px;
        gap: 4px;
        padding: 0.75rem 0.875rem;
    }

    .m-rank .rank-num {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .student-title {
        font-size: 0.8125rem;
    }

    .student-id {
        font-size: 0.625rem;
    }
}
