/* -----------------------------------
   RESET & THEME
----------------------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: "Poppins", sans-serif; background: #f7f7f9; color: #222; line-height: 1.6; }

/* VARIABLES */
:root{
  --primary: #4c7cf6;
  --primary-dark: #335fd1;
  --bg: #f7f7f9;
  --card: #fff;
  --muted: #6b7280;
  --radius: 12px;
  --shadow-sm: 0 4px 18px rgba(0,0,0,0.06);
}

/* -----------------------------------
   LAYOUT BASICS
----------------------------------- */
.container { width: 92%; max-width: 1100px; margin: auto; }
.section { margin: 2rem 0; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); }

/* -----------------------------------
   HEADER / NAV
----------------------------------- */
.header { background: var(--card); border-bottom: 1px solid #eee; padding: 0.75rem 0; }
.header-inner { display:flex; align-items:center; justify-content:space-between; }
.logo img { height: 36px; margin-right: 0.5rem; }
.logo { display:flex; align-items:center; font-weight:600; font-size:1.1rem; color:var(--text); text-decoration:none; }
.nav .nav-link { margin-left: 1rem; text-decoration:none; color:#555; font-weight:500; }
.nav .nav-link:hover, .nav .nav-link.active { color:#000; }

/* -----------------------------------
   CARD
----------------------------------- */
.card { background: var(--card); border-radius: var(--radius); padding:1.4rem; box-shadow: var(--shadow-sm); }

/* -----------------------------------
   BUTTONS
----------------------------------- */
.btn { display:inline-block; background:var(--primary); color:#fff; padding:0.7rem 1.2rem; border-radius:10px; border:none; cursor:pointer; font-weight:600; }
.btn:hover { background:var(--primary-dark); transform: translateY(-2px); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.muted { color: var(--muted); font-size:0.95rem; }

/* -----------------------------------
   HERO
----------------------------------- */
.hero { margin-top: 2.5rem; }
.hero-inner { display:flex; align-items:center; justify-content:center; padding:2.5rem; }
.hero-inner h1 { font-size:2rem; margin-bottom:0.4rem; }
.hero-actions { display:flex; gap:0.8rem; margin-top:1rem; }

/* -----------------------------------
   UPLOAD AREA
----------------------------------- */
.center { display:flex; justify-content:center; align-items:center; }
.center-wrapper { display:flex; justify-content:center; padding:40px 0; }
.upload-container { width:850px; max-width:95%; display:flex; flex-direction:column; gap:32px; }

.upload-area {
  border: 2px dashed rgba(0,0,0,0.08);
  padding: 28px; border-radius: 12px; background: #fff;
  text-align:center; transition: all .15s ease;
}
.upload-area:focus { outline:none; box-shadow: 0 6px 24px rgba(52,84,255,0.08); border-color:var(--primary); }
.upload-area.drag-over { border-color:var(--primary); box-shadow: 0 10px 32px rgba(52,84,255,0.08); }

.textarea { width:100%; min-height:140px; padding:1rem; border-radius:10px; border:1px solid #e6e6e6; }

/* -----------------------------------
   RESULTS
----------------------------------- */
.result-box h2 { margin-bottom:0.6rem; }
.key-points li { margin:0.45rem 0; }

/* =========================
   FLASHCARDS GRID
========================= */
.flashcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  perspective: 1200px;
}

/* =========================
   FLASHCARD (3D FLIP)
========================= */
.flashcard {
  height: 140px;
  cursor: pointer;
  perspective: 1000px;
}

.flashcard:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
}

/* inner wrapper */
.flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: var(--radius);
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}

/* flip */
.flashcard.is-flipped .flashcard-inner {
  transform: rotateY(180deg);
}

/* faces */
.flashcard-front,
.flashcard-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: var(--radius);
  backface-visibility: hidden;
  text-align: center;
  font-weight: 600;
}

/* front */
.flashcard-front {
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-dark)
  );
  color: #fff;
}

/* back */
.flashcard-back {
  background: #111827;
  color: #f9fafb;
  transform: rotateY(180deg);
}

/* hover lift */
.flashcard:hover .flashcard-inner {
  transform: translateY(-6px) rotateY(0deg);
}

.flashcard.is-flipped:hover .flashcard-inner {
  transform: translateY(-6px) rotateY(180deg);
}

/* MCQ */
.mcq label { display:block; padding:0.45rem; border-radius:8px; margin:0.35rem 0; cursor:pointer; }

/* -----------------------------------
   DASHBOARD
----------------------------------- */
.wrapper { display:flex; min-height:100vh; }
.sidebar { background:#0f1724; color:#fff; width:240px; padding:2rem 1rem; }
.sidebar-logo { width:55px; margin-bottom:1rem; }
.logo-area h2 { font-size:1.3rem; margin-bottom:1.2rem; }
.logo-area span { color:#9ca3af; }

.nav-links a { display:block; padding:0.75rem 0.9rem; color:#d1d5db; text-decoration:none; border-radius:8px; margin-bottom:0.4rem; }
.nav-links a:hover, .nav-links a.active { background:#111827; color:#fff; }

.main-content { flex:1; padding:2rem; }
.top-bar { display:flex; align-items:center; justify-content:space-between; }
.user img { width:36px; border-radius:50%; }

/* Stats & recent */
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:1rem; margin:1.5rem 0; }
.stat-card { padding:1.25rem; text-align:center; border-radius:10px; box-shadow: var(--shadow-sm); background:var(--card); }
.recent-list .recent-item { display:flex; justify-content:space-between; align-items:center; padding:1rem; border-radius:10px; background:var(--card); box-shadow:var(--shadow-sm); margin-bottom:0.75rem; }
.view-btn { background:var(--primary); color:#fff; padding:0.5rem 0.85rem; border-radius:8px; border:none; cursor:pointer; }

.center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.center-wrapper {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.mcq label {
  display: block;
  padding: 10px;
  margin: 6px 0;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.recent-actions {
  display: flex;
  gap: 8px;
}

.delete-btn {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.delete-btn:hover {
  background: #dc2626;
}

/* Modal */
.summary-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.summary-modal-content {
  background: #fff;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 12px;
}


.mcq-option {
  padding: 10px;
  margin: 6px 0;
  background: #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
}
/* -----------------------------------
   LOADER & TOAST
----------------------------------- */
.us-loader-wrap { position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,0.6); z-index:9998; }
.us-loader-box { text-align:center; }
.us-loader-box .spinner { width:48px; height:48px; border-radius:50%; border:4px solid rgba(0,0,0,0.08); border-top-color:var(--primary); animation: spin 1s linear infinite; margin:0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.us-toast { position:fixed; right:20px; bottom:20px; background:#111; color:#fff; padding:10px 14px; border-radius:8px; box-shadow: var(--shadow-sm); z-index:9999; }
.us-toast.us-toast-error { background:#f87171; }

/* =========================
   RESULT PAGE LAYOUT
========================= */

.result-page {
  min-height: calc(100vh - 120px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 16px;
}

.result-card {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* headings */
.result-card h2 {
  margin-bottom: 12px;
}

.result-card h3 {
  margin-top: 32px;
  margin-bottom: 12px;
}

/* summary */
#summary-output {
  line-height: 1.7;
  color: #333;
}

/* key points */
#key-points {
  padding-left: 20px;
}

#key-points li {
  margin-bottom: 8px;
}




/* MCQs */
.mcq {
  padding: 16px;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  margin-bottom: 16px;
}

.mcq label {
  display: block;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 6px;
  background: #f7f7f7;
}

/* -----------------------------------
   RESPONSIVE
----------------------------------- */
@media (max-width:900px){
  .upload-container { width:95%; gap:20px; }
  .grid-3 { grid-template-columns: 1fr; }
  .hero-inner { padding:1.2rem; }
  .sidebar { position:fixed; left:-260px; top:0; bottom:0; transition: left .25s; }
  .sidebar.active { left:0; }
}
