/* ==========================================================================
   LeoWegner — Custom Styles (Bootstrap 5 companion)
   ========================================================================== */

/* -- CSS Variables --------------------------------------------------------- */
:root {
    --lu-primary: #4f46e5;
    --lu-primary-hover: #4338ca;
    --lu-primary-light: #eef2ff;
    --lu-primary-rgb: 79, 70, 229;
    --lu-accent: #f59e0b;
    --lu-accent-hover: #d97706;
    --lu-accent-light: #fffbeb;
    --lu-accent-rgb: 245, 158, 11;
    --lu-success: #10b981;
    --lu-danger: #ef4444;
    --lu-body-bg: #f8fafc;
    --lu-card-radius: 0.75rem;
    --lu-transition: 0.25s ease;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    background-color: var(--lu-body-bg);
}

/* -- Navbar ---------------------------------------------------------------- */
.navbar {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    transition: box-shadow var(--lu-transition);
}

.navbar.bg-dark {
    background-color: #1e1b4b !important;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.2rem;
}

.navbar .nav-link {
    font-weight: 500;
    font-size: 0.9rem;
    padding-left: 0.875rem;
    padding-right: 0.875rem;
    transition: color var(--lu-transition);
}

.navbar .nav-link:hover {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Streak badge in navbar */
.navbar .text-warning.fw-bold {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.navbar .fa-fire {
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.5));
}

/* Language switcher */
.navbar .dropdown-menu {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    padding: 0.375rem;
    min-width: 10rem;
}

.navbar .dropdown-item {
    border-radius: 0.375rem;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    transition: background var(--lu-transition);
}

.navbar .dropdown-item.active,
.navbar .dropdown-item:active {
    background-color: var(--lu-primary);
}

/* -- Hero Section ---------------------------------------------------------- */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, var(--lu-body-bg), transparent);
    pointer-events: none;
}

/* -- Course Cards ---------------------------------------------------------- */
.card {
    border-radius: var(--lu-card-radius);
}

.card.shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* Hover lift for course grid cards */
.course-card,
.category-card {
    transition: transform var(--lu-transition), box-shadow var(--lu-transition);
    border: none;
}

.course-card:hover,
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(var(--lu-primary-rgb), 0.12),
                0 4px 8px rgba(0, 0, 0, 0.06) !important;
}

.card-img-top {
    border-radius: var(--lu-card-radius) var(--lu-card-radius) 0 0;
}

/* -- Flashcard Flip Animation ---------------------------------------------- */
.flashcard {
    perspective: 1000px;
    cursor: pointer;
    min-height: 300px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    min-height: 300px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 300px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    border-radius: var(--lu-card-radius);
}

.flashcard-front {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.flashcard-back {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 2px solid var(--lu-success);
    transform: rotateY(180deg);
}

/* -- Star Rating Selector -------------------------------------------------- */
.star-rating-selector {
    display: inline-flex;
    gap: 0.25rem;
}

.star-rating-selector .star-btn {
    transition: color 0.15s ease, transform 0.15s ease;
}

.star-rating-selector .star-btn:hover {
    transform: scale(1.15);
}

/* Standard HTML form star rating (radio-based) */
.star-rating {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 0.125rem;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    font-size: 1.5rem;
    color: #d1d5db;
    transition: color 0.15s ease, transform 0.15s ease;
}

.star-rating label:hover,
.star-rating label:hover ~ label {
    color: var(--lu-accent);
}

.star-rating input:checked ~ label {
    color: var(--lu-accent);
}

/* -- Achievement / Badge Cards --------------------------------------------- */
.badge-card {
    transition: transform var(--lu-transition), box-shadow var(--lu-transition);
}

.badge-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.card.border-2 {
    transition: transform var(--lu-transition), box-shadow var(--lu-transition);
}

.card.border-2:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Badge earned animation (optional class) */
@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.badge-earned {
    animation: badgePulse 0.6s ease;
}

/* -- Progress Bars --------------------------------------------------------- */
.progress {
    border-radius: 99px;
    background-color: #e5e7eb;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.5s ease;
    border-radius: 99px;
}

.progress-bar.bg-success {
    background: linear-gradient(90deg, #10b981, #059669) !important;
}

/* -- Study Streak Display -------------------------------------------------- */
.fa-fire {
    color: var(--lu-accent);
}

/* Profile streak card */
.card .fa-fire.fa-3x {
    filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.35));
    animation: flameGlow 2s ease-in-out infinite;
}

@keyframes flameGlow {
    0%, 100% { filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.35)); }
    50% { filter: drop-shadow(0 2px 14px rgba(245, 158, 11, 0.55)); }
}

.streak-badge {
    background: linear-gradient(135deg, var(--lu-accent), #f97316);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* -- Practice Session Feedback --------------------------------------------- */
.feedback .alert-success,
.correct {
    border-left: 4px solid var(--lu-success);
}

.feedback .alert-danger,
.incorrect {
    border-left: 4px solid var(--lu-danger);
}

.border-success {
    border-color: var(--lu-success) !important;
}

.border-danger {
    border-color: var(--lu-danger) !important;
}

/* Exercise card highlight after answering */
.exercise-card .answer-input.border-success {
    box-shadow: 0 0 0 0.2rem rgba(16, 185, 129, 0.15);
}

.exercise-card .answer-input.border-danger {
    box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, 0.15);
}

/* -- Quiz Timer Warning ---------------------------------------------------- */
#timer-alert {
    font-size: 1.1rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

#timer-alert.alert-danger {
    animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

#timer-display {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* Selected quiz answer highlight */
.form-check-input:checked + .form-check-label {
    font-weight: 600;
    color: var(--lu-primary);
}

/* -- Lesson Content Styling ------------------------------------------------ */
.lesson-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.lesson-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
}

.lesson-content code {
    background-color: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

.lesson-content pre code {
    background: none;
    padding: 0;
}

.lesson-content blockquote {
    border-left: 4px solid var(--lu-primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #555;
    font-style: italic;
}

.lesson-content .table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lesson-content table {
    width: 100%;
    border-collapse: collapse;
}

.lesson-content table th,
.lesson-content table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    min-width: 120px;
    white-space: nowrap;
}

.lesson-content table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.lesson-content table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

/* -- Footer ---------------------------------------------------------------- */
footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer h5, footer h6 {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

footer a.text-secondary {
    transition: color var(--lu-transition);
}

footer a.text-secondary:hover {
    color: #e5e7eb !important;
    text-decoration: none;
}

footer .fab {
    transition: color var(--lu-transition), transform var(--lu-transition);
}

footer .fab:hover {
    color: #fff !important;
    transform: translateY(-2px);
}

/* -- Badges (Bootstrap override) ------------------------------------------- */
.badge-points {
    background: linear-gradient(135deg, var(--lu-accent), #f97316);
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-weight: 600;
}

/* -- Avatar ---------------------------------------------------------------- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-lg {
    width: 80px;
    height: 80px;
}

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

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

/* -- Alert auto-hide transition -------------------------------------------- */
.alert {
    transition: opacity 0.3s ease;
}

/* -- Breadcrumbs ----------------------------------------------------------- */
.breadcrumb {
    font-size: 0.875rem;
    padding: 0;
    margin-bottom: 1rem;
    background: transparent;
}

.breadcrumb-item a {
    color: var(--lu-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* -- List Group Enhancements ----------------------------------------------- */
.list-group-item-action:hover {
    background-color: #f8fafc;
}

.list-group-item.active .fas.fa-check-circle {
    color: #fff !important;
}

/* -- Scrollbar ------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* -- Card Footer Links ----------------------------------------------------- */
.card-footer .btn-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
}

/* -- Responsive ------------------------------------------------------------ */
@media (max-width: 991.98px) {
    .navbar .nav-link {
        padding: 0.5rem 0;
    }

    .navbar .dropdown-menu {
        border: none;
        box-shadow: none;
    }
}

@media (max-width: 767.98px) {
    .display-4 {
        font-size: 2rem;
    }

    .flashcard,
    .flashcard-inner,
    .flashcard-front,
    .flashcard-back {
        min-height: 220px;
    }

    .card.border-2 .fa-3x {
        font-size: 2rem !important;
    }

    .star-rating-selector .star-btn.fa-2x {
        font-size: 1.5rem !important;
    }

    /* Stack course detail sidebar below content on mobile */
    .col-lg-4 {
        margin-top: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .btn-lg {
        font-size: 0.95rem;
        padding: 0.5rem 1rem;
    }

    .display-1 {
        font-size: 3rem;
    }

    .display-6 {
        font-size: 1.5rem;
    }
}
