/*
Custom CSS for Prepson
This file contains custom styles that extend Tailwind CSS
*/

@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom base styles */
@layer base {
    html {
        font-family: 'Inter', system-ui, sans-serif;
    }
    
    body {
        @apply antialiased;
    }
}

/* Custom components */
@layer components {
    .btn-primary {
        @apply bg-primary text-white px-6 py-2 rounded-lg font-semibold hover:bg-blue-600 transition-colors;
    }
    
    .btn-secondary {
        @apply bg-gray-100 text-gray-700 px-6 py-2 rounded-lg font-semibold hover:bg-gray-200 transition-colors;
    }
    
    .card {
        @apply bg-white rounded-xl shadow-sm border border-gray-200 p-6;
    }
    
    .input-field {
        @apply appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary focus:border-primary;
    }
    
    .voice-button {
        @apply p-2 text-gray-400 hover:text-primary transition-colors;
    }
    
    .loading-spinner {
        @apply animate-spin rounded-full h-8 w-8 border-b-2 border-primary;
    }
}

/* Custom utilities */
@layer utilities {
    .text-gradient {
        background: linear-gradient(135deg, #4C6EF5 0%, #06B6D4 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .bg-gradient-primary {
        background: linear-gradient(135deg, #4C6EF5 0%, #06B6D4 100%);
    }
    
    .shadow-card {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }
    
    .shadow-card-hover {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    }
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

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

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .dark-mode-auto {
        @apply bg-gray-900 text-white;
    }
}

/* Mobile-specific styles */
@media (max-width: 640px) {
    .mobile-padding {
        @apply px-4 py-2;
    }
    
    .mobile-text {
        @apply text-sm;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
}

/* Enhanced radio button styling */
input[type="radio"]:checked + span + span + div {
    border-color: #4C6EF5 !important;
}

input[type="radio"]:checked + span + span + div > div {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

/* Smooth transitions for practice options */
.practice-option {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.practice-option:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Hero Carousel Styles */
.carousel-slide {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.carousel-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.carousel-slide.prev {
    transform: translateX(-100%);
}

.option-animate {
    animation: optionSlideIn 0.5s ease-out forwards;
}

.option-correct {
    animation: correctAnswer 1s ease-out forwards;
}

.feedback-animate {
    animation: feedbackSlideUp 0.8s ease-out forwards;
}

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

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

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

.progress-bar {
    width: 0%;
    transition: width 5s linear;
}

.progress-bar.active {
    width: 100%;
}

/* Hover effects for carousel container */
.carousel-container:hover .progress-bar {
    animation-play-state: paused;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
    .carousel-slide {
        padding: 1rem;
    }
    
    .option-item {
        padding: 0.75rem;
    }
    
    .option-item span {
        font-size: 0.75rem;
    }
}

/* Simplified Exam CSS - consistent with other features */

/* Subject Selection Styles */
.subject-card {
    position: relative;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.subject-card:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.subject-card.selected {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.subject-card.required {
    border-color: #93c5fd;
    background-color: #eff6ff;
}

.subject-card .selection-indicator {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
}

.subject-card.selected .selection-indicator {
    border-color: #3b82f6;
    background-color: #3b82f6;
    color: white;
}

.required-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #3b82f6;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

/* Answer Option Styles */
.answer-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    margin-bottom: 0.75rem;
}

.answer-option:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.answer-option.selected {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.option-letter {
    width: 2rem;
    height: 2rem;
    background-color: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: bold;
    margin-right: 1rem;
    transition: all 0.2s ease-in-out;
}

.answer-option.selected .option-letter {
    background-color: #3b82f6;
    color: white;
}

.option-text {
    flex: 1;
    color: #374151;
}

.option-radio {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease-in-out;
}

.answer-option.selected .option-radio {
    border-color: #3b82f6;
}

.answer-option.selected .option-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.75rem;
    height: 0.75rem;
    background-color: #3b82f6;
    border-radius: 50%;
}

/* Exam Interface Styles */
.exam-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-family: 'Courier New', monospace;
}

.question-container {
    margin-bottom: 2rem;
}

.question-text {
    margin-bottom: 1.5rem;
}

.exam-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
}

.question-progress {
    flex: 1;
    margin: 0 1.5rem;
}

.progress-bar {
    width: 100%;
    background-color: #e5e7eb;
    border-radius: 9999px;
    height: 0.5rem;
    margin-bottom: 0.5rem;
}

.progress-fill {
    background-color: #3b82f6;
    height: 0.5rem;
    border-radius: 9999px;
    transition: all 0.3s ease-in-out;
}

.progress-text {
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
}

.btn.primary {
    background-color: #3b82f6;
    color: white;
}

.btn.primary:hover {
    background-color: #2563eb;
}

.btn.secondary {
    background-color: #e5e7eb;
    color: #374151;
}

.btn.secondary:hover {
    background-color: #d1d5db;
}

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

/* Review Styles */
.exam-review {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.review-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background-color: #f9fafb;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.stat-card.answered {
    background-color: #f0fdf4;
    color: #166534;
}

.stat-card.unanswered {
    background-color: #fefce8;
    color: #a16207;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.875rem;
}

.review-questions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    max-height: 16rem;
    overflow-y: auto;
}

.review-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.review-item.answered {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}

.review-item.unanswered {
    background-color: #fefce8;
    border-color: #fde047;
}

.review-number {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: bold;
}

.review-item.answered .review-number {
    background-color: #22c55e;
    color: white;
}

.review-item.unanswered .review-number {
    background-color: #eab308;
    color: white;
}

.review-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Results Styles */
.exam-results {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.results-header {
    text-align: center;
}

.results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.overall-score {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-circle {
    display: inline-block;
    padding: 2rem;
    border: 8px solid #e5e7eb;
    border-radius: 50%;
}

.score-percentage {
    font-size: 2.5rem;
    font-weight: bold;
    color: #111827;
}

.score-grade {
    font-size: 1.125rem;
    color: #6b7280;
}

.score-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 500;
}

.score-status.pass {
    background-color: #dcfce7;
    color: #166534;
}

.score-status.fail {
    background-color: #fef2f2;
    color: #dc2626;
}

.score-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.breakdown-item {
    text-align: center;
    padding: 1rem;
    border-radius: 0.5rem;
}

.breakdown-item.correct {
    background-color: #f0fdf4;
    color: #166534;
}

.breakdown-item.wrong {
    background-color: #fef2f2;
    color: #dc2626;
}

.breakdown-item.unanswered {
    background-color: #fefce8;
    color: #a16207;
}

.breakdown-number {
    font-size: 1.5rem;
    font-weight: bold;
}

.breakdown-label {
    font-size: 0.875rem;
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.subject-result-card {
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.subject-result-card.green {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}

.subject-result-card.yellow {
    background-color: #fefce8;
    border-color: #fde047;
}

.subject-result-card.red {
    background-color: #fef2f2;
    border-color: #fecaca;
}

.subject-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.subject-score {
    font-size: 1.125rem;
    font-weight: bold;
}

.subject-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* AI Insights */
.ai-insights {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.insight-content {
    color: #374151;
}

.strong-areas, .weak-areas {
    font-size: 0.875rem;
}

.motivation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #3b82f6;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .exam-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .exam-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .question-progress {
        margin: 0;
        order: -1;
    }
    
    .review-stats {
        grid-template-columns: 1fr;
    }
    
    .score-breakdown {
        grid-template-columns: 1fr;
    }
    
    .results-actions {
        flex-direction: column;
    }
}

/* Notification Styles */
.notification {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading States */
.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Focus States for Accessibility */
.btn:focus,
.answer-option:focus,
.subject-card:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Question Grid Styles */
.question-grid {
    flex: 1;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    overflow-y: auto;
}

.question-number {
    width: 40px;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: #718096;
    background: white;
    transition: all 0.3s ease;
}

.question-number:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.question-number.current {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.question-number.answered {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.question-number.unanswered {
    background: #f3f4f6;
    color: #718096;
    border-color: #e2e8f0;
}

.question-number.flagged {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.question-number.answered.flagged {
    background: linear-gradient(45deg, #10b981 50%, #f59e0b 50%);
}

/* Navigation Legend */
.nav-legend {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    background: #f8f9fa;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color.answered {
    background: #10b981;
}

.legend-color.flagged {
    background: #f59e0b;
}

.legend-color.current {
    background: #3b82f6;
}

.legend-color.unanswered {
    background: #f3f4f6;
    border: 1px solid #e2e8f0;
}

/* Print Styles */
@media print {
    .exam-navigation,
    .review-actions,
    .results-actions {
        display: none;
    }
    
    .exam-results {
        color: black;
    }
}

/* Exam Type Selection Styles */
.exam-type-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.exam-type-card:hover .text-center {
    transform: translateY(-2px);
}

.exam-type-card.selected .text-center {
    border-color: #3b82f6 !important;
    background-color: #eff6ff !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Subject Tabs for Navigation */
.subject-tab {
    padding: 0.75rem 1rem;
    border-bottom: 2px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.subject-tab:hover {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.subject-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background-color: #eff6ff;
}

/* Enhanced Answer Option Animation */
.answer-option {
    position: relative;
    overflow: hidden;
}

.answer-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.5s;
}

.answer-option:hover::before {
    left: 100%;
}

/* Exam Loading States */
.exam-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.exam-loading .spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Calculator Modal Backdrop */
.calculator-modal {
    backdrop-filter: blur(4px);
}

/* Enhanced Notification Styles for Exam Context */
.notification.exam-warning {
    border-left: 4px solid #f59e0b;
}

.notification.exam-error {
    border-left: 4px solid #ef4444;
}

.notification.exam-success {
    border-left: 4px solid #10b981;
}

/* Mobile Responsive Improvements */
@media (max-width: 640px) {
    .exam-type-card .text-center {
        padding: 0.75rem;
    }
    
    .question-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.25rem;
    }
    
    .question-number {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    
    .subject-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Accessibility Enhancements */
.exam-type-card:focus,
.question-number:focus,
.subject-tab:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .question-number.current {
        border-width: 3px;
    }
    
    .answer-option.selected {
        border-width: 3px;
    }
    
    .subject-tab.active {
        border-bottom-width: 3px;
    }
}

