/* Online Exam System - Frontend Styles - Updated Version */
.online-exam-system {
    font-family: Tahoma, Arial, sans-serif;
    direction: rtl;
    text-align: right;
    background: linear-gradient(to bottom right, #f0f9ff, #e0e7ff);
    min-height: 100vh;
}

.min-h-full {
    min-height: 100vh;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1 1 0%;
}

.max-w-4xl {
    max-width: 56rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.w-full {
    width: 100%;
}

/* Background and text colors - Enhanced */
.bg-white {
    background-color: white;
}

.bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}

.from-blue-50 {
    --tw-gradient-from: #eff6ff;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(239, 246, 255, 0));
}

.to-indigo-100 {
    --tw-gradient-to: #e0e7ff;
}

.bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops));
}

.from-blue-50 {
    --tw-gradient-from: #eff6ff;
}

.to-indigo-50 {
    --tw-gradient-to: #eef2ff;
}

.from-indigo-500 {
    --tw-gradient-from: #6366f1;
}

.to-purple-600 {
    --tw-gradient-to: #9333ea;
}

.bg-green-600 {
    background-color: #16a34a;
}

.bg-red-600 {
    background-color: #dc2626;
}

.bg-indigo-600 {
    background-color: #4f46e5;
}

.hover\:bg-green-700:hover {
    background-color: #15803d;
}

.hover\:bg-red-700:hover {
    background-color: #b91c1c;
}

.hover\:bg-indigo-700:hover {
    background-color: #4338ca;
}

.text-white {
    color: white;
}

.text-gray-800 {
    color: #1f2937;
}

.text-gray-700 {
    color: #374151;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-500 {
    color: #6b7280;
}

.text-blue-800 {
    color: #1e40af;
}

.text-blue-700 {
    color: #1d4ed8;
}

.text-blue-600 {
    color: #2563eb;
}

.text-green-600 {
    color: #16a34a;
}

.text-purple-600 {
    color: #9333ea;
}

.text-yellow-700 {
    color: #a16207;
}

/* Borders and rounded - Enhanced */
.rounded-xl {
    border-radius: 1rem;
}

.rounded-lg {
    border-radius: 0.75rem;
}

.border {
    border-width: 1px;
}

.border-2 {
    border-width: 2px;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.border-gray-300 {
    border-color: #d1d5db;
}

.border-blue-200 {
    border-color: #bfdbfe;
}

.border-green-200 {
    border-color: #bbf7d0;
}

.border-blue-200 {
    border-color: #bfdbfe;
}

.border-purple-200 {
    border-color: #e9d5ff;
}

.border-yellow-200 {
    border-color: #fef08a;
}

.border-indigo-200 {
    border-color: #c7d2fe;
}

/* Shadows - Enhanced */
.shadow-lg {
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.15), 0 8px 12px -6px rgba(0, 0, 0, 0.1);
}

.shadow-xl {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2), 0 10px 15px -8px rgba(0, 0, 0, 0.1);
}

/* Padding and margin - Enhanced */
.p-8 {
    padding: 2.5rem;
}

.p-6 {
    padding: 2rem;
}

.p-4 {
    padding: 1.5rem;
}

.p-3 {
    padding: 1rem;
}

.py-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.py-3 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-2 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.px-12 {
    padding-left: 4rem;
    padding-right: 4rem;
}

.px-8 {
    padding-left: 3rem;
    padding-right: 3rem;
}

.px-4 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.px-3 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.mb-8 {
    margin-bottom: 3rem;
}

.mb-6 {
    margin-bottom: 2rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 0.75rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mt-8 {
    margin-top: 3rem;
}

.mt-6 {
    margin-top: 2rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-2 {
    margin-top: 0.75rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mr-4 {
    margin-right: 1.5rem;
}

.mr-3 {
    margin-right: 1rem;
}

.mr-2 {
    margin-right: 0.75rem;
}

.ml-3 {
    margin-left: 1rem;
}

.ml-2 {
    margin-left: 0.75rem;
}

/* Flexbox - Enhanced */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

/* Grid - Enhanced */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gap-6 {
    gap: 2rem;
}

.gap-4 {
    gap: 1.5rem;
}

.gap-2 {
    gap: 0.75rem;
}

.space-y-6 > * + * {
    margin-top: 2rem;
}

.space-y-4 > * + * {
    margin-top: 1.5rem;
}

.space-y-2 > * + * {
    margin-top: 0.75rem;
}

.space-x-4 > * + * {
    margin-right: 1.5rem;
}

.space-x-2 > * + * {
    margin-right: 0.75rem;
}

.space-x-reverse {
    --tw-space-x-reverse: 1;
}

/* Text - Enhanced */
.text-center {
    text-align: center;
}

.text-4xl {
    font-size: 2.5rem;
    line-height: 1.2;
}

.text-2xl {
    font-size: 1.75rem;
    line-height: 1.3;
}

.text-xl {
    font-size: 1.5rem;
    line-height: 1.4;
}

.text-lg {
    font-size: 1.25rem;
    line-height: 1.5;
}

.text-sm {
    font-size: 0.95rem;
    line-height: 1.4;
}

.text-xs {
    font-size: 0.85rem;
    line-height: 1.2;
}

.font-bold {
    font-weight: 800;
}

.font-semibold {
    font-weight: 700;
}

.font-medium {
    font-weight: 600;
}

.leading-relaxed {
    line-height: 1.7;
}

/* Width and height - Enhanced */
.w-8 {
    width: 2.5rem;
}

.w-6 {
    width: 2rem;
}

.w-5 {
    width: 1.75rem;
}

.w-2 {
    width: 0.75rem;
}

.w-full {
    width: 100%;
}

.w-48 {
    width: 14rem;
}

.w-24 {
    width: 8rem;
}

.h-8 {
    height: 2.5rem;
}

.h-6 {
    height: 2rem;
}

.h-5 {
    height: 1.75rem;
}

.h-2 {
    height: 0.75rem;
}

.h-full {
    height: 100%;
}

.h-48 {
    height: 14rem;
}

.h-24 {
    height: 8rem;
}

/* Input styles - Enhanced */
input[type="text"],
input[type="number"],
input[type="tel"] {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 0.75rem;
    font-size: 1.05rem;
    transition: all 0.3s;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.focus\:ring-2:focus {
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

.focus\:ring-indigo-500:focus {
    --tw-ring-color: #6366f1;
}

.focus\:border-indigo-500:focus {
    border-color: #6366f1;
}

/* Button styles - Enhanced */
button {
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-weight: 600;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.transition-colors {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

.transition-all {
    transition: all 0.3s ease;
}

.duration-200 {
    transition-duration: 200ms;
}

.duration-300 {
    transition-duration: 300ms;
}

.disabled\:opacity-50:disabled {
    opacity: 0.5;
}

.disabled\:cursor-not-allowed:disabled {
    cursor: not-allowed;
}

/* Background colors for stats - Enhanced */
.bg-green-50 {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.bg-blue-50 {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.bg-purple-50 {
    background: linear-gradient(135deg, #faf5ff, #e9d5ff);
}

.bg-yellow-50 {
    background: linear-gradient(135deg, #fefce8, #fef08a);
}

.bg-gray-50 {
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
}

/* Hidden utility */
.hidden {
    display: none;
}

/* Backdrop blur - Enhanced */
.backdrop-blur-sm {
    backdrop-filter: blur(8px);
}

.backdrop-blur-md {
    backdrop-filter: blur(12px);
}

/* Opacity */
.bg-opacity-20 {
    --tw-bg-opacity: 0.2;
}

.bg-opacity-30 {
    --tw-bg-opacity: 0.3;
}

.text-opacity-90 {
    --tw-text-opacity: 0.9;
}

/* Animations - Enhanced */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(25px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg) scale(1); }
    25% { transform: translateY(-20px) rotate(90deg) scale(1.1); }
    50% { transform: translateY(-35px) rotate(180deg) scale(1.2); }
    75% { transform: translateY(-20px) rotate(270deg) scale(1.1); }
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), inset 0 0 20px rgba(255, 255, 255, 0.3); }
    100% { box-shadow: 0 0 50px rgba(255, 215, 0, 1), inset 0 0 30px rgba(255, 255, 255, 0.5); }
}

@keyframes correct-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes incorrect-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Progress circle - Enhanced */
.progress-circle {
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
}

/* Certificate seal - Enhanced */
.certificate-seal {
    background: radial-gradient(circle, #ffd700, #ffed4e, #ffa500);
    border: 5px solid #b8860b;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.9), inset 0 0 25px rgba(255, 255, 255, 0.4);
    animation: pulse-glow 2.5s ease-in-out infinite alternate;
}

/* Grade badge - Enhanced */
.grade-badge {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #b8860b;
    font-weight: 800;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    border: 3px solid #b8860b;
    animation: pulse-glow 2.5s ease-in-out infinite alternate;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
}

/* Action button - Enhanced */
.action-button {
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    font-weight: 700;
}

.action-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
}

.action-button:hover::before {
    width: 350px;
    height: 350px;
}

.action-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

/* Floating stars - Enhanced */
.floating-stars {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.star {
    position: absolute;
    color: rgba(255, 255, 255, 0.95);
    animation: float 5s ease-in-out infinite;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
}

/* Answer review - Enhanced */
.answer-review-item {
    transition: all 0.4s ease;
    border-right: 5px solid transparent;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
}

.answer-review-item.correct {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.15));
    border-right-color: #10b981;
    animation: correct-pulse 0.6s ease-in-out;
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.2);
}

.answer-review-item.incorrect {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.15));
    border-right-color: #ef4444;
    animation: incorrect-shake 0.6s ease-in-out;
    box-shadow: 0 5px 20px rgba(239, 68, 68, 0.2);
}

/* Relative positioning */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.z-10 {
    z-index: 10;
}

.z-20 {
    z-index: 20;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

.max-h-80 {
    max-height: 22rem;
}

.max-h-96 {
    max-height: 26rem;
}

/* Result Card Styles - Enhanced */
.result-card {
    background: white;
    position: relative;
    overflow: hidden;
    border: 3px solid #e5e7eb;
    border-radius: 1.5rem;
    box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.2);
}

.success-bg {
    background: white;
    border: 3px solid #10b981;
    box-shadow: 0 20px 50px -15px rgba(16, 185, 129, 0.3);
}

.warning-bg {
    background: white;
    border: 3px solid #f59e0b;
    box-shadow: 0 20px 50px -15px rgba(245, 158, 11, 0.3);
}

.danger-bg {
    background: white;
    border: 3px solid #ef4444;
    box-shadow: 0 20px 50px -15px rgba(239, 68, 68, 0.3);
}

/* Stats Card - Enhanced */
.stats-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.4s ease;
    border-radius: 1rem;
}

.stats-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

/* Performance Badge - Enhanced */
.performance-badge {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px);
    border: 3px solid rgba(255, 255, 255, 0.4);
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
}

.performance-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: slide 2.5s ease-in-out infinite;
}

@keyframes slide {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Confetti Animation - Enhanced */
.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ffd700;
    animation: confetti-fall 4s linear infinite;
    border-radius: 50%;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Grade Glow Animation - Enhanced */
@keyframes grade-glow {
    0% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
    100% { box-shadow: 0 0 25px rgba(255, 215, 0, 1); }
}

/* Media queries - Enhanced */
@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    
    .md\:p-8 {
        padding: 2.5rem;
    }
    
    .md\:text-4xl {
        font-size: 2.5rem;
    }
}

@media (max-width: 640px) {
    .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .py-8 {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .p-8 {
        padding: 1.5rem;
    }
    
    .text-4xl {
        font-size: 2rem;
    }
    
    .text-2xl {
        font-size: 1.5rem;
    }
}

/* Custom scrollbar - Enhanced */
.space-y-4::-webkit-scrollbar {
    width: 8px;
}

.space-y-4::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.space-y-4::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.space-y-4::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading Spinner - Enhanced */
.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* File Upload Styles - Enhanced */
.file-upload-zone {
    border: 3px dashed #d1d5db;
    border-radius: 1rem;
    padding: 2.5rem;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.file-upload-zone:hover {
    border-color: #4f46e5;
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-3px);
}

.file-upload-zone.dragover {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    transform: scale(1.02);
}

/* Timer Styles - Enhanced */
.timer-box {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 1.5rem;
    box-shadow: 0 15px 35px rgba(79, 70, 229, 0.4);
    position: relative;
    overflow: hidden;
}

.timer-box::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Question Styles - Enhanced */
.question-item {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid #f3f4f6;
    transition: all 0.3s ease;
}

.question-item:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
    border-color: #e5e7eb;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
}

.option-label:hover {
    background: #f8fafc;
    border-color: #4f46e5;
    transform: translateX(-5px);
}

.option-label.selected {
    background: linear-gradient(135deg, #f0f9ff, #e0e7ff);
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .action-button {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .timer-box {
        margin: 1rem 0;
    }
    
    .question-item {
        padding: 1.5rem;
    }
    
    .option-label {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .action-button,
    .timer-box,
    .floating-stars {
        display: none !important;
    }
    
    .result-card {
        box-shadow: none !important;
        border: 2px solid #000 !important;
    }
}