/* ===== Student Dashboard Login Page ===== */

.student-login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.student-login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.student-login-card h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

.student-login-card .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.student-login-form .form-group {
    margin-bottom: 24px;
}

.student-login-form label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.student-login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.student-login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.helper-text {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.auth-section-hidden {
    display: none;
}

.auth-link-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.auth-link-row.single {
    justify-content: center;
}

.link-button {
    border: none;
    background: transparent;
    color: #5b4bc4;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.link-button:hover {
    color: #2d6cdf;
}

.status-message {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px 15px;
    border-radius: 6px;
    margin-top: 20px;
    font-size: 14px;
    display: none;
}

.status-message.show {
    display: block;
    animation: shake 0.4s ease-in-out;
}

.status-message.success {
    background: #edfdf3;
    border-color: #b7efc5;
    color: #1f7a38;
    animation: none;
}

.auth-otp-password-group {
    margin-top: 18px;
}

.submit-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 20px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.error-message {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px 15px;
    border-radius: 6px;
    margin-top: 20px;
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
}

.login-footer p {
    color: #666;
    font-size: 14px;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.login-footer a:hover {
    color: #764ba2;
}

/* ===== Student Dashboard Page ===== */

.student-dashboard-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
    min-height: calc(100vh - 70px);
    background: #f8f9fa;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.welcome-text {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1b2f47;
    margin: 0;
    line-height: 1.15;
}

.announcement-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(8, 17, 33, 0.68);
    backdrop-filter: blur(4px);
    z-index: 4500;
}

.announcement-modal-card {
    width: min(820px, 96vw);
    max-height: 88vh;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid #cce3ff;
    background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
    box-shadow: 0 26px 60px rgba(6, 21, 42, 0.35);
}

.announcement-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px;
    background: linear-gradient(120deg, #0d3d82 0%, #155cb8 50%, #0b9f9b 100%);
    color: #fff;
}

.announcement-modal-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.announcement-close {
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 21px;
    line-height: 1;
}

.announcement-list {
    padding: 14px;
    display: grid;
    gap: 10px;
}

.announcement-item {
    border: 1px solid #d6e8ff;
    border-left: 6px solid #1d4ed8;
    border-radius: 12px;
    background: #f8fbff;
    padding: 12px;
}

.announcement-item.latest {
    border-left-color: #0f9f79;
    background: #f0fdf8;
}

.announcement-title {
    margin: 0;
    color: #123b61;
    font-size: 1rem;
    font-weight: 800;
}

.announcement-date {
    color: #5f7388;
    font-size: 0.82rem;
    font-weight: 700;
}

.announcement-message {
    margin: 8px 0 0;
    color: #2c4458;
    font-size: 1.14rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.announcement-footer {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.announcement-empty {
    margin: 0;
    text-align: center;
    padding: 14px;
    border: 1px dashed #cadef7;
    border-radius: 10px;
    color: #5b7088;
    background: #f7fbff;
}

.dashboard-content {
    display: grid;
    gap: 30px;
}

.info-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.info-card:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    color: white;
    border-bottom: 3px solid #764ba2;
}

.card-header h2 {
    margin: 0;
    font-size: 20px;
}

.card-body {
    padding: 25px;
}

/* Student Information */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #333;
    min-width: 120px;
}

.info-value {
    color: #667eea;
    font-weight: 500;
    text-align: right;
}

/* Profile-style student info card */
.profile-card .card-header {
    background: linear-gradient(120deg, #1b4d89 0%, #2f6ab0 55%, #4d85c9 100%);
    border-bottom: 0;
    position: relative;
}

.profile-card .card-header::after {
    content: "Verified Profile";
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 4px 9px;
}

.profile-card .card-body {
    display: block;
    padding: 18px 22px;
    background: #ffffff;
}

.profile-card .info-row {
    display: grid;
    grid-template-columns: 36% 64%;
    align-items: center;
    gap: 8px;
    border: 0;
    border-bottom: 1px solid #dce6f3;
    border-radius: 0;
    padding: 14px 0;
    background: transparent;
    box-shadow: none;
}

.profile-card .info-row:last-child {
    border-bottom: 0;
}

.profile-card .info-label {
    min-width: 0;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d4d70;
    text-transform: none;
    letter-spacing: 0;
    text-align: left;
}

.profile-card .info-value {
    margin-left: 0;
    text-align: right;
    font-size: 1.5rem;
    font-weight: 800;
    color: #2C65AA;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.2;
}

#display-email.info-value {
    font-size: 1.3rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

/* Results Container */
.results-container {
    display: grid;
    gap: 15px;
}

.result-item {
    background: #f9f9f9;
    padding: 15px;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-card {
    display: block;
    border-left-width: 6px;
    border: 1.5px solid #bccde7;
    border-left: 6px solid #5f77dc;
    border-radius: 8px;
    background: #f7f9fd;
}

.result-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    margin-bottom: 12px;
}

.result-meta {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.exam-title-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
}

.result-head-left {
    flex: 1;
    min-width: 0;
}

.result-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.rank-pill {
    background: #0f2b46;
    color: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* Top 3 button next to rank */
.top3-btn{
    background: linear-gradient(135deg,#7c3aed,#22d3ee);
    color:#fff;
    border:none;
    padding:8px 10px;
    border-radius:8px;
    font-weight:700;
    cursor:pointer;
    font-size:12px;
}
.top3-btn:hover{ transform: translateY(-2px); }

.rankers-btn{
    background: linear-gradient(135deg,#0f4da8,#0aa5d8);
    color:#fff;
    border:none;
    padding:8px 10px;
    border-radius:8px;
    font-weight:700;
    cursor:pointer;
    font-size:12px;
}

.rankers-btn:hover{
    transform: translateY(-2px);
}

/* Modal for Top 3 list */
.top3-modal{
    position:fixed;
    inset:0;
    display:none;
    align-items:center;
    justify-content:center;
    padding:18px;
    background:rgba(8,17,33,0.65);
    backdrop-filter: blur(4px);
    z-index:4000;
}
.top3-modal-content{
    width:min(760px, 96vw);
    max-height:88vh;
    overflow:auto;
    border-radius:18px;
    border:1px solid #c7d9f2;
    background:linear-gradient(180deg,#ffffff 0%, #f2f7ff 100%);
    box-shadow:0 24px 56px rgba(7,22,48,0.34);
    position:relative;
    animation: rankerIn 220ms ease-out;
}

@keyframes rankerIn{
    from{ opacity:0; transform: translateY(10px) scale(0.98); }
    to{ opacity:1; transform: translateY(0) scale(1); }
}

.leaderboard-panel-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    padding:18px 20px 12px;
    border-bottom:1px solid #dce8fa;
    background:linear-gradient(135deg,#114899 0%, #2e66c7 55%, #4f83db 100%);
    color:#fff;
    border-radius:18px 18px 0 0;
}

.top3-modal-content h3{ margin:0; color:#fff; font-size:1.1rem; letter-spacing:0.01em; }

.rankers-subtitle{
    margin:4px 0 0;
    font-size:0.86rem;
    color:rgba(255,255,255,0.88);
}

.top3-close{
    background:rgba(255,255,255,0.18);
    border:1px solid rgba(255,255,255,0.45);
    color:#fff;
    width:34px;
    height:34px;
    border-radius:50%;
    font-size:21px;
    line-height:1;
    cursor:pointer;
}

#top3-content{ padding:14px 16px 18px; }

.leaderboard-wrap{ border:1px solid #d9e7fb; border-radius:14px; overflow:hidden; background:#ffffff; }

.leaderboard-head{
    display:grid;
    grid-template-columns:90px 1fr 110px;
    gap:8px;
    padding:10px 14px;
    background:#eaf2ff;
    color:#1f4b84;
    font-size:0.82rem;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:0.03em;
}

.leaderboard-head span:last-child{
    justify-self:end;
    text-align:right;
    padding-right:4px;
}

.top3-list{ display:flex; flex-direction:column; gap:8px; padding:10px; }

.top3-row{
    display:grid;
    grid-template-columns:90px 1fr 110px;
    align-items:center;
    gap:8px;
    padding:11px 12px;
    border-radius:10px;
    background:#f7f9fd;
    border:1px solid #e2e8f0;
}

.top3-row.is-you{
    background:linear-gradient(90deg,#eaf2ff,#f3f8ff);
    border-color:#9cb9ec;
    box-shadow:0 0 0 1px rgba(76,124,200,0.2) inset;
}

.top3-rank{ font-weight:800; color:#2C65AA; min-width:36px; }
.top3-rank.rank-1{ color:#9a6500; }
.top3-rank.rank-2{ color:#495a6c; }
.top3-rank.rank-3{ color:#8b4f2f; }

.top3-name{ color:#123b61; font-weight:700; }

.top3-score{
    justify-self:end;
    text-align:right;
    font-weight:800;
    color:#0f8b44;
    background:#e9f9ef;
    border:1px solid #b8e8c9;
    border-radius:999px;
    padding:4px 10px;
}

@media (max-width:560px){
    .leaderboard-head,
    .top3-row{
        grid-template-columns:70px 1fr 90px;
    }
}

.subject-breakdown {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.subject-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    background: #e5eefb;
    border: 1px solid #c5d6ef;
    color: #1e3f66;
    padding: 8px 10px;
    border-radius: 8px;
}

.subject-line span:last-child {
    font-weight: 700;
    color: #123b61;
}

.result-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.percent-pill {
    background: #157a2c;
    color: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
}

.result-item.no-results {
    text-align: center;
    color: #999;
    border-left: none;
}

.result-test-name {
    font-weight: 600;
    color: #333;
    font-size: 20px;
    line-height: 1.1;
}

.result-score {
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.summary-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.summary-label {
    display: block;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.summary-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #2C65AA;
}

/* Navbar for dashboard */
.logo-text {
    color: #0f9fb5;
    font-weight: 800;
}

.nav-content {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.announcement-nav-btn {
    border: none;
    background: transparent;
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.announcement-nav-btn:hover {
    transform: translateY(-1px);
    color: #ffffff;
}

.announcement-nav-icon {
    font-size: 21px;
    line-height: 1;
}

/* ── OTP section ──────────────────────────────────────────────────────── */
.otp-section-hidden { display: none; }

/* "OTP Sent!" success banner */
.otp-sent-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1.5px solid #86efac;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 28px;
}

.otp-sent-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.otp-sent-title {
    font-size: 15px;
    font-weight: 700;
    color: #166534;
    margin: 0 0 2px;
}

.otp-sent-subtitle {
    font-size: 13px;
    color: #15803d;
    margin: 0;
}

/* OTP digit input */
.otp-input-group {
    margin-bottom: 8px;
}

.otp-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.otp-digit-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 14px;
    text-align: center;
    color: #333;
    background: #fafafa;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
    caret-color: #667eea;
}

.otp-digit-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: #fff;
}

.otp-digit-input::placeholder {
    letter-spacing: 12px;
    color: #d0d0d0;
}

/* Resend row */
.otp-resend-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
    font-size: 13px;
    color: #888;
}

.resend-otp-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.resend-otp-link:hover {
    color: #764ba2;
}

.announcement-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.55);
    font-size: 11px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    padding: 0 4px;
    display: none;
}

.home-nav-btn {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 8px 14px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, transform 0.2s ease;
}

.home-nav-icon {
    font-size: 21px;
    line-height: 1;
}

.home-nav-btn:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

.home-nav-btn:visited,
.home-nav-icon,
.announcement-nav-icon {
    color: #ffffff;
}

.student-logout-btn {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.student-logout-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.24);
}

.student-logout-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .student-login-card {
        padding: 30px;
    }

    .student-login-card h1 {
        font-size: 24px;
    }

    .student-login-form label {
        font-size: 13px;
    }

    .student-login-form input {
        padding: 10px 12px;
        font-size: 13px;
    }

    .welcome-text {
        font-size: 2rem;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 0;
    }

    .info-label {
        margin-bottom: 8px;
    }

    .info-value {
        text-align: left;
    }

    .profile-card .card-body {
        padding: 14px;
    }

    .profile-card .info-row {
        grid-template-columns: 42% 58%;
        gap: 8px;
        padding: 11px 2px;
    }

    .profile-card .info-label {
        min-width: 0;
        font-size: 0.92rem;
    }

    .profile-card .info-value {
        font-size: 1.15rem;
        max-width: 100%;
    }

    #display-email.info-value {
        font-size: 1.08rem;
        line-height: 1.3;
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-head {
        display: grid;
        width: 100%;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }

    .result-head-right {
        justify-self: end;
        justify-content: flex-end;
        margin-left: 8px;
    }

    .exam-title-row {
        width: 100%;
    }

    .result-test-name {
        font-size: 18px;
    }

    .result-foot {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .result-score {
        margin-top: 10px;
        align-self: flex-start;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .student-login-card {
        padding: 20px;
        max-width: 100%;
    }

    .student-login-card h1 {
        font-size: 22px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    .card-body {
        padding: 15px;
    }

    .welcome-text {
        font-size: 1.7rem;
    }

    .dashboard-header {
        margin-bottom: 20px;
    }

    .dashboard-content {
        gap: 20px;
    }
}
