/* --- Flashcard Specific UI --- */
.flashcard-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

.custom-dropdown-container {
    width: 100%;
    max-width: 400px;
    margin: 20px auto 40px;
}

.dropdown-wrapper {
    --card-bg: var(--glass-card-bg, rgba(255, 255, 255, 0.05));
    --card-border: var(--border-light, rgba(255, 255, 255, 0.1));
    --orb-1: rgba(88, 101, 242, 0.2);
    --orb-2: rgba(139, 92, 246, 0.12);
    --orb-3: rgba(59, 130, 246, 0.15);

    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

body.dark-mode .dropdown-wrapper {
    --orb-1: rgba(88, 101, 242, 0.35);
    --orb-2: rgba(139, 92, 246, 0.2);
    --orb-3: rgba(59, 130, 246, 0.25);
}

.dropdown-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background:
        radial-gradient(circle at -10% -10%, var(--orb-1) 0%, transparent 65%),
        radial-gradient(circle at 110% 50%, var(--orb-2) 0%, transparent 65%),
        radial-gradient(circle at 40% 120%, var(--orb-3) 0%, transparent 65%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.4s ease;
}

.dropdown-wrapper.active {
    border-color: rgba(108, 92, 231, 0.3);
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.15);
}

.dropdown-header {
    width: 100%;
    padding: 18px;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dropdown-header svg {
    transition: transform 0.3s;
    color: var(--primary);
}

.dropdown-wrapper.active .dropdown-header svg {
    transform: rotate(180deg);
}

.dropdown-list {
    max-height: 0;
    overflow-y: auto;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(108, 92, 231, 0.015);
}

.dropdown-wrapper.active .dropdown-list {
    max-height: 350px;
    border-top: 1px solid var(--border-light);
}

.dropdown-item {
    padding: 14px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
    transition: 0.2s;
    cursor: pointer;
    text-align: left;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--primary);
    color: white !important;
    padding-left: 28px;
}

/* --- Dual-Content Flashcard Container --- */
.flashcard-container {
    perspective: 1000px;
    width: 100%;
    max-width: 500px;
    height: 400px;
    cursor: pointer;
    margin-bottom: 30px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flashcard-container.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 28px;
    background: var(--glass-card-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    z-index: 1;
}

.flashcard-front {
    --orb-1: rgba(88, 101, 242, 0.2);
    --orb-2: rgba(139, 92, 246, 0.12);
    --orb-3: rgba(59, 130, 246, 0.15);

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 35px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
}

body.dark-mode .flashcard-front {
    --orb-1: rgba(88, 101, 242, 0.35);
    --orb-2: rgba(139, 92, 246, 0.2);
    --orb-3: rgba(59, 130, 246, 0.25);
}

.flashcard-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background:
        radial-gradient(circle at -10% -10%, var(--orb-1) 0%, transparent 65%),
        radial-gradient(circle at 110% 50%, var(--orb-2) 0%, transparent 65%),
        radial-gradient(circle at 40% 120%, var(--orb-3) 0%, transparent 65%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.4s ease;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    text-align: left;
    padding: 25px;
    display: block;
}

.ans-label,
.expl-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 800;
    opacity: 0.9;
    margin-bottom: 8px;
    display: block;
}

.ans-text {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 25px;
    border-left: 4px solid white;
    padding-left: 15px;
    display: block;
}

.expl-text {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.15);
    padding: 15px;
    border-radius: 12px;
    display: block;
}

.flash-controls {
    display: flex;
    gap: 20px;
}

.flash-btn {
    padding: 15px 32px;
    border-radius: 50px;
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    color: var(--primary);
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: 0.3s;
}

.flash-btn:hover {
    transform: translateY(-3px);
    background: var(--primary);
    color: white;
}

.card-counter {
    margin-top: 25px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* --- Bookmark Icon on Card --- */
.bookmark-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 10;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: transform 0.25s ease, background 0.25s ease;
}

.bookmark-btn:hover {
    transform: scale(1.2);
    background: rgba(108, 92, 231, 0.08);
}

.bookmark-btn svg {
    width: 26px;
    height: 26px;
    stroke: var(--text-secondary);
    fill: none;
    stroke-width: 2;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.bookmark-btn.active svg {
    fill: #f39c12;
    stroke: #f39c12;
}

.flashcard-back .bookmark-btn svg {
    stroke: rgba(255, 255, 255, 0.5);
    fill: none;
}

.flashcard-back .bookmark-btn.active svg {
    fill: #f1c40f;
    stroke: #f1c40f;
}

/* --- Bookmarks Filter Button --- */
.fc-filter-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.fc-filter-btn {
    padding: 10px 22px;
    border-radius: 50px;
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.fc-filter-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    color: var(--primary);
}

.fc-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.fc-filter-btn svg {
    width: 16px;
    height: 16px;
}

.fc-bookmark-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 800;
}

.fc-filter-btn:not(.active) .fc-bookmark-count {
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary);
}

/* --- Resume Modal --- */
.fc-resume-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fc-resume-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.fc-resume-modal {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 40px 36px 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fc-resume-modal-overlay.visible .fc-resume-modal {
    transform: scale(1) translateY(0);
}

.fc-resume-modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fc-resume-modal-icon svg {
    width: 28px;
    height: 28px;
    stroke: white;
    fill: none;
}

.fc-resume-modal h3 {
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fc-resume-modal p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.5;
}

.fc-resume-modal .progress-info {
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 28px;
    padding: 10px 16px;
    background: rgba(108, 92, 231, 0.08);
    border-radius: 12px;
    display: inline-block;
}

.fc-resume-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.fc-resume-btn {
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: 0.3s;
    border: none;
}

.fc-resume-btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.35);
}

.fc-resume-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.5);
}

.fc-resume-btn.secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.fc-resume-btn.secondary:hover {
    transform: translateY(-2px);
    color: var(--primary);
    border-color: var(--primary);
}

/* --- Progress Bar --- */
.fc-progress-bar-container {
    width: 100%;
    max-width: 500px;
    height: 6px;
    background: var(--border-light);
    border-radius: 10px;
    margin-top: 14px;
    overflow: hidden;
}

.fc-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    border-radius: 10px;
    transition: width 0.4s ease;
    width: 0%;
}

/* --- No Bookmarks Message --- */
.fc-no-bookmarks-msg {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 40px 20px;
}

.fc-no-bookmarks-msg svg {
    display: block;
    margin: 0 auto 12px;
    stroke: var(--text-secondary);
    opacity: 0.4;
}

/* ── Card Slide Animations ── */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(60px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-60px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideOutToLeft {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(-60px) scale(0.95);
    }
}

@keyframes slideOutToRight {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(60px) scale(0.95);
    }
}

.flashcard-container.slide-in-right {
    animation: slideInFromRight 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.flashcard-container.slide-in-left {
    animation: slideInFromLeft 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.flashcard-container.slide-out-left {
    animation: slideOutToLeft 0.15s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.flashcard-container.slide-out-right {
    animation: slideOutToRight 0.15s cubic-bezier(0.4, 0, 1, 1) forwards;
}