/* Old Catholic Institute LMS - Front-end Styles */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,600;1,400&family=Crimson+Pro:wght@400;600&family=Inter:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brown:    #7a3e1e;
  --brown-dk: #3b2008;
  --brown-lt: #c9a97a;
  --cream:    #fdfaf5;
  --gray:     #f4f1ec;
  --text:     #2c2c2c;
  --muted:    #7a7060;
  --green:    #2a7a2a;
  --red:      #b32020;
  --radius:   6px;
}

body { font-family: 'Inter', sans-serif; color: var(--text); background: #fff; line-height: 1.6; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.site-header { background: var(--brown-dk); color: #fff; padding: 0.85rem 0; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.site-brand { text-decoration: none; color: #fff; }
.site-name { font-family: 'EB Garamond', serif; font-size: 1.5rem; font-weight: 600; }
.site-tagline { display: block; font-size: 0.75rem; color: var(--brown-lt); letter-spacing: 0.08em; }
.site-nav { display: flex; align-items: center; gap: 1.25rem; }
.site-nav a { color: #e8ddd0; text-decoration: none; font-size: 0.9rem; }
.site-nav a:hover { color: #fff; }

/* Flash messages */
.flash { padding: 0.75rem 1.5rem; margin: 0.75rem auto; border-radius: var(--radius); font-size: 0.9rem; }
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Buttons */
.btn { display: inline-block; padding: 0.55rem 1.25rem; border-radius: var(--radius); font-weight: 500; font-size: 0.9rem; text-decoration: none; border: none; cursor: pointer; transition: background 0.15s, opacity 0.15s; }
.btn-primary  { background: var(--brown); color: #fff; }
.btn-primary:hover { background: #9a5028; }
.btn-secondary { background: transparent; color: var(--brown); border: 1.5px solid var(--brown); }
.btn-secondary:hover { background: var(--gray); }
.btn-success  { background: var(--green); color: #fff; }
.btn-sm       { padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.btn-lg       { padding: 0.8rem 2rem; font-size: 1.05rem; }
.btn-block    { display: block; width: 100%; text-align: center; }

/* Hero */
.hero { background: var(--cream); padding: 5rem 0; }
.hero .container { text-align: center; }
.hero h1 { font-family: 'EB Garamond', serif; font-size: clamp(2rem, 5vw, 3.5rem); color: var(--brown-dk); }
.hero-sub { font-size: 1.15rem; color: var(--muted); margin: 0.75rem 0 2rem; }

/* Sections */
.section { padding: 4rem 0; }
.section-alt { background: var(--gray); }
.section-title { font-family: 'EB Garamond', serif; font-size: 1.85rem; color: var(--brown-dk); margin-bottom: 2rem; }

/* Course grid */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.course-card { border: 1px solid #e0d8cc; border-radius: var(--radius); overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.course-card-img { width: 100%; height: 180px; object-fit: cover; display: block; }
.course-card-img-placeholder { display: block; width: 100%; height: 180px; background: linear-gradient(135deg, var(--brown) 0%, var(--brown-dk) 100%); }
.course-card-body { padding: 1.25rem; display: flex; flex-direction: column; flex: 1; }
.course-card-body h3 { font-family: 'EB Garamond', serif; font-size: 1.2rem; margin-bottom: 0.5rem; }
.course-card-body h3 a { color: var(--brown-dk); text-decoration: none; }
.course-card-body h3 a:hover { color: var(--brown); }
.course-card-desc { font-size: 0.88rem; color: var(--muted); flex: 1; margin-bottom: 0.75rem; }
.course-card-meta { font-size: 0.8rem; color: var(--muted); display: flex; gap: 1rem; margin-bottom: 1rem; }

/* Course detail */
.course-hero { display: flex; align-items: flex-start; gap: 3rem; padding: 3rem 1.5rem; }
.course-hero-content { flex: 1; }
.course-hero-content h1 { font-family: 'EB Garamond', serif; font-size: clamp(1.8rem, 4vw, 2.8rem); color: var(--brown-dk); margin-bottom: 1rem; }
.course-intro { font-size: 1.1rem; color: var(--muted); margin-bottom: 0.75rem; }
.course-instructor { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.5rem; }
.course-hero-img { flex: 0 0 320px; }
.course-hero-img img { width: 100%; border-radius: var(--radius); }
.course-body { padding-bottom: 4rem; }
.course-description { font-family: 'EB Garamond', serif; font-size: 1.1rem; line-height: 1.8; color: var(--text); margin-bottom: 3rem; }
.course-curriculum h2 { font-family: 'EB Garamond', serif; font-size: 1.6rem; color: var(--brown-dk); margin-bottom: 1.5rem; }
.curriculum-section { margin-bottom: 1.5rem; border: 1px solid #e0d8cc; border-radius: var(--radius); overflow: hidden; }
.curriculum-section-title { background: var(--gray); padding: 0.75rem 1.25rem; font-size: 1rem; font-weight: 600; color: var(--brown-dk); }
.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-item { padding: 0.65rem 1.25rem; border-top: 1px solid #eee; font-size: 0.9rem; display: flex; align-items: center; gap: 0.75rem; }
.lesson-item.completed::before { content: '✓'; color: var(--green); font-weight: 700; flex-shrink: 0; }
.lesson-item a { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; color: var(--brown-dk); text-decoration: none; }
.lesson-item a:hover { color: var(--brown); }
.lesson-item .lesson-locked { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; color: var(--muted); }
.lesson-locked { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; color: var(--muted); }
.lesson-type { font-size: 0.75rem; background: var(--gray); color: var(--muted); padding: 1px 6px; border-radius: 3px; white-space: nowrap; flex-shrink: 0; }
.lesson-type-assignment { background: #f0e6d3; color: #7a4f2a; }
.assignment-banner { display: flex; align-items: center; gap: 0.75rem; background: #fdf6ee; border: 1px solid #e8c99a; border-radius: 6px; padding: 0.85rem 1.1rem; margin-bottom: 1.5rem; font-size: 0.95rem; color: #6b3f1a; }
.assignment-icon { font-size: 1.4rem; flex-shrink: 0; }

/* Progress bar */
.progress-bar-wrap { background: #e0d8cc; border-radius: 99px; height: 8px; margin: 0.5rem 0; overflow: hidden; }
.progress-bar { background: var(--brown); height: 100%; border-radius: 99px; transition: width 0.4s; }
.progress-label { font-size: 0.82rem; color: var(--muted); }

/* Lesson layout */
.lesson-layout { display: flex; min-height: calc(100vh - 60px); }
.lesson-sidebar { width: 280px; flex-shrink: 0; background: var(--cream); border-right: 1px solid #e0d8cc; padding: 1.5rem 0; overflow-y: auto; max-height: calc(100vh - 60px); position: sticky; top: 0; }
.lesson-sidebar-header { padding: 0 1.25rem 1.25rem; border-bottom: 1px solid #e0d8cc; margin-bottom: 0.75rem; }
.lesson-sidebar-header a { color: var(--brown); font-size: 0.85rem; text-decoration: none; display: block; margin-bottom: 0.75rem; }
.sidebar-lesson-list { list-style: none; }
.sidebar-lesson-list li { font-size: 0.85rem; }
.sidebar-lesson-list li a { display: block; padding: 0.55rem 1.25rem; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.sidebar-lesson-list li.active a { background: #fff; border-left-color: var(--brown); color: var(--brown); font-weight: 600; }
.sidebar-lesson-list li.done a { color: var(--green); }
.sidebar-lesson-list li a:hover { background: #fff; }
/* Sectioned sidebar (nav element replaces ul) */
.sidebar-lesson-list.sidebar-lesson-list { display: block; }
.sidebar-section-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #9c8570; padding: 0.9rem 1.25rem 0.3rem; margin-top: 0.25rem; }
.sidebar-lesson-item { display: block; font-size: 0.85rem; padding: 0.55rem 1.25rem; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.sidebar-lesson-item.active { background: #fff; border-left-color: var(--brown); color: var(--brown); font-weight: 600; }
.sidebar-lesson-item.done { color: var(--green); }
.sidebar-lesson-item:hover { background: #fff; }
.sidebar-quiz-item { font-style: italic; }
.lesson-main { flex: 1; padding: 2.5rem 3rem; max-width: 800px; }
.lesson-title { font-family: 'EB Garamond', serif; font-size: 2rem; color: var(--brown-dk); margin-bottom: 1.5rem; }
.lesson-content { font-family: 'EB Garamond', serif; font-size: 1.1rem; line-height: 1.9; color: var(--text); }
.lesson-content p { margin-bottom: 1em; }
.lesson-content h2, .lesson-content h3 { color: var(--brown-dk); margin: 1.5em 0 0.5em; }
.lesson-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid #e0d8cc; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.lesson-nav { display: flex; gap: 0.75rem; }
.badge-complete { background: #d4edda; color: #155724; padding: 0.35rem 0.85rem; border-radius: 99px; font-size: 0.85rem; }
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); margin-bottom: 1.5rem; }
.video-wrapper iframe, .video-wrapper video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.file-download { margin-bottom: 1.5rem; }

/* Auth */
.auth-container { max-width: 440px; margin: 4rem auto; }
.auth-box { background: var(--cream); border: 1px solid #e0d8cc; border-radius: var(--radius); padding: 2rem 2.5rem; }
.auth-box h1 { font-family: 'EB Garamond', serif; font-size: 1.8rem; color: var(--brown-dk); margin-bottom: 1.5rem; }
.auth-box label { display: block; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 500; color: var(--text); }
.auth-box input, .auth-box select { display: block; width: 100%; margin-top: 4px; padding: 0.55rem 0.75rem; border: 1.5px solid #c9bfb0; border-radius: var(--radius); font-size: 0.95rem; font-family: inherit; }
.auth-box input:focus, .auth-box select:focus { outline: none; border-color: var(--brown); }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Quiz */
.quiz-container { max-width: 750px; padding: 3rem 1.5rem 4rem; }
.quiz-container h1 { font-family: 'EB Garamond', serif; font-size: 2rem; color: var(--brown-dk); margin-bottom: 0.5rem; }
.quiz-description { color: var(--muted); margin-bottom: 0.5rem; }
.quiz-meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 2rem; }
.quiz-question { background: var(--cream); border: 1px solid #e0d8cc; border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.question-text { margin-bottom: 1rem; }
.answer-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.answer-list label { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; padding: 0.5rem 0.75rem; border-radius: var(--radius); }
.answer-list label:hover { background: #fff; }
.back-link { display: inline-block; margin-bottom: 1.5rem; font-size: 0.9rem; color: var(--brown); text-decoration: none; }

/* Score display */
.score-display { display: inline-block; padding: 2rem 4rem; border-radius: var(--radius); margin: 1.5rem 0; }
.score-pass { background: #d4edda; }
.score-fail { background: #f8d7da; }
.score-number { font-family: 'EB Garamond', serif; font-size: 4rem; font-weight: 600; }
.score-label  { font-size: 1.1rem; font-weight: 600; margin-top: 0.25rem; }

/* Dashboard */
.dashboard { padding: 3rem 0 4rem; }
.dashboard h1 { font-family: 'EB Garamond', serif; font-size: 2rem; color: var(--brown-dk); }
.dashboard-courses { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.dashboard-course-card { display: flex; gap: 1.25rem; background: var(--cream); border: 1px solid #e0d8cc; border-radius: var(--radius); overflow: hidden; padding: 1rem; }
.dashboard-course-img { width: 120px; height: 80px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.dashboard-course-info { flex: 1; }
.dashboard-course-info h3 { font-family: 'EB Garamond', serif; font-size: 1.15rem; }
.dashboard-course-info h3 a { color: var(--brown-dk); text-decoration: none; }
.cert-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.cert-item { display: flex; justify-content: space-between; align-items: center; background: var(--cream); border: 1px solid #e0d8cc; border-radius: var(--radius); padding: 1rem 1.25rem; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 99px; font-size: 0.78rem; font-weight: 600; }
.badge-published { background: #d4edda; color: #155724; }
.badge-draft     { background: #fff3cd; color: #856404; }
.badge-active    { background: #d4edda; color: #155724; }
.badge-completed { background: #cce5ff; color: #004085; }
.badge-withdrawn { background: #f8d7da; color: #721c24; }

/* Footer */
.site-footer { background: var(--brown-dk); color: #c9a97a; text-align: center; padding: 2rem 1rem; font-size: 0.85rem; margin-top: auto; }
.footer-tagline { font-family: 'EB Garamond', serif; font-style: italic; margin-top: 0.25rem; }

@media (max-width: 768px) {
  .course-hero { flex-direction: column; }
  .course-hero-img { flex: none; width: 100%; }
  .lesson-layout { flex-direction: column; }
  .lesson-sidebar { width: 100%; max-height: none; position: static; }
  .lesson-main { padding: 1.5rem 1rem; }
}

/* Assignment submission area */
.assignment-submission-area { padding: 1.5rem 0; border-top: 1px solid #e0d8cc; margin-top: 1.5rem; }
.submission-section { margin-bottom: 1.75rem; }
.submission-section h4 { font-family: 'EB Garamond', serif; font-size: 1.1rem; color: var(--brown-dk); margin: 0 0 0.75rem; }
.submission-section textarea { width: 100%; box-sizing: border-box; padding: 0.6rem 0.8rem; border: 1.5px solid #c9bfb0; border-radius: var(--radius); font-family: inherit; font-size: 0.95rem; resize: vertical; }
.submission-section textarea:focus { outline: none; border-color: var(--brown); }
.word-count-display { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
.word-count-display.over-limit { color: #c00; font-weight: 600; }
.submission-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.file-upload-list { list-style: none; padding: 0; margin: 0.75rem 0 0; display: flex; flex-direction: column; gap: 0.5rem; }
.file-upload-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; flex-wrap: wrap; }
.file-name { font-weight: 500; }
.file-size { color: var(--muted); font-size: 0.8rem; }
.upload-progress-bar-wrap { flex: 0 0 140px; background: #e0d8cc; border-radius: 99px; height: 6px; overflow: hidden; }
.upload-progress-bar { height: 100%; background: var(--brown); border-radius: 99px; transition: width 0.2s; }
.upload-status { font-size: 0.78rem; color: var(--muted); }
.submission-status-banner { padding: 0.85rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 0.95rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.banner-submitted { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.banner-graded    { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.grade-display { font-family: 'EB Garamond', serif; font-size: 1.4rem; font-weight: 700; }
.badge-pass { background: #d4edda; color: #155724; padding: 0.2rem 0.6rem; border-radius: 99px; font-size: 0.78rem; font-weight: 600; }
.badge-fail { background: #f8d7da; color: #721c24; padding: 0.2rem 0.6rem; border-radius: 99px; font-size: 0.78rem; font-weight: 600; }
.submission-feedback { background: var(--cream); border: 1px solid #e0d8cc; border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.submission-feedback h4 { font-family: 'EB Garamond', serif; font-size: 1rem; color: var(--brown-dk); margin: 0 0 0.5rem; }
.submitted-text-readonly { white-space: pre-wrap; font-size: 0.92rem; line-height: 1.7; background: var(--cream); border: 1px solid #e0d8cc; border-radius: var(--radius); padding: 0.85rem 1rem; max-height: 360px; overflow-y: auto; }

/* ===== Student Grades Page ===== */
.grades-course-block { background: #fff; border: 1px solid #e0d8cc; border-radius: 8px; margin-bottom: 2rem; overflow: hidden; }
.grades-course-header { background: #faf6f0; padding: 1rem 1.5rem; border-bottom: 1px solid #e0d8cc; display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; }
.grades-course-title { font-family: 'EB Garamond', serif; font-size: 1.25rem; color: var(--brown-dk); margin: 0 0 4px; }
.grades-course-title a { color: inherit; text-decoration: none; }
.grades-course-title a:hover { text-decoration: underline; }
.grades-meta { font-size: 0.8rem; color: var(--muted); }
.grades-progress-col { text-align: right; min-width: 140px; }
.grades-progress-label { font-size: 0.88rem; font-weight: 600; color: var(--brown-dk); margin-bottom: 4px; }
.grades-progress-track { background: #e0d8cc; border-radius: 99px; height: 8px; width: 140px; margin-left: auto; }
.grades-progress-fill { background: var(--brown); height: 8px; border-radius: 99px; }
.grades-progress-sub { font-size: 0.75rem; color: var(--muted); margin-top: 3px; }
.grades-items { padding: 0 1.5rem 1rem; }
.grades-section-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding: 1rem 0 0.4rem; border-bottom: 1px solid #f0ebe3; margin-bottom: 0; }
.grades-item-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid #f6f2ec; flex-wrap: wrap; }
.grades-item-row:last-child { border-bottom: none; }
.grades-item-name { flex: 1; min-width: 160px; font-size: 0.92rem; font-weight: 500; }
.grades-item-name a { color: var(--brown); text-decoration: none; }
.grades-item-name a:hover { text-decoration: underline; }
.grades-item-meta { font-size: 0.78rem; color: var(--muted); min-width: 80px; }
.grades-item-grade { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.grades-score { font-family: 'EB Garamond', serif; font-size: 1.2rem; font-weight: 700; }
.grades-pass { color: #1a6b3a; }
.grades-fail { color: #a02020; }
.grades-none { color: var(--muted); font-size: 0.88rem; }
.grades-pending { color: #a06020; font-size: 0.88rem; }
.grades-badge { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 99px; }
.grades-badge-pass { background: #d4edda; color: #155724; }
.grades-badge-fail { background: #f8d7da; color: #721c24; }
.grades-attempts { font-size: 0.75rem; color: var(--muted); width: 100%; padding-left: 0; }
.grades-feedback { margin-top: 0.4rem; width: 100%; font-size: 0.85rem; }
.grades-feedback summary { color: var(--brown); cursor: pointer; }
.grades-feedback p { margin: 0.4rem 0 0; padding-left: 0.5rem; color: var(--text); line-height: 1.6; }
