@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #0A0E27;
    --primary-light: #1A1F3A;
    --accent: #00D9FF;
    --accent-glow: rgba(0, 217, 255, 0.3);
    --text-primary: #FFFFFF;
    --text-secondary: #A0AEC0;
    --success: #00FF88;
    --warning: #FFB800;
    --error: #FF4757;
    --surface: #151932;
    --surface-hover: #1F2541;
    --border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Manrope', sans-serif;
    background: linear-gradient(135deg, #0A0E27 0%, #1A1F3A 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 217, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 255, 136, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* LOGIN SCREEN */
.login-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 4rem 3rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-section {
    text-align: center;
    margin-bottom: 3rem;
}

.logo-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, #00FF88 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.logo-text {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, #00FF88 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.input-group {
    margin-bottom: 2rem;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--primary-light);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-align: center;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.input-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.input-group input:focus + .input-underline {
    width: 100%;
}

.primary-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, #00FF88 100%);
    border: none;
    border-radius: 12px;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--accent-glow);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    color: var(--error);
    font-size: 0.875rem;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* PROFILE SCREEN */
.profile-container {
    max-width: 1200px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.profile-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.profile-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-right {
    display: flex;
    flex-direction: column;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    flex-shrink: 0;
}

.profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.profile-info {
    flex: 1;
}

.student-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.student-id-display {
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.subjects-section {
    margin-bottom: 2rem;
}

.subjects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.subject-card {
    padding: 1rem 1.25rem;
    background: var(--primary-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.subject-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.face-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--primary-light);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    margin-bottom: 1rem;
}

#faceVideo,
#faceCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#faceCanvas {
    pointer-events: none;
}

.face-status {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(10, 14, 39, 0.9);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.875rem;
    backdrop-filter: blur(10px);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s ease infinite;
}

.face-status.detected .status-indicator {
    background: var(--success);
}

.face-status.warning .status-indicator {
    background: var(--error);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.warning-count {
    padding: 0.75rem 1rem;
    background: rgba(255, 184, 0, 0.1);
    border: 1px solid var(--warning);
    border-radius: 8px;
    color: var(--warning);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
}

.warning-count span {
    font-weight: 700;
    font-size: 1.25rem;
}

/* TEST SCREEN */
.test-container {
    max-width: 1400px;
    width: 100%;
    min-height: calc(100vh - 4rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
}

.test-blocked-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 71, 87, 0.95);
    color: white;
    padding: 2rem 3rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(255, 71, 87, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    animation: shake 0.5s ease;
    backdrop-filter: blur(10px);
}

.warning-icon {
    font-size: 3rem;
    animation: pulse 1s ease infinite;
}

.warning-text strong {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.warning-text p {
    font-size: 1rem;
    opacity: 0.9;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(-52%, -50%); }
    75% { transform: translate(-48%, -50%); }
}

.test-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.test-student-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.test-student-photo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
    flex-shrink: 0;
}

.test-student-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.test-student-photo .photo-placeholder {
    width: 100%;
    height: 100%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.test-student-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.test-student-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.test-student-id {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.test-student-subject {
    font-size: 0.875rem;
    color: var(--accent);
    font-weight: 500;
}

.test-timer-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.timer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent);
}

.finish-btn-header {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--error) 0%, #ff6b7a 100%);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.finish-btn-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 71, 87, 0.4);
}

.face-monitor {
    position: relative;
    width: 200px;
    height: 150px;
    background: var(--primary-light);
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    justify-self: end;
}

#testFaceVideo,
#testFaceCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-face-status {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(10, 14, 39, 0.9);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mini-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s ease infinite;
}

.mini-face-status.detected .mini-indicator {
    background: var(--success);
}

.test-warning-count {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(10, 14, 39, 0.9);
    border-radius: 8px;
    color: var(--warning);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    text-align: center;
}

.test-content {
    display: flex;
    gap: 2rem;
    flex: 1;
}

.questions-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.question-numbers {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.question-number {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.question-number:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.question-number.answered {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.question-number.current {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--primary);
    font-weight: 700;
}

.question-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.question-number-display {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.question-number-display span {
    color: var(--accent);
    font-weight: 700;
    font-size: 1rem;
}

.question-text {
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--primary-light);
    border-radius: 12px;
    border-left: 4px solid var(--accent);
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.answer-option {
    padding: 1.25rem 1.5rem;
    background: var(--primary-light);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.answer-option:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.answer-option.selected {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.answer-letter {
    width: 32px;
    height: 32px;
    background: var(--surface);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
}

.answer-option.selected .answer-letter {
    background: var(--accent);
    color: var(--primary);
}

.answer-option:disabled,
.answer-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.navigation-buttons {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.nav-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    background: var(--primary-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .test-content {
        flex-direction: column;
    }
    
    .questions-sidebar {
        width: 100%;
    }
    
    .profile-top-row {
        grid-template-columns: 1fr;
    }
    
    .test-header {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .face-monitor {
        justify-self: center;
    }
}

@media (max-width: 768px) {
    .screen {
        padding: 1rem;
    }
    
    .login-container,
    .profile-container,
    .test-container {
        padding: 2rem 1.5rem;
    }
    
    .profile-top-row {
        grid-template-columns: 1fr;
    }
    
    .profile-left {
        flex-direction: column;
        text-align: center;
    }
    
    .test-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .subjects-list {
        grid-template-columns: 1fr;
    }
}