/* ==========================================================================
   ELITE LESSON LIBRARY CSS
   Glassmorphism, Spaced Repetition, 3D Flashcards
   ========================================================================== */

/* Layout & Globals */
.lessons-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; display: flex; flex-direction: column; gap: 24px; }
.hidden { display: none !important; }
.text-purple { color: #c084fc; } .text-red { color: #ef5350; } .text-green { color: #22c55e; } .text-gold { color: #fbbf24; }
.w-full { width: 100%; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(192,132,252,0.4); } 70% { box-shadow: 0 0 0 10px rgba(192,132,252,0); } 100% { box-shadow: 0 0 0 0 rgba(192,132,252,0); } }
.fade-in { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse { animation: pulseGlow 2s infinite; border-radius: 50%; }

/* Buttons & Inputs */
.lessons-btn { padding: 10px 20px; border-radius: 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s; border: none; text-transform: uppercase; }
.lessons-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.lessons-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.lessons-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.lessons-btn--secondary:hover { background: rgba(255,255,255,0.1); }

.lessons-input, .lessons-select { width: 100%; padding: 12px 16px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; transition: 0.3s; font-family: inherit; }
.lessons-input:focus, .lessons-select:focus { outline: none; border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Header & SRS Bar */
.lessons-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.lessons-header__title { font-size: 2.5rem; font-weight: 800; margin: 0 0 8px 0; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.lessons-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.lessons-header__stats { display: flex; gap: 24px; }
.lessons-stat-card { text-align: center; }
.lessons-stat-val { display: block; font-size: 1.5rem; font-weight: 700; }
.lessons-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

.lessons-srs-bar { background: linear-gradient(90deg, rgba(168,85,247,0.1), rgba(6,182,212,0.1)); border: 1px solid rgba(192,132,252,0.3); padding: 16px 24px; border-radius: 16px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 0 20px rgba(168,85,247,0.1); }
.lessons-srs-bar__info { display: flex; align-items: center; gap: 16px; font-weight: 600; font-size: 1.1rem; }

/* Filters & Search */
.lessons-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.03); padding: 12px 20px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); }
.lessons-search { position: relative; flex-grow: 1; max-width: 400px; }
.lessons-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.4); }
.lessons-search input { padding-left: 36px; }
.lessons-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lessons-pill { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.6); padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; cursor: pointer; transition: 0.3s; }
.lessons-pill:hover { background: rgba(255,255,255,0.05); color: white; }
.lessons-pill.active { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }
.lessons-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.1); margin: 0 4px; }

/* Main Grid & Cards */
.lessons-section-title { font-size: 1.5rem; margin: 0 0 16px 0; display: flex; align-items: center; gap: 12px; }
.lessons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }

.lessons-card {
  background: rgba(255,255,255,0.03); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 16px; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); cursor: pointer; position: relative; overflow: hidden;
}
.lessons-card:hover { transform: translateY(-4px); background: rgba(255,255,255,0.06); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }

/* Card Variants */
.lessons-card--critical { border-left: 4px solid #ef5350; background: linear-gradient(90deg, rgba(239,83,80,0.05), transparent); }
.lessons-card--pinned { border: 1px solid rgba(192,132,252,0.4); box-shadow: 0 0 20px rgba(192,132,252,0.1); }
.lessons-card--mastered { background: rgba(34,197,94,0.05); border: 1px solid rgba(34,197,94,0.2); }

.lessons-card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lessons-card__title { font-size: 1.15rem; font-weight: 700; margin: 0; line-height: 1.3; }
.lessons-card__chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.lesson-chip { font-size: 0.65rem; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,0.1); text-transform: uppercase; letter-spacing: 0.5px; }

.lessons-card__body { display: flex; flex-direction: column; gap: 12px; flex-grow: 1; }
.text-truncate { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.85rem; color: rgba(255,255,255,0.6); }
.lesson-rule-quote { font-weight: 600; color: #c084fc; border-left: 2px solid #c084fc; padding-left: 10px; font-size: 0.95rem; font-style: italic; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.lessons-card__footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 12px; font-size: 0.75rem; color: rgba(255,255,255,0.5); }
.mastery-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.mastery-new { background: rgba(255,255,255,0.1); color: white; }
.mastery-learning { background: rgba(251,191,36,0.2); color: #fbbf24; }
.mastery-reviewing { background: rgba(6,182,212,0.2); color: #06b6d4; }
.mastery-mastered { background: rgba(34,197,94,0.2); color: #22c55e; }

/* Modals */
.lessons-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.lessons-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.lessons-modal__content { position: relative; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: fadeInUp 0.3s ease-out forwards; }
.lessons-modal__close { position: absolute; top: 24px; right: 24px; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.5rem; cursor: pointer; transition: color 0.3s; }
.lessons-modal__close:hover { color: white; }

.lessons-form__header h2 { color: #c084fc; margin-top: 0; }
.rule-input { border-color: rgba(192,132,252,0.5); font-weight: 600; }

/* Detail View */
.detail-hero { margin-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.detail-title { font-size: 2rem; font-weight: 800; margin: 0 0 12px 0; }
.detail-section { margin-bottom: 24px; }
.detail-section h4 { font-size: 0.8rem; text-transform: uppercase; color: rgba(255,255,255,0.5); margin: 0 0 8px 0; letter-spacing: 1px; }
.detail-story { font-style: italic; color: rgba(255,255,255,0.8); line-height: 1.6; }
.detail-principle { font-size: 1.1rem; font-weight: 600; line-height: 1.5; }
.detail-rule { font-size: 1.5rem; font-weight: 800; color: #c084fc; border-left: 4px solid #c084fc; padding-left: 16px; margin: 16px 0; font-style: italic; }

/* 3D FLASHCARD MODE */
.lessons-flashcard-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #020005; z-index: 2000; display: flex; flex-direction: column; }
.fc-header { padding: 24px 32px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); }
.fc-progress { width: 300px; }
.fc-progress-text { font-size: 0.85rem; color: rgba(255,255,255,0.6); display: block; margin-bottom: 8px; }
.fc-progress-bar { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.fc-progress-fill { height: 100%; background: #c084fc; transition: width 0.3s; }

.fc-stage { flex-grow: 1; display: flex; align-items: center; justify-content: center; perspective: 1500px; padding: 40px; }

/* Flip Engine */
.lessons-flip-card { background: transparent; width: 100%; max-width: 700px; height: 500px; cursor: pointer; }
.lessons-flip-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); transform-style: preserve-3d; border-radius: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.lessons-flip-card.is-flipped .lessons-flip-inner { transform: rotateX(180deg); }

.lessons-flip-front, .lessons-flip-back { position: absolute; width: 100%; height: 100%; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 24px; border: 1px solid rgba(192,132,252,0.3); background: rgba(20,15,25,0.95); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; box-sizing: border-box; }
.lessons-flip-front { z-index: 2; }
.lessons-flip-back { transform: rotateX(180deg); align-items: flex-start; justify-content: flex-start; text-align: left; }

.fc-category-chip { background: rgba(255,255,255,0.1); padding: 4px 12px; border-radius: 12px; text-transform: uppercase; font-size: 0.8rem; margin-bottom: 24px; letter-spacing: 1px; }
.fc-title { font-size: 2.5rem; font-weight: 800; margin: 0 0 40px 0; line-height: 1.2; text-shadow: 0 4px 20px rgba(0,0,0,0.5); }
.fc-prompt { color: rgba(255,255,255,0.8); font-size: 1.2rem; }
.fc-hint { margin-top: 16px; font-size: 0.85rem; color: rgba(255,255,255,0.4); text-transform: uppercase; }

.fc-scroll-area { width: 100%; height: 100%; overflow-y: auto; padding-right: 16px; }
.fc-scroll-area::-webkit-scrollbar { width: 6px; }
.fc-scroll-area::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.3); border-radius: 10px; }
.fc-back-title { font-size: 1.5rem; color: rgba(255,255,255,0.5); margin-bottom: 24px; }
.fc-section { margin-bottom: 24px; width: 100%; }
.fc-section h4 { color: #c084fc; font-size: 0.85rem; letter-spacing: 1px; margin: 0 0 8px 0; }
.fc-principle-text { font-size: 1.2rem; font-weight: 600; line-height: 1.5; }
.fc-rule-text { font-size: 1.8rem; font-weight: 800; color: #22c55e; border-left: 4px solid #22c55e; padding-left: 16px; font-style: italic; }

/* SRS Controls */
.fc-controls { padding: 32px; border-top: 1px solid rgba(255,255,255,0.05); background: rgba(0,0,0,0.5); }
.fc-rating-buttons { display: flex; justify-content: center; gap: 16px; max-width: 800px; margin: 0 auto; }
.fc-btn { flex: 1; padding: 16px; border-radius: 12px; font-weight: 700; font-size: 1rem; cursor: pointer; border: none; transition: transform 0.2s; color: white; }
.fc-btn:hover { transform: translateY(-4px); }
.fc-btn-1 { background: #ef5350; }
.fc-btn-2 { background: #f97316; }
.fc-btn-3 { background: #fbbf24; color: #000; }
.fc-btn-4 { background: #84cc16; color: #000; }
.fc-btn-5 { background: #22c55e; color: #000; }

/* Custom Checkbox */
.lessons-checkbox { width: 18px; height: 18px; accent-color: #c084fc; }