/* ================================================
   SecureExam Pro — Visual Enhancement Stylesheet
   ================================================ */

/* ── Text Selection ── */
::selection {
    background: rgba(99, 102, 241, .35);
    color: #fff;
}

/* ── Smooth Scrolling ── */
html {
    scroll-behavior: smooth;
}

/* ── Body subtle noise texture ── */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    opacity: .4;
}

/* ══════════════════════════════
   LOGIN PAGE ENHANCEMENTS
   ══════════════════════════════ */

/* Animated background grid shimmer */
.bg-grid::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 80% at 50% -20%, rgba(99, 102, 241, .15), transparent);
    pointer-events: none;
}

/* Login card — glowing border on hover */
.login-card {
    transition: box-shadow .4s ease, border-color .4s ease;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, rgba(99, 102, 241, .3), rgba(139, 92, 246, .15), rgba(6, 182, 212, .1));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity .4s ease;
}

.login-card:hover::before {
    opacity: 1;
}

.login-card:hover {
    box-shadow: 0 20px 60px rgba(99, 102, 241, .2), 0 0 0 1px rgba(99, 102, 241, .2);
}

/* Floating label animation */
.form-group label {
    transition: color .2s ease;
}

.form-group:focus-within label {
    color: var(--primary);
}

/* Input glow on focus */
input:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .2), 0 2px 12px rgba(99, 102, 241, .15);
}

/* Sign-In button shimmer sweep */
.btn-primary {
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .18), transparent);
    transform: skewX(-20deg);
    transition: left .6s ease;
}

.btn-primary:hover::after {
    left: 160%;
}

/* Feature badges glow on hover */
.feature-badge {
    transition: background .25s, border-color .25s, box-shadow .25s, transform .2s;
}

.feature-badge:hover {
    background: rgba(99, 102, 241, .12);
    border-color: rgba(99, 102, 241, .4);
    box-shadow: 0 4px 16px rgba(99, 102, 241, .15);
    transform: translateY(-2px);
    color: var(--text);
}

/* Brand icon glow */
.brand-icon {
    filter: drop-shadow(0 4px 16px rgba(99, 102, 241, .5));
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Demo item hover scale */
.demo-item {
    transition: transform .2s ease, border-color .2s, background .2s, box-shadow .2s;
}

.demo-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(99, 102, 241, .15);
}

/* ══════════════════════════════
   SIDEBAR ENHANCEMENTS
   ══════════════════════════════ */

.sidebar {
    background: linear-gradient(180deg, #13131f 0%, #0f0f1a 100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, .35);
}

/* Nav item left accent bar */
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 0 3px 3px 0;
}

.nav-item {
    transition: background .2s, color .2s, transform .15s, padding-left .2s;
}

.nav-item:hover {
    padding-left: 18px;
}

.nav-item.active {
    padding-left: 18px;
}

/* User avatar pulse ring */
.sidebar-user .user-avatar {
    position: relative;
}

.sidebar-user .user-avatar::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 13px;
    border: 2px solid rgba(99, 102, 241, .4);
    animation: ringPulse 2.5s ease-in-out infinite;
}

@keyframes ringPulse {

    0%,
    100% {
        opacity: .6;
        transform: scale(1);
    }

    50% {
        opacity: 0;
        transform: scale(1.12);
    }
}

/* Logout button hover */
.btn-logout {
    transition: background .25s, transform .15s, box-shadow .25s;
}

.btn-logout:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, .2);
}

/* ══════════════════════════════
   STAT CARDS — GRADIENT GLOW
   ══════════════════════════════ */

.stat-card {
    transition: transform .25s ease, box-shadow .25s ease;
    overflow: hidden;
}

/* Glow shimmer sweep */
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .04), transparent);
    transform: skewX(-15deg);
    transition: left .5s ease;
}

.stat-card:hover::after {
    left: 160%;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.card-blue:hover {
    box-shadow: 0 12px 36px rgba(99, 102, 241, .25);
    border-color: rgba(99, 102, 241, .35);
}

.card-purple:hover {
    box-shadow: 0 12px 36px rgba(139, 92, 246, .25);
    border-color: rgba(139, 92, 246, .35);
}

.card-green:hover {
    box-shadow: 0 12px 36px rgba(16, 185, 129, .25);
    border-color: rgba(16, 185, 129, .35);
}

.card-red:hover {
    box-shadow: 0 12px 36px rgba(239, 68, 68, .25);
    border-color: rgba(239, 68, 68, .35);
}

/* Gradient backgrounds for stat cards */
.card-blue {
    background: linear-gradient(135deg, rgba(99, 102, 241, .08), rgba(99, 102, 241, .02));
}

.card-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, .08), rgba(139, 92, 246, .02));
}

.card-green {
    background: linear-gradient(135deg, rgba(16, 185, 129, .08), rgba(16, 185, 129, .02));
}

.card-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, .08), rgba(239, 68, 68, .02));
}

/* Stat value counter animation */
.stat-value {
    transition: transform .3s ease;
}

.stat-card:hover .stat-value {
    transform: scale(1.08);
}

/* ══════════════════════════════
   GLASS CARD ENHANCEMENTS
   ══════════════════════════════ */

.glass-card {
    transition: box-shadow .3s ease, border-color .3s ease;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, .15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
}

/* Card header decorative line */
.card-header {
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    margin-bottom: 18px;
}

.card-header h3 {
    position: relative;
    padding-left: 12px;
}

.card-header h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 3px;
}

/* ══════════════════════════════
   QUESTION CARDS
   ══════════════════════════════ */

.question-card {
    position: relative;
    overflow: hidden;
}

.question-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s ease;
}

.question-card:hover::after {
    transform: scaleX(1);
}

/* ══════════════════════════════
   EXAM CARDS ENHANCEMENTS
   ══════════════════════════════ */

.exam-card,
.stu-exam-card {
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.exam-card:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, .4), 0 0 0 1px rgba(99, 102, 241, .25);
    border-color: rgba(99, 102, 241, .3);
}

/* Top gradient bar animation */
.exam-card::before,
.stu-exam-card::before {
    background-size: 200% 100%;
    animation: gradShift 4s linear infinite;
}

@keyframes gradShift {
    0% {
        background-position: 0% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ══════════════════════════════
   DATA TABLE ENHANCEMENTS
   ══════════════════════════════ */

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(15, 15, 26, .9);
    backdrop-filter: blur(10px);
}

.data-table th {
    position: relative;
}

.data-table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, .4), transparent);
}

.data-table tr {
    transition: background .15s ease;
}

.data-table tbody tr:hover td {
    background: rgba(99, 102, 241, .04);
}

/* ══════════════════════════════
   VIOLATION ITEMS
   ══════════════════════════════ */

.violation-item {
    transition: transform .2s, box-shadow .2s;
    animation: slideInLeft .35s ease both;
}

.violation-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(239, 68, 68, .12);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ══════════════════════════════
   MODAL ENHANCEMENTS
   ══════════════════════════════ */

.modal {
    box-shadow: 0 32px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .08);
}

.modal-header h3 {
    background: linear-gradient(135deg, #fff 60%, rgba(255, 255, 255, .6));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    border: 1px solid transparent;
}

.modal-close:hover {
    border-color: rgba(255, 255, 255, .1);
    transform: rotate(90deg);
    transition: transform .25s ease, background .2s;
}

/* ══════════════════════════════
   OPTION ITEMS (EXAM) ENHANCEMENTS
   ══════════════════════════════ */

.option-item {
    position: relative;
    overflow: hidden;
    transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
}

.option-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, .1);
}

.option-item.selected {
    box-shadow: 0 4px 20px rgba(99, 102, 241, .2);
}

/* Ripple on option click */
.option-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(99, 102, 241, .25) 0%, transparent 70%);
    opacity: 0;
    transition: opacity .4s ease;
}

.option-item.selected::after {
    opacity: 1;
}

/* ══════════════════════════════
   TIMER BLOCK ANIMATIONS
   ══════════════════════════════ */

.timer-block {
    position: relative;
    overflow: hidden;
}

.timer-block::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 40%, rgba(255, 255, 255, .06) 50%, transparent 60%);
    animation: timerSheen 3s ease-in-out infinite;
}

@keyframes timerSheen {

    0%,
    100% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(100%);
    }
}

/* Violation counter shake on increment */
@keyframes violShake {

    0%,
    100% {
        transform: translateX(0) scale(1);
    }

    20%,
    60% {
        transform: translateX(-4px) scale(1.1);
    }

    40%,
    80% {
        transform: translateX(4px) scale(1.1);
    }
}

.violation-indicator.shake {
    animation: violShake .4s ease;
}

/* ══════════════════════════════
   NAVIGATOR BUTTONS
   ══════════════════════════════ */

.nav-q-btn {
    transition: background .2s, border-color .2s, transform .15s, box-shadow .2s;
}

.nav-q-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 2px 10px rgba(99, 102, 241, .2);
    border-color: var(--primary);
    color: var(--primary);
}

/* ══════════════════════════════
   PROGRESS BAR GLOW
   ══════════════════════════════ */

.exam-progress-bar {
    position: relative;
}

.exam-progress-fill {
    position: relative;
    box-shadow: 0 0 10px rgba(99, 102, 241, .5), 0 0 4px rgba(139, 92, 246, .4);
}

.exam-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: rgba(255, 255, 255, .4);
    filter: blur(4px);
    border-radius: 4px;
}

/* ══════════════════════════════
   SECTION HEADER DECORATION
   ══════════════════════════════ */

.section-header h2 {
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    animation: lineExpand .5s ease forwards;
}

@keyframes lineExpand {
    from {
        width: 0;
    }

    to {
        width: 40px;
    }
}

/* ══════════════════════════════
   STUDENT STAT BOXES
   ══════════════════════════════ */

.stu-stat {
    transition: transform .2s, box-shadow .2s, border-color .2s;
    cursor: default;
}

.stu-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, .18);
    border-color: rgba(99, 102, 241, .3);
}

.stu-stat-val {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ══════════════════════════════
   INFO BANNER PULSE
   ══════════════════════════════ */

.info-banner {
    animation: bannerGlow 3s ease-in-out infinite alternate;
}

@keyframes bannerGlow {
    from {
        box-shadow: 0 0 0 rgba(245, 158, 11, 0);
    }

    to {
        box-shadow: 0 0 20px rgba(245, 158, 11, .1);
    }
}

/* ══════════════════════════════
   MY RESULT CARDS
   ══════════════════════════════ */

.my-result-card {
    transition: transform .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}

.my-result-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(255, 255, 255, .04), transparent);
    border-radius: 50%;
}

.my-result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}

.my-result-card.passed:hover {
    box-shadow: 0 10px 30px rgba(16, 185, 129, .15);
}

.my-result-card.failed:hover {
    box-shadow: 0 10px 30px rgba(239, 68, 68, .15);
}

.my-result-card.terminated:hover {
    box-shadow: 0 10px 30px rgba(245, 158, 11, .15);
}

/* ══════════════════════════════
   RESULT BADGE ANIMATION
   ══════════════════════════════ */

.result-badge {
    animation: badgePop .5s cubic-bezier(.175, .885, .32, 1.275) both;
}

@keyframes badgePop {
    from {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.result-score {
    animation: scoreFade .6s ease .3s both;
}

@keyframes scoreFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ══════════════════════════════
   TOAST ENHANCEMENTS
   ══════════════════════════════ */

.toast {
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
    border: 1px solid rgba(255, 255, 255, .1);
}

.toast.success {
    box-shadow: 0 8px 24px rgba(16, 185, 129, .35);
}

.toast.error {
    box-shadow: 0 8px 24px rgba(239, 68, 68, .35);
}

.toast.warning {
    box-shadow: 0 8px 24px rgba(245, 158, 11, .35);
}

.toast.info {
    box-shadow: 0 8px 24px rgba(99, 102, 241, .35);
}

/* ══════════════════════════════
   STATUS BADGES — GLOW DOTS
   ══════════════════════════════ */

.status-badge {
    position: relative;
    padding-left: 18px;
    display: inline-flex;
    align-items: center;
}

.status-badge::before {
    content: '';
    position: absolute;
    left: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: dotBlink 2s ease-in-out infinite;
}

.status-passed::before,
.status-active::before {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.status-failed::before {
    background: var(--red);
    box-shadow: 0 0 6px var(--red);
}

.status-terminated::before {
    background: var(--yellow);
    box-shadow: 0 0 6px var(--yellow);
    animation: none;
}

.status-inactive::before {
    background: var(--text2);
    box-shadow: none;
    animation: none;
}

@keyframes dotBlink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .5;
        transform: scale(.8);
    }
}

/* ══════════════════════════════
   SEARCH & FILTER BAR
   ══════════════════════════════ */

.search-input {
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.search-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15), 0 2px 12px rgba(99, 102, 241, .1);
}

/* ══════════════════════════════
   CHEAT WARNING ENHANCEMENT
   ══════════════════════════════ */

.cheat-warning {
    background: linear-gradient(90deg, rgba(239, 68, 68, .15), rgba(239, 68, 68, .08));
    border-left: 4px solid var(--red);
    box-shadow: 0 4px 20px rgba(239, 68, 68, .15);
}

/* ══════════════════════════════
   SCROLLBAR STYLED
   ══════════════════════════════ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .02);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ══════════════════════════════
   LOADING SKELETON (Shimmer)
   ══════════════════════════════ */

.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, .04) 25%, rgba(255, 255, 255, .08) 50%, rgba(255, 255, 255, .04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ══════════════════════════════
   HEADER CLOCK GLOW
   ══════════════════════════════ */

.header-time {
    animation: clockGlow 2s ease-in-out infinite alternate;
    font-variant-numeric: tabular-nums;
}

@keyframes clockGlow {
    from {
        box-shadow: 0 0 8px rgba(99, 102, 241, .2);
    }

    to {
        box-shadow: 0 0 20px rgba(99, 102, 241, .4);
    }
}

/* ══════════════════════════════
   SIDEBAR BRAND GLOW
   ══════════════════════════════ */

.brand-icon.small {
    filter: drop-shadow(0 2px 10px rgba(99, 102, 241, .4));
}

/* ══════════════════════════════
   BUTTON ICON HOVER
   ══════════════════════════════ */

.btn-icon {
    transition: background .2s, border-color .2s, color .2s, transform .15s, box-shadow .2s;
}

.btn-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, .15);
}

/* ══════════════════════════════
   EXAM TOPBAR SHADOW
   ══════════════════════════════ */

.exam-topbar {
    box-shadow: 0 2px 20px rgba(0, 0, 0, .3);
}

/* ══════════════════════════════
   STUDENT HEADER GLASS
   ══════════════════════════════ */

.student-header {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, .25);
}

/* ══════════════════════════════
   PRINT STYLES
   ══════════════════════════════ */

@media print {

    .sidebar,
    .exam-topbar,
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .toast {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }

    .glass-card {
        background: #f9f9f9 !important;
        border: 1px solid #ddd !important;
    }
}

/* ══════════════════════════════
   REDUCED MOTION
   ══════════════════════════════ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}