/* Custom CSS for Online Exam System */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    color: #333;
}

/* Navigation */
.navbar {
    background: var(--gradient-primary) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Page Management */
.page {
    display: none;
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
}

.page.active {
    display: block;
}

/* Hero Section */
.hero-section {
    padding: 4rem 0;
    text-align: center;
    color: white;
}

.hero-icon {
    font-size: 5rem;
    margin-bottom: 2rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    line-height: 1.6;
    margin-bottom: 3rem;
}

/* Feature Cards */
.feature-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-description {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Login Page */
.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-icon {
    font-size: 4rem;
    color: var(--primary-color);
}

.login-title {
    color: #333;
    font-weight: 600;
}

.login-subtitle {
    color: #666;
    font-size: 1.1rem;
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.form-control {
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Role Selection */
.role-btn {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 1rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

.role-btn:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.role-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.role-btn i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Demo Accounts */
.demo-accounts {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid var(--primary-color);
    margin-top: 2rem;
}

.demo-title {
    color: #333;
    font-weight: 600;
    margin-bottom: 1rem;
}

.demo-account {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e1e5e9;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.demo-account:last-child {
    border-bottom: none;
}

.demo-account:hover {
    background: rgba(102, 126, 234, 0.1);
    padding-left: 1rem;
}

.demo-role {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.demo-email {
    font-size: 0.8rem;
    color: #666;
}

/* Exam Page */
.exam-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    max-width: 1000px;
}

.exam-header {
    background: var(--gradient-primary);
    color: white;
    padding: 2rem;
}

.exam-title {
    font-weight: 600;
}

.user-info {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    font-weight: 500;
}

.timer-container {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    text-align: center;
}

.timer-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.timer-display {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.exam-body {
    padding: 2rem;
    color: #333;
}

.question-number {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1rem;
}

.progress {
    height: 12px;
    border-radius: 10px;
    background-color: #e9ecef;
}

.progress-bar {
    background: var(--gradient-primary);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.question-text {
    background: #f8f9ff;
    border-left: 5px solid var(--primary-color);
    border-radius: 12px;
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.6;
    color: #333;
}

/* Options */
.option {
    background: white;
    border: 3px solid #e1e5e9;
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.option:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
    transform: translateX(5px);
}

.option.selected {
    border-color: var(--primary-color);
    background: var(--gradient-primary);
    color: white;
}

.option-label {
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.option.selected .option-label {
    background: white;
    color: var(--primary-color);
}

.option-text {
    font-size: 1rem;
    line-height: 1.5;
}

/* Admin Page */
.admin-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    color: #333;
}

.admin-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.admin-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.admin-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: white;
}

.admin-card-title {
    color: #333;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.admin-card-text {
    color: #666;
    margin-bottom: 1rem;
    flex-grow: 1;
}

/* Results Page */
.stats-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stats-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stats-value {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

/* Cards */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* Messages */
.alert {
    border-radius: 12px;
    border: none;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    color: #0c5460;
    border-left: 4px solid var(--info-color);
}

/* Buttons */
.btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Table */
.table {
    border-radius: 12px;
    overflow: hidden;
}

.table-primary {
    background: var(--gradient-primary);
    color: white;
}

.table-primary th {
    border: none;
    font-weight: 600;
}

.table-hover tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-icon {
        font-size: 4rem;
    }
    
    .login-card {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .exam-header {
        padding: 1rem;
    }
    
    .exam-body {
        padding: 1rem;
    }
    
    .timer-container,
    .user-info {
        margin: 0.5rem 0;
        text-align: center;
    }
    
    .question-header .row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .exam-navigation .row {
        gap: 1rem;
    }
    
    .exam-navigation .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .exam-navigation .text-end {
        text-align: start !important;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utilities */
.bg-gradient-primary {
    background: var(--gradient-primary) !important;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-lg {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
}

.backdrop-blur {
    backdrop-filter: blur(10px);
}