/* AI Simplify Sidebar Styles */

.ai-simplify-sidebar {
    position: fixed;
    top: 100px;
    right: 0;
    z-index: 1000;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Toggle Button */
.ai-simplify-toggle-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    border: none;
    border-radius: 16px 0 0 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    box-shadow: -4px 4px 20px rgba(0, 116, 197, 0.4);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 999;
    min-width: 90px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: -4px 4px 20px rgba(0, 116, 197, 0.4);
    }
    50% {
        box-shadow: -4px 4px 30px rgba(0, 174, 196, 0.6);
    }
}

.ai-simplify-toggle-btn:hover {
    transform: translateY(-50%) translateX(-8px);
    box-shadow: -6px 6px 30px rgba(0, 174, 196, 0.6);
    animation: none;
}

.btn-icon-wrapper {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon {
    font-size: 28px !important;
    animation: rotate 3s ease-in-out infinite;
}

@keyframes rotate {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(10deg);
    }
}

.ai-simplify-toggle-btn:hover .btn-icon {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

.btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.btn-label {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
    line-height: 1.2;
    text-align: center;
}

.btn-sublabel {
    font-weight: 500;
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.2;
    text-align: center;
}

/* Right Sidebar Panel */
.ai-simplify-panel {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 650px;
    max-width: 90vw;
    height: 90vh;
    max-height: 900px;
    background: white;
    box-shadow: -2px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: slideInFromRight 0.3s ease-out;
    z-index: 9999;
    border-radius: 16px 0 0 16px;
    overflow: hidden;
    isolation: isolate;
}

/* Glowing border effect when generating content */
.ai-simplify-panel.is-generating {
    box-shadow: -2px 0 30px rgba(0, 116, 197, 0.4);
}

@keyframes slideInFromRight {
    from {
        transform: translateY(-50%) translateX(100%);
    }
    to {
        transform: translateY(-50%) translateX(0);
    }
}

/* Header */
.ai-simplify-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title .material-symbols-rounded {
    font-size: 32px;
}

.header-title h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-close .material-symbols-rounded {
    font-size: 20px;
}

/* Content */
.ai-simplify-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    position: relative;
    min-height: 0;
}

/* Custom scrollbar for content */
.ai-simplify-content::-webkit-scrollbar {
    width: 8px;
}

.ai-simplify-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ai-simplify-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.ai-simplify-content::-webkit-scrollbar-thumb:hover {
    background: #0074C5;
}

/* Grade Selector */
.grade-selector-section {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3748;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #0074C5;
    box-shadow: 0 0 0 3px rgba(0, 116, 197, 0.1);
}

/* Action Section */
.action-section {
    margin-bottom: 24px;
}

.action-section .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.help-text {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
    font-weight: 500;
}

/* Loading Section */
.loading-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(2px);
    z-index: 100;
    margin: 0;
    border-radius: 8px 0 0 8px;
}

.loading-section .spinner-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    transition: none !important;
    animation: none !important;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e2e8f0;
    border-top-color: #0074C5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-section .loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 8px 0;
    transition: none !important;
    animation: none !important;
}

.loading-section .loading-text .material-symbols-rounded {
    font-size: 20px;
    color: #0074C5;
}

.loading-section .loading-subtext {
    font-size: 13px;
    color: #718096;
    margin: 0;
    transition: none !important;
    animation: none !important;
}

/* Simplified Content */
.simplified-content-section {
    animation: fadeIn 0.4s ease-out;
    padding: 32px 40px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.success-icon {
    color: #48bb78;
    font-size: 28px;
}

.content-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #2d3748;
}

.learning-mode-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.grade-badge {
    background: #0074C5;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Show Flashcards Button Section */
.show-flashcards-section {
    text-align: center;
    padding: 28px;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 116, 197, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.show-flashcards-section .btn {
    margin-bottom: 10px;
    background: white;
    color: #0074C5;
    font-size: 18px;
    padding: 20px 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

.show-flashcards-section .btn:hover {
    background: #f0f8fc;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.show-flashcards-section .help-hint {
    color: white !important;
    font-weight: 600;
    font-size: 14px;
}

/* Flashcard Overlay (Full Screen) */
.flashcard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
    overflow: hidden;
}

.flashcard-overlay-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 60px 20px;
}

.flashcard-close-x {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10001;
}

.flashcard-close-x:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.flashcard-close-x .material-symbols-rounded {
    font-size: 24px;
}

.show-summary-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    border: 2px solid white;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s ease;
    z-index: 10001;
    box-shadow: 0 4px 16px rgba(0, 116, 197, 0.5);
}

.show-summary-btn:hover {
    background: linear-gradient(135deg, #00AEC4 0%, #0074C5 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 174, 196, 0.6);
    border-color: rgba(255, 255, 255, 1);
}

.show-summary-btn .material-symbols-rounded {
    font-size: 22px;
}

.flashcard-container-centered {
    max-width: 700px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: slideUp 0.4s ease-out;
    transition: transform 0.3s ease-out;
}

/* Move flashcard up when modal is open */
.flashcard-overlay.has-modal-open .flashcard-container-centered {
    transform: translateY(-35vh);
}

/* Flashcard Container */
.flashcard-container {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* AI Avatar Section for Cards */
.ai-avatar-section-card {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
}

/* AI Avatar Section */
.ai-avatar-section {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f8fc 0%, #e6f4f9 100%);
    border-radius: 16px;
}

.ai-avatar-container {
    position: relative;
    display: inline-block;
}

.avatar-circle {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 116, 197, 0.3);
    position: relative;
    transition: all 0.3s ease;
}

.is-speaking .avatar-circle {
    animation: avatar-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(0, 174, 196, 0.5);
}

@keyframes avatar-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.avatar-face {
    position: relative;
    width: 80px;
    height: 80px;
}

.avatar-eyes {
    display: flex;
    justify-content: space-around;
    margin-bottom: 16px;
}

.eye {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: relative;
    animation: blink 4s ease-in-out infinite;
}

.eye:after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #1a202c;
    border-radius: 50%;
    top: 4px;
    left: 4px;
}

@keyframes blink {
    0%, 48%, 52%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(0.1);
    }
}

.avatar-mouth {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 16px;
    border: 3px solid white;
    border-top: none;
    border-radius: 0 0 32px 32px;
    transition: all 0.2s ease;
}

.mouth-speaking {
    animation: talk 0.3s ease-in-out infinite;
}

@keyframes talk {
    0%, 100% {
        height: 16px;
        border-radius: 0 0 32px 32px;
    }
    50% {
        height: 8px;
        border-radius: 0 0 16px 16px;
    }
}

.sound-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    pointer-events: none;
}

.wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(0, 174, 196, 0.6);
    border-radius: 50%;
    animation: wave-expand 1.5s ease-out infinite;
}

.wave-2 {
    animation-delay: 0.5s;
}

.wave-3 {
    animation-delay: 1s;
}

@keyframes wave-expand {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.avatar-play-btn {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 4px solid white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
}

.avatar-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.6);
}

.avatar-play-btn:active {
    transform: scale(0.95);
}

.avatar-play-btn .material-symbols-rounded {
    font-size: 28px;
}

.avatar-label {
    margin: 16px 0 0 0;
    font-size: 14px;
    font-weight: 600;
    color: #0074C5;
}

/* Flashcard Styles */
.flashcard-wrapper {
    perspective: 1000px;
    position: relative;
    width: 100%;
}

.flashcard {
    width: 100%;
    height: 500px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Increase height when flipped to show more content */
.flashcard.is-flipped {
    height: 700px;
}

.flashcard:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

/* Glowing border effect when reading */
.flashcard.is-reading {
    position: relative;
}

.flashcard.is-reading::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 24px;
    background: linear-gradient(
        45deg,
        #00AEC4,
        #0074C5,
        #00D9FF,
        #10b981,
        #f59e0b,
        #00AEC4,
        #0074C5
    );
    background-size: 400% 400%;
    animation: gradient-rotate 4s ease infinite, glow-pulse 1.5s ease-in-out infinite;
    z-index: -1;
    filter: blur(8px);
}

@keyframes glow-pulse {
    0%, 100% {
        opacity: 0.6;
        filter: blur(8px);
    }
    50% {
        opacity: 1;
        filter: blur(12px);
    }
}

@keyframes gradient-rotate {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.flashcard.is-flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    background: white;
    border: none;
    position: absolute;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flashcard-front {
    transition: box-shadow 0.3s ease;
    display: flex;
    flex-direction: row;
    padding: 0;
    overflow: hidden;
}

.flashcard-back {
    transform: rotateY(180deg);
    overflow-y: auto;
    padding: 32px;
    cursor: pointer;
}

/* Card Navigation Areas */
.card-nav-area {
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0, 116, 197, 0.05);
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.card-nav-area:hover {
    background: rgba(0, 116, 197, 0.15);
}

.card-nav-area .material-symbols-rounded {
    font-size: 48px;
    color: #0074C5;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.card-nav-area:hover .material-symbols-rounded {
    opacity: 1;
    transform: scale(1.2);
}

.card-nav-left {
    border-radius: 20px 0 0 20px;
}

.card-nav-right {
    border-radius: 0 20px 20px 0;
}

/* Center Content Area */
.card-center-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 32px;
    overflow-y: auto;
    cursor: pointer;
}

.card-header {
    margin-bottom: 20px;
}

.card-number {
    display: inline-block;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
}

.card-title {
    margin: 12px 0 0 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.card-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.card-text {
    font-size: 18px;
    line-height: 1.8;
    color: #2d3748;
    font-weight: 500;
    margin: 0;
}

.card-actions {
    margin-top: auto;
    margin-bottom: 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.card-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #0074C5;
    font-weight: 600;
    opacity: 0.7;
    margin-top: 8px;
}

.card-hint .material-symbols-rounded {
    font-size: 18px;
    animation: tap-pulse 2s ease-in-out infinite;
}

@keyframes tap-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

.read-card-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 116, 197, 0.3);
    position: relative;
    overflow: hidden;
}

.read-card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 116, 197, 0.4);
}

.read-card-btn:active {
    transform: translateY(0);
}

.read-card-btn .material-symbols-rounded {
    font-size: 20px;
}

.read-card-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Animated gradient background when speaking */
.read-card-btn.is-speaking {
    background: linear-gradient(
        90deg,
        #00AEC4,
        #0074C5,
        #00D9FF,
        #10b981,
        #f59e0b,
        #00AEC4,
        #0074C5
    );
    background-size: 300% 100%;
    animation: button-gradient-shift 3s ease infinite;
}

@keyframes button-gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.spinning {
    animation: spin 1s linear infinite;
}

.learn-more-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.learn-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.learn-more-btn:active {
    transform: translateY(0);
}

.learn-more-btn .material-symbols-rounded {
    font-size: 20px;
}

.simplify-card-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.simplify-card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.simplify-card-btn:active {
    transform: translateY(0);
}

.simplify-card-btn .material-symbols-rounded {
    font-size: 18px;
}


/* Flashcard Back Styles */
.flashcard-back .card-header {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.flashcard-back .card-header:hover {
    opacity: 0.8;
}

.card-back-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    text-align: left;
}

/* Basic Definition */
.basic-definition {
    padding: 24px 20px;
    text-align: center;
}

.definition-text {
    color: #2d3748;
    font-size: 16px;
    line-height: 1.8;
    margin: 0 0 28px 0;
    font-weight: 500;
}

.explore-more-section {
    margin-top: 24px;
}

.btn-explore-more {
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    border: none;
    padding: 16px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 116, 197, 0.3);
}

.btn-explore-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 174, 196, 0.4);
}

.btn-explore-more .material-symbols-rounded {
    font-size: 22px;
}

.back-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.back-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #0074C5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.back-loading p {
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
}

.back-details {
    border-top: 2px solid #e2e8f0;
    padding-top: 20px;
    margin-top: 20px;
}

.back-details .expanded-explanation {
    color: #2d3748;
    line-height: 1.7;
    font-size: 14px;
    padding: 0 20px;
}

.back-details .expanded-explanation p {
    margin: 0 0 12px 0;
    font-weight: 500;
}

.back-details .expanded-explanation p:last-child {
    margin-bottom: 0;
}

.back-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    text-align: center;
}

.back-error .material-symbols-rounded {
    font-size: 48px;
    color: #f56565;
    margin-bottom: 12px;
}

.back-error p {
    color: #4a5568;
    margin: 0;
}

.card-back-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.flip-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 116, 197, 0.3);
}

.flip-back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 116, 197, 0.4);
}

.flip-back-btn .material-symbols-rounded {
    font-size: 20px;
}


.simplified-text {
    background: linear-gradient(135deg, #f0f8fc 0%, #e6f4f9 100%);
    padding: 32px;
    border-radius: 16px;
    border-left: 6px solid #0074C5;
    line-height: 1.9;
    color: #1a202c;
    font-size: 17px;
    box-shadow: 0 2px 8px rgba(0, 116, 197, 0.08);
}

.simplified-text p {
    margin: 0 0 20px 0;
    font-weight: 500;
}

.simplified-text p:last-child {
    margin-bottom: 0;
}

.simplified-text ul,
.simplified-text ol {
    margin: 16px 0;
    padding-left: 32px;
}

.simplified-text ul {
    list-style-type: none;
    padding-left: 0;
}

.simplified-text li {
    margin-bottom: 16px;
    padding-left: 36px;
    position: relative;
    line-height: 1.8;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 14px 48px 14px 36px;
    margin-left: -8px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: rgba(0, 116, 197, 0.03);
    font-size: 16px;
}

.simplified-text li:after {
    content: "›";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    opacity: 0.3;
    transition: all 0.2s ease;
    color: #0074C5;
    font-weight: bold;
}

.simplified-text li:hover {
    background: rgba(0, 116, 197, 0.12);
    transform: translateX(4px);
    border-color: #0074C5;
    box-shadow: 0 2px 8px rgba(0, 116, 197, 0.15);
}

.simplified-text li:hover:after {
    content: "›";
    opacity: 1;
    transform: translateY(-50%) translateX(3px);
    animation: slideRight 0.6s ease infinite;
}

@keyframes slideRight {
    0%, 100% {
        transform: translateY(-50%) translateX(0px);
    }
    50% {
        transform: translateY(-50%) translateX(4px);
    }
}

.simplified-text ul li:before {
    content: "▸";
    color: #0074C5;
    font-weight: bold;
    font-size: 18px;
    position: absolute;
    left: 8px;
}

.simplified-text ol li {
    padding-left: 8px;
    font-weight: 500;
}

.simplified-text strong {
    color: #0074C5;
    font-weight: 700;
}

.simplified-text em {
    color: #4a5568;
    font-style: italic;
}

/* Still Confused Section */
.still-confused-section {
    text-align: center;
}

.is-btn-help {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    font-weight: 700;
    padding: 20px 32px;
    border-radius: 14px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.is-btn-help:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
}

.is-btn-help:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.is-btn-help .material-symbols-rounded {
    font-size: 22px;
    animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.help-hint {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #f59e0b;
    font-weight: 600;
    font-style: italic;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.button-group .btn {
    flex: 1;
    min-width: calc(33.333% - 6px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.is-btn-secondary {
    background: white;
    color: #0074C5;
    border: 2px solid #0074C5;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 116, 197, 0.15);
}

.is-btn-secondary:hover {
    background: #f0f8fc;
    border-color: #00AEC4;
    color: #00AEC4;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 174, 196, 0.25);
}

.is-btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 116, 197, 0.15);
}

.is-btn-outline {
    background: white;
    color: #0074C5;
    border: 2px solid #0074C5;
}

.is-btn-outline:hover {
    background: #f0f8fc;
}

.is-btn-primary {
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 116, 197, 0.25);
    padding: 18px 32px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.is-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 174, 196, 0.4);
}

.is-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 116, 197, 0.3);
}

.is-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Star Rating Section */
.star-rating-section {
    background: #f7fafc;
    padding: 16px 16px 20px 16px;
    border-radius: 8px;
    text-align: center;
}

.rating-label {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 12px 0;
}

.star-rating {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: all 0.2s ease;
}

.star-btn:hover {
    transform: scale(1.15);
}

.star-btn .material-symbols-rounded {
    font-size: 32px;
    color: #cbd5e0;
    transition: all 0.2s ease;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 48;
}

.star-btn.is-filled .material-symbols-rounded,
.star-btn.is-hovering .material-symbols-rounded {
    color: #f59e0b;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 48;
}

/* Card Star Rating */
.card-star-rating {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 12px;
    margin-bottom: 8px;
}

.card-star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px;
    transition: all 0.2s ease;
}

.card-star-btn:hover {
    transform: scale(1.1);
}

.card-star-btn .material-symbols-rounded {
    font-size: 24px;
    color: #cbd5e0;
    transition: all 0.2s ease;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 48;
}

.card-star-btn.is-filled .material-symbols-rounded {
    color: #f59e0b;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 48;
}

/* Quiz Section */
.quiz-section {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #f0f8fc 0%, #e6f4f9 100%);
    border-radius: 12px;
    border: 2px solid #0074C5;
}

.quiz-loading {
    text-align: center;
    padding: 20px;
}

.spinner-small {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #0074C5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

.quiz-loading p {
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

.quiz-content {
    animation: fadeIn 0.3s ease-out;
}

.quiz-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #0074C5;
}

.quiz-header .material-symbols-rounded {
    font-size: 28px;
    color: #0074C5;
}

.quiz-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1a202c;
}

.quiz-question {
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 16px 0;
    line-height: 1.6;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.quiz-option:hover:not(:disabled) {
    border-color: #0074C5;
    background: #f0f8fc;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 116, 197, 0.15);
}

.quiz-option:disabled {
    cursor: not-allowed;
}

.quiz-option.is-correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    animation: correctPulse 0.5s ease-out;
}

.quiz-option.is-incorrect {
    background: linear-gradient(135deg, #fed7d7 0%, #fca5a5 100%);
    border-color: #ef4444;
    animation: incorrectShake 0.5s ease-out;
}

.quiz-option.is-correct-reveal {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
}

@keyframes correctPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes incorrectShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-8px);
    }
    75% {
        transform: translateX(8px);
    }
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.quiz-option.is-correct .option-letter {
    background: #10b981;
}

.quiz-option.is-incorrect .option-letter {
    background: #ef4444;
}

.quiz-option.is-correct-reveal .option-letter {
    background: #10b981;
}

.option-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
    line-height: 1.5;
}

.option-icon {
    margin-left: auto;
}

.option-icon .material-symbols-rounded {
    font-size: 24px;
}

.quiz-option.is-correct .option-icon .material-symbols-rounded {
    color: #10b981;
}

.quiz-option.is-incorrect .option-icon .material-symbols-rounded {
    color: #ef4444;
}

.quiz-feedback {
    margin-top: 16px;
    padding: 16px;
    border-radius: 10px;
    animation: fadeIn 0.4s ease-out;
}

.feedback-correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
}

.feedback-incorrect {
    background: linear-gradient(135deg, #fed7d7 0%, #fca5a5 100%);
    border: 2px solid #ef4444;
}

.feedback-correct .material-symbols-rounded {
    color: #10b981;
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.feedback-incorrect .material-symbols-rounded {
    color: #ef4444;
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.feedback-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1a202c;
}

.feedback-text {
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
    margin: 0;
    line-height: 1.6;
}

/* Error Section */
.error-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px;
    background: white;
    z-index: 1;
}

.error-icon {
    margin-bottom: 24px;
}

.error-icon .material-symbols-rounded {
    font-size: 64px;
    color: #f56565;
}

.error-message {
    color: #2d3748;
    margin: 0 0 28px 0;
    line-height: 1.6;
    font-size: 17px;
}

/* Footer */
.ai-simplify-footer {
    padding: 16px 24px;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
}

.footer-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #718096;
    margin: 0;
}

.footer-text .material-symbols-rounded {
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-simplify-panel {
        width: 100%;
    }

    .ai-simplify-toggle-btn {
        right: 16px;
        top: auto;
        bottom: 80px;
        transform: none;
        border-radius: 50%;
        width: 64px;
        height: 64px;
        padding: 8px;
        min-width: unset;
    }

    .btn-icon-wrapper {
        width: 40px;
        height: 40px;
        margin-bottom: 0;
    }

    .btn-icon {
        font-size: 24px !important;
    }

    .ai-simplify-toggle-btn .btn-content {
        display: none;
    }
}

/* Utility Classes */
.w100 {
    width: 100%;
}

.mt12 {
    margin-top: 12px;
}

.mt18 {
    margin-top: 18px;
}

.mb12 {
    margin-bottom: 12px;
}

.mb18 {
    margin-bottom: 18px;
}

/* Tell Me More Modal */
.tell-me-more-modal {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 550px;
    z-index: 100000;
    animation: slideUpModal 0.3s ease-out;
    pointer-events: auto;
}

@keyframes slideUpModal {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-height: calc(100vh - 450px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border: 2px solid rgba(0, 116, 197, 0.2);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #0074C5 0%, #00AEC4 100%);
    color: white;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.modal-header .material-symbols-rounded {
    font-size: 20px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-close-btn .material-symbols-rounded {
    font-size: 20px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    background: #ffffff;
}

.modal-loading {
    text-align: center;
    padding: 40px 20px;
}

.modal-loading .spinner {
    margin: 0 auto 16px;
}

.modal-loading p {
    color: #4a5568;
    font-weight: 500;
}

.original-point {
    background: linear-gradient(135deg, #f0f8fc 0%, #e6f4f9 100%);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 116, 197, 0.1);
}

.original-point strong {
    color: #0074C5;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.original-point strong:before {
    content: "💡";
    font-size: 14px;
}

.original-point p {
    margin: 0;
    color: #1a202c;
    font-weight: 600;
    line-height: 1.6;
    font-size: 13px;
}

.expanded-explanation {
    color: #2d3748;
    line-height: 1.7;
    font-size: 13px;
}

.expanded-explanation p {
    margin: 0 0 12px 0;
    font-weight: 500;
}

.expanded-explanation p:last-child {
    margin-bottom: 0;
}

.expanded-explanation strong {
    color: #0074C5;
    font-weight: 700;
}

.expanded-explanation ul,
.expanded-explanation ol {
    margin: 16px 0;
    padding-left: 24px;
}

.expanded-explanation li {
    margin-bottom: 10px;
    line-height: 1.7;
    font-weight: 500;
}

.modal-error {
    text-align: center;
    padding: 40px 20px;
}

.modal-error .material-symbols-rounded {
    font-size: 48px;
    color: #f56565;
    margin-bottom: 16px;
}

.modal-error p {
    color: #4a5568;
    margin: 0 0 20px 0;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }

    .modal-header {
        padding: 20px 24px;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .modal-body {
        padding: 24px 20px;
    }

    .original-point {
        padding: 16px;
    }

    .expanded-explanation {
        font-size: 14px;
    }
}

/* Avatar Video Overlay */
.avatar-video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.avatar-video-container {
    position: relative;
    max-width: 600px;
    width: 90%;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease-out;
}

.avatar-video {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
}

.avatar-video-close {
    position: absolute;
    top: -60px;
    right: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.avatar-video-close:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.avatar-video-close .material-symbols-rounded {
    font-size: 24px;
}

@media (max-width: 768px) {
    .avatar-video-container {
        width: 95%;
        max-width: none;
    }

    .avatar-video-close {
        top: -55px;
        right: 5px;
        width: 44px;
        height: 44px;
    }
}
