/* Custom CSS for CFA Question Bank Tracker */

/* General Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Smooth Transitions for Dark Mode */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

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

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

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

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

.animate-count-up {
    animation: countUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Navbar */
.navbar-brand {
    font-size: 1.25rem;
}

/* Cards */
.card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

/* Flashcard Container */
.flashcard-container {
    min-height: 500px;
    max-width: 900px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.flashcard-side {
    min-height: 400px;
}

/* Flashcard Split-Screen Layout (with PDF Viewer) */
.flashcard-list-panel {
    flex: 1;
    overflow-y: auto;
    padding-right: 15px;
    max-width: 100%;
    margin: 0 auto;
}

/* When in split view, adjust flashcard container width */
.split-screen-container .flashcard-container {
    max-width: 100%;
}

/* Choices Styling */
.choices > div {
    transition: all 0.2s;
}

.choices > div:hover {
    background-color: #f8f9fa;
    border-color: #007bff !important;
}

/* Progress Bar */
.progress {
    border-radius: 8px;
}

/* Accordion */
.accordion-button:not(.collapsed) {
    background-color: #e7f3ff;
    color: #0056b3;
}

.accordion-button {
    font-size: 0.95rem;
}

/* Status Badges */
.badge {
    font-size: 0.85rem;
    padding: 0.35em 0.65em;
}

/* Question Display */
.question-text {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Answer Choices with Highlighting */
.choice-correct {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
    padding-left: 12px;
}

.choice-incorrect {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    padding-left: 12px;
}

/* Flashcard Flip Animation */
.flip-enter {
    opacity: 0;
    transform: scale(0.95);
}

.flip-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s ease-in;
}

/* Statistics Display */
.stat-card {
    text-align: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card h2 {
    font-weight: 700;
    margin-bottom: 0;
}

.stat-card .display-4 {
    font-size: 3rem;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.stat-card:hover .display-4 {
    transform: scale(1.1);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 20px;
    margin: 10px 0;
}

.skeleton-card {
    height: 200px;
}

/* Progress Ring */
.progress-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.progress-ring-circle {
    transition: stroke-dashoffset 1s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* Topic Cards */
.topic-card {
    min-height: 300px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .flashcard-container {
        min-height: 400px;
    }

    /* Flashcard panel adjustments for mobile */
    .flashcard-list-panel {
        padding-right: 0;
    }

    .stat-card .display-4 {
        font-size: 2rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .chart-container {
        height: 250px;
    }

    /* Better touch targets for mobile */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-link {
        padding: 1rem !important;
    }

    /* Stack stats vertically on mobile */
    .col-md-3 {
        margin-bottom: 1rem;
    }

    /* Hide icons on mobile nav for space */
    .navbar .bi {
        margin-right: 5px;
    }

    /* Larger fonts for readability */
    .question-text {
        font-size: 1rem;
    }

    /* Full width cards on mobile */
    .card {
        margin-bottom: 1rem;
    }

    /* Better accordion spacing */
    .accordion-button {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .stat-card .display-4 {
        font-size: 1.75rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 200px;
    }

    /* Hide text labels in navigation, keep only icons */
    .navbar .nav-link i {
        margin-right: 0;
    }
}

/* Footer */
footer {
    margin-top: auto;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 0.8s linear infinite;
}

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

/* Highlight matched search terms */
.search-highlight {
    background-color: yellow;
    font-weight: bold;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Print styles */
@media print {
    .navbar, footer, .btn, .accordion-button {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
