/* Modern Exam System - Bootstrap 5 Enhanced Styles */
:root {
    --sidebar-width: 260px;
    --navbar-height: 56px;
    --primary: #0d6efd;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #0dcaf0;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    overflow-x: hidden;
}

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

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

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideInLeft 0.4s ease-out;
}

/* Layout */
.content-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--navbar-height);
}

.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - var(--navbar-height));
}

@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .main-content {
        margin-left: 0;
    }
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary), #0a58ca);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.stat-card-icon {
    font-size: 2.5rem;
    opacity: 0.3;
    position: absolute;
    right: 1rem;
    bottom: 1rem;
}

.stat-card-primary { background: linear-gradient(135deg, #0d6efd, #0a58ca); }
.stat-card-success { background: linear-gradient(135deg, #198754, #146c43); }
.stat-card-warning { background: linear-gradient(135deg, #ffc107, #ffb300); color: #000; }
.stat-card-danger { background: linear-gradient(135deg, #dc3545, #bb2d3b); }
.stat-card-info { background: linear-gradient(135deg, #0dcaf0, #0aa2c0); }

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
}

.btn-success {
    background: linear-gradient(135deg, #198754, #146c43);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #bb2d3b);
}

.btn-action {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    margin: 0 0.2rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.table {
    margin-bottom: 0;
}

.table thead {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.table thead th {
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: #495057;
    padding: 1rem;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.005);
}

.table tbody td {
    vertical-align: middle;
    padding: 1rem;
}

/* Forms */
.form-control, .form-select, textarea {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.625rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

/* Badges */
.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.login-card {
    max-width: 450px;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeIn 0.6s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.login-header h2 {
    color: #212529;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #6c757d;
}

/* Exam Interface */
.exam-container {
    max-width: 1400px;
    margin: 0 auto;
}

.exam-header {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.exam-timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exam-timer.warning {
    animation: pulse 1s infinite;
}

.question-nav {
    position: sticky;
    top: calc(var(--navbar-height) + 20px);
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.question-numbers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 0.5rem;
}

.question-number {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.question-number:hover {
    transform: scale(1.1);
}

.question-number.answered {
    background: var(--success);
    color: white;
}

.question-number.current {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.question-number.unanswered {
    background: #e9ecef;
    color: #495057;
}

.question-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

/* Code Display */
.code-block {
    background: #282c34;
    color: #abb2bf;
    padding: 1.5rem;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.code-block::-webkit-scrollbar {
    height: 8px;
}

.code-block::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

/* Watermark */
.watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 3rem;
    color: rgba(0,0,0,0.05);
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    font-weight: 700;
    user-select: none;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Alert Animations */
.alert {
    border-radius: 10px;
    border: none;
    animation: slideInLeft 0.4s ease-out;
}

/* Sidebar Active Link */
.list-group-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}

.list-group-item {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.list-group-item:hover {
    background: #f8f9fa;
    border-left-color: var(--primary);
    padding-left: 1.25rem;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 1rem;
}

/* Action Bar */
.action-bar {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    flex-wrap: wrap;
    gap: 1rem;
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 2.5rem;
    min-width: 300px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

/* Modal Enhancements */
.modal-content {
    border-radius: 15px;
    border: none;
    animation: fadeIn 0.3s ease-out;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), #0a58ca);
    color: white;
    border-radius: 15px 15px 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Toast Notifications */
.toast {
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Progress Bar */
.progress {
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--info));
    transition: width 0.3s ease;
}

/* Exam Card for Student */
.exam-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary);
}

.exam-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.exam-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
}

.exam-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.exam-card-meta i {
    margin-right: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .exam-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        width: 100%;
        min-width: auto;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-sm-hover:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Print Styles */
@media print {
    .sidebar, .navbar, .action-bar, .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}