/* =====================================================
   SMPT LMS — Custom Stylesheet
   Siyabonga Multi-Purpose & Telecentre
   ===================================================== */

/* ─── Variables ─────────────────────────────────────── */
:root {
    --lms-primary:   #1a3c8f;
    --lms-secondary: #e63946;
    --lms-accent:    #f4a261;
    --lms-dark:      #0d1b3e;
    --lms-light:     #f8f9fe;
    --lms-success:   #2a9d8f;
    --lms-warning:   #e9c46a;
    --lms-text:      #2d3748;
    --lms-muted:     #718096;
    --lms-border:    #e2e8f0;
    --lms-radius:    12px;
    --lms-shadow:    0 4px 20px rgba(26,60,143,.10);
    --lms-shadow-lg: 0 8px 40px rgba(26,60,143,.16);
    --transition:    all .25s ease;
}

/* ─── Base ───────────────────────────────────────────── */
* { box-sizing: border-box; }
body.lms-body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--lms-text);
    background: var(--lms-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main.lms-main { flex: 1; }

/* ─── Navbar ─────────────────────────────────────────── */
.lms-navbar {
    background: linear-gradient(135deg, var(--lms-dark) 0%, var(--lms-primary) 100%);
    padding: .7rem 0;
}
.brand-icon {
    background: rgba(255,255,255,.15);
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.brand-icon-sm {
    background: rgba(255,255,255,.15);
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 1.1rem; font-weight: 700; color: #fff; line-height: 1.1; }
.brand-sub  { font-size: .62rem; color: rgba(255,255,255,.65); line-height: 1; }
.navbar-nav .nav-link { color: rgba(255,255,255,.85) !important; font-size:.9rem; transition: var(--transition); padding: .4rem .75rem; border-radius: 6px; }
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active { color: #fff !important; background: rgba(255,255,255,.12); }
.nav-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--lms-accent); color: #fff;
    font-size: .8rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* ─── Hero Section ───────────────────────────────────── */
.lms-hero {
    background: linear-gradient(135deg, var(--lms-dark) 0%, var(--lms-primary) 60%, #2563eb 100%);
    color: #fff; position: relative; overflow: hidden;
    padding: 5rem 0 4rem;
}
.lms-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.lms-hero .badge-pill {
    background: rgba(255,255,255,.15); border-radius: 20px;
    padding: .35rem .9rem; font-size: .8rem; display: inline-block; margin-bottom: 1rem;
}
.hero-stats-card {
    background: rgba(255,255,255,.1); backdrop-filter: blur(10px);
    border-radius: var(--lms-radius); padding: 1.2rem; text-align: center;
    border: 1px solid rgba(255,255,255,.15);
}
.hero-stats-card .stat-num { font-size: 2rem; font-weight: 800; color: var(--lms-accent); }
.hero-stats-card .stat-label { font-size: .75rem; opacity: .8; }

/* ─── Cards ──────────────────────────────────────────── */
.lms-card {
    background: #fff; border-radius: var(--lms-radius);
    box-shadow: var(--lms-shadow); border: 1px solid var(--lms-border);
    transition: var(--transition);
}
.lms-card:hover { transform: translateY(-3px); box-shadow: var(--lms-shadow-lg); }

.course-card { overflow: hidden; }
.course-card .course-banner {
    height: 150px;
    background: linear-gradient(135deg, var(--lms-primary), #2563eb);
    display: flex; align-items: center; justify-content: center;
    font-size: 3.5rem; color: rgba(255,255,255,.5);
    position: relative;
}
.course-card .course-banner .course-level-badge {
    position: absolute; top: 12px; right: 12px;
    background: var(--lms-accent); color: #fff;
    font-size: .7rem; font-weight: 700;
    padding: .25rem .6rem; border-radius: 20px;
}
.course-card .card-body { padding: 1.25rem; }
.course-card .course-meta { font-size: .78rem; color: var(--lms-muted); }
.course-card .course-meta span { display: inline-flex; align-items: center; gap: .25rem; }

.progress-bar-lms { height: 6px; border-radius: 3px; background: #e2e8f0; overflow: hidden; }
.progress-bar-lms .fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--lms-success), #52b788); transition: width .5s ease; }

/* ─── Stat Cards ─────────────────────────────────────── */
.stat-card {
    border-radius: var(--lms-radius); padding: 1.5rem;
    border: none; position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; right: -10px; top: -10px;
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(255,255,255,.12);
}
.stat-card .stat-icon { font-size: 2rem; opacity: .85; }
.stat-card .stat-num { font-size: 2.2rem; font-weight: 800; line-height: 1.1; }
.stat-card .stat-lbl { font-size: .8rem; opacity: .8; margin-top: .2rem; }

/* ─── Module Content Viewer ──────────────────────────── */
.module-content-frame {
    width: 100%; border: none; border-radius: 0;
    box-shadow: none; min-height: 80vh;
    display: block;
}
.module-sidebar .nav-link {
    color: var(--lms-text); border-radius: 8px;
    padding: .6rem 1rem; font-size: .9rem;
    transition: var(--transition);
}
.module-sidebar .nav-link:hover { background: var(--lms-light); }
.module-sidebar .nav-link.active { background: var(--lms-primary); color: #fff !important; }

/* Module tab bar — scrollable on small screens */
.module-tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap !important; }
.module-tab-bar .btn { white-space: nowrap; flex-shrink: 0; }

/* ─── Assessment ─────────────────────────────────────── */
.question-card {
    background: #fff; border-radius: var(--lms-radius);
    box-shadow: var(--lms-shadow); border: 1px solid var(--lms-border);
    padding: 1.5rem; margin-bottom: 1.2rem;
}
.question-card .q-number {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--lms-primary); color: #fff;
    font-size: .85rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.question-card .form-check { padding: .5rem .75rem; border-radius: 8px; margin-bottom: .4rem; cursor: pointer; }
.question-card .form-check:hover { background: var(--lms-light); }
.question-card .form-check-input:checked + .form-check-label { font-weight: 600; color: var(--lms-primary); }

.timer-badge {
    background: #fff; border: 2px solid var(--lms-primary);
    border-radius: 8px; padding: .5rem 1rem;
    font-size: 1.1rem; font-weight: 700; color: var(--lms-primary);
    font-variant-numeric: tabular-nums;
}
.timer-badge.warning { border-color: var(--lms-secondary); color: var(--lms-secondary); }

/* ─── Certificate ────────────────────────────────────── */
.certificate-wrapper {
    background: #fff; border: 8px solid var(--lms-primary);
    border-radius: 16px; padding: 3rem;
    box-shadow: var(--lms-shadow-lg);
    max-width: 780px; margin: 0 auto;
    position: relative; overflow: hidden;
}
.certificate-wrapper::before, .certificate-wrapper::after {
    content: ''; position: absolute;
    width: 200px; height: 200px; border-radius: 50%;
    background: rgba(26,60,143,.05);
}
.certificate-wrapper::before { top: -50px; left: -50px; }
.certificate-wrapper::after  { bottom: -50px; right: -50px; }
.cert-logo { font-size: 3.5rem; color: var(--lms-primary); }
.cert-title { font-size: 2.5rem; font-weight: 800; color: var(--lms-primary); }
.cert-name  { font-size: 2rem; font-weight: 700; color: var(--lms-secondary); border-bottom: 3px solid var(--lms-secondary); display: inline-block; padding: 0 1rem .3rem; }
.cert-number { font-size: .75rem; color: var(--lms-muted); font-family: monospace; }
.cert-seal { width: 80px; height: 80px; border-radius: 50%; background: var(--lms-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; margin: 0 auto; }

/* ─── Admin Sidebar ──────────────────────────────────── */
.admin-sidebar {
    background: linear-gradient(180deg, var(--lms-dark), var(--lms-primary));
    min-height: 100vh; width: 260px; flex-shrink: 0;
}
.admin-sidebar .sidebar-header { padding: 1.5rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.admin-sidebar .nav-link {
    color: rgba(255,255,255,.75) !important;
    padding: .65rem 1.5rem; font-size: .9rem;
    border-radius: 0; transition: var(--transition);
    display: flex; align-items: center; gap: .75rem;
}
.admin-sidebar .nav-link:hover { background: rgba(255,255,255,.1); color: #fff !important; }
.admin-sidebar .nav-link.active { background: rgba(255,255,255,.15); color: #fff !important; border-left: 3px solid var(--lms-accent); }
.admin-sidebar .nav-group-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); padding: 1rem 1.5rem .25rem; }

.admin-content { flex: 1; overflow: hidden; }
.admin-topbar { background: #fff; border-bottom: 1px solid var(--lms-border); padding: 1rem 1.5rem; }

/* ─── Tables ─────────────────────────────────────────── */
.lms-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.lms-table thead th {
    background: var(--lms-light); color: var(--lms-muted);
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; padding: .75rem 1rem; border-bottom: 2px solid var(--lms-border);
}
.lms-table tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--lms-border); vertical-align: middle; font-size: .9rem; }
.lms-table tbody tr:hover { background: #f7faff; }
.lms-table tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ─────────────────────────────────────────── */
.badge-role { font-size: .7rem; padding: .25rem .6rem; border-radius: 20px; font-weight: 600; }
.badge-admin { background: #fef3c7; color: #d97706; }
.badge-student { background: #dbeafe; color: #2563eb; }
.badge-facilitator { background: #d1fae5; color: #059669; }
.badge-active { background: #d1fae5; color: #059669; }
.badge-completed { background: #dbeafe; color: #2563eb; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }

/* ─── Buttons ────────────────────────────────────────── */
.btn-lms-primary { background: var(--lms-primary); color: #fff; border: none; border-radius: 8px; padding: .55rem 1.4rem; font-weight: 600; transition: var(--transition); }
.btn-lms-primary:hover { background: var(--lms-dark); color: #fff; transform: translateY(-1px); }
.btn-lms-secondary { background: var(--lms-secondary); color: #fff; border: none; border-radius: 8px; padding: .55rem 1.4rem; font-weight: 600; transition: var(--transition); }
.btn-lms-secondary:hover { background: #c62a35; color: #fff; }

/* ─── Forms ──────────────────────────────────────────── */
.lms-form-card {
    background: #fff; border-radius: var(--lms-radius);
    box-shadow: var(--lms-shadow); padding: 2.5rem;
    border: 1px solid var(--lms-border); max-width: 500px; margin: 0 auto;
}
.form-label { font-size: .85rem; font-weight: 600; color: var(--lms-text); margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: 8px; border-color: var(--lms-border);
    padding: .6rem 1rem; font-size: .9rem; transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--lms-primary); box-shadow: 0 0 0 3px rgba(26,60,143,.12);
}

/* ─── Section Headings ───────────────────────────────── */
.section-heading { position: relative; display: inline-block; }
.section-heading::after { content: ''; display: block; width: 50px; height: 3px; background: var(--lms-secondary); border-radius: 3px; margin-top: .35rem; }

/* ─── Footer ─────────────────────────────────────────── */
.lms-footer { background: #0d1b3e; color: rgba(255,255,255,.7); }
.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: .5rem; font-size: .85rem; }
.footer-links a { color: rgba(255,255,255,.55); text-decoration: none; transition: var(--transition); }
.footer-links a:hover { color: #fff; }

/* ─── Breadcrumb ─────────────────────────────────────── */
.lms-breadcrumb { background: none; padding: 0; font-size: .85rem; }
.lms-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: var(--lms-muted); }
.lms-breadcrumb .breadcrumb-item a { color: var(--lms-primary); text-decoration: none; }
.lms-breadcrumb .breadcrumb-item.active { color: var(--lms-muted); }

/* ─── Page Header ────────────────────────────────────── */
.page-header { background: linear-gradient(135deg, var(--lms-dark), var(--lms-primary)); color: #fff; padding: 2.5rem 0; margin-bottom: 2rem; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; margin: 0; }

/* ─── Utilities ──────────────────────────────────────── */
.text-primary-lms { color: var(--lms-primary) !important; }
.bg-primary-lms   { background: var(--lms-primary) !important; }
.border-primary-lms { border-color: var(--lms-primary) !important; }
.rounded-lms      { border-radius: var(--lms-radius); }

/* ─── Responsive ─────────────────────────────────────── */

/* Tablets & below (< 992px) */
@media (max-width: 991.98px) {
    .lms-hero { padding: 3.5rem 0 2.5rem; }
    .page-header { padding: 1.8rem 0; }
    .admin-sidebar { display: none; }
}

/* Mobile landscape & tablets (< 768px) */
@media (max-width: 991.98px) {
    .admin-sidebar { position: fixed; z-index: 1055; top: 0; left: 0; height: 100vh; transform: translateX(-100%); transition: transform .25s ease; display: flex !important; flex-direction: column; }
    .admin-sidebar.show { transform: translateX(0); }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1054; }
    .sidebar-backdrop.show { display: block; }
}

/* Digital course authoring */
.authoring-ribbon { display:flex; gap:.35rem; align-items:stretch; padding:.65rem; overflow-x:auto; background:#f8fafc; border-bottom:1px solid var(--lms-border); position:sticky; top:0; z-index:5; }
.ribbon-group { display:flex; align-items:center; gap:.2rem; padding-right:.6rem; margin-right:.25rem; border-right:1px solid var(--lms-border); }
.ribbon-label { font-size:.62rem; text-transform:uppercase; letter-spacing:.06em; color:var(--lms-muted); margin-right:.25rem; }
.ribbon-group button { border:0; background:transparent; min-width:34px; min-height:34px; border-radius:6px; color:var(--lms-text); }
.ribbon-group button:hover { background:#e7eef8; color:var(--lms-primary); }
.lesson-workspace { background:#e8edf3; padding:2rem; max-height:68vh; overflow:auto; }
.lesson-paper { background:#fff; max-width:850px; min-height:620px; margin:auto; padding:3rem 3.5rem; box-shadow:0 3px 18px rgba(15,23,42,.12); outline:none; line-height:1.75; }
.lesson-paper:empty:before { content:attr(data-placeholder); color:#94a3b8; }
.lesson-paper h2,.lesson-content h2 { color:var(--lms-primary); margin-top:1.8rem; }
.lesson-callout { border-left:4px solid var(--lms-primary); background:#eef5ff; padding:1rem 1.2rem; border-radius:0 8px 8px 0; margin:1.25rem 0; }
.lesson-callout p { margin:.3rem 0 0; }
.digital-lesson { max-width:900px; margin:2rem auto 4rem; background:#fff; border:1px solid var(--lms-border); border-radius:14px; box-shadow:var(--lms-shadow); overflow:hidden; }
.lesson-header { padding:2.5rem 3rem; background:linear-gradient(180deg,#f7faff,#fff); border-bottom:1px solid var(--lms-border); }
.lesson-header h1 { font-size:2rem; font-weight:800; color:var(--lms-dark); }
.lesson-header p { color:var(--lms-muted); font-size:1.05rem; }
.lesson-content { padding:2.5rem 3rem; line-height:1.8; font-size:1.02rem; }

@media (max-width: 767.98px) {
    /* Hero */
    .lms-hero { padding: 3rem 0 2rem; }
    .lms-hero h1 { font-size: 1.9rem; }
    .hero-stats-card { padding: .9rem .7rem; }
    .hero-stats-card .stat-num { font-size: 1.6rem; }

    /* Page header */
    .page-header { padding: 1.5rem 0; margin-bottom: 1.2rem; }
    .page-header h1 { font-size: 1.4rem; }

    /* Nav */
    .lms-navbar .brand-sub { display: none; }

    /* Stat cards */
    .stat-card { padding: 1.1rem; }
    .stat-card .stat-num { font-size: 1.7rem; }

    /* Cards hover effect off (no hover on touch) */
    .lms-card:hover { transform: none; }

    /* Forms */
    .lms-form-card { padding: 1.75rem 1.25rem; }

    /* Tables — horizontal scroll on mobile */
    .table-responsive-mobile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .lms-table { min-width: 560px; }

    /* Certificate */
    .certificate-wrapper { padding: 1.75rem 1.25rem; border-width: 4px; }
    .cert-title { font-size: 1.8rem; }
    .cert-name  { font-size: 1.4rem; }
    .cert-logo  { font-size: 2.5rem; }

    /* Assessment */
    .question-card { padding: 1.1rem; }
    .timer-badge { font-size: .95rem; padding: .4rem .8rem; }

    /* Module iframe */
    .module-content-frame { min-height: 65vh; }

    /* Module mobile nav bar */
    .module-mobile-nav { display: flex !important; }

    /* Admin sidebar overlay */
    .admin-sidebar { position: fixed; z-index: 1055; top: 0; left: 0;
        height: 100vh; transform: translateX(-100%); transition: transform .25s ease;
        display: flex !important; flex-direction: column; }
    .admin-sidebar.show { transform: translateX(0); }
    .sidebar-backdrop { display: none; position: fixed; inset: 0;
        background: rgba(0,0,0,.45); z-index: 1054; }
    .sidebar-backdrop.show { display: block; }
    .lesson-workspace { padding:.75rem; max-height:none; }
    .lesson-paper { min-height:480px; padding:1.4rem 1.1rem; box-shadow:none; }
    .lesson-header,.lesson-content { padding:1.4rem 1.1rem; }
    .lesson-header h1 { font-size:1.45rem; }
    .digital-lesson { margin:.75rem; border-radius:10px; }
    .authoring-ribbon { top:0; }
}

/* Small phones (< 576px) */
@media (max-width: 575.98px) {
    /* Hero */
    .lms-hero { padding: 2.5rem 0 2rem; }
    .lms-hero h1 { font-size: 1.5rem; }
    .lms-hero .hero-stats-card .stat-num { font-size: 1.35rem; }
    .lms-hero .lead { font-size: .95rem; }
    .lms-hero .d-flex.gap-3 { flex-direction: column; gap: .6rem !important; }
    .lms-hero .d-flex.gap-3 .btn { width: 100%; text-align: center; }

    /* Page header */
    .page-header h1 { font-size: 1.2rem; }

    /* Navbar brand */
    .brand-name { font-size: .95rem; }

    /* Form card */
    .lms-form-card { padding: 1.4rem 1rem; margin: 0 .25rem; }

    /* Stat cards — 2 per row already via col-sm-6, just tighten */
    .stat-card .stat-num { font-size: 1.5rem; }
    .stat-card .stat-icon { font-size: 1.5rem; }

    /* Course card */
    .course-card .course-banner { height: 120px; font-size: 2.8rem; }

    /* Certificate  */
    .certificate-wrapper { padding: 1.25rem .9rem; }
    .cert-title { font-size: 1.35rem; }
    .cert-name  { font-size: 1.1rem; padding: 0 .4rem .2rem; }
    .cert-seal  { width: 60px; height: 60px; font-size: 1.2rem; }

    /* Assessment */
    .question-card { padding: .9rem; }
    .question-card .q-number { width: 30px; height: 30px; font-size: .75rem; }

    /* Module iframe */
    .module-content-frame { min-height: 55vh; }

    /* Tables */
    .lms-table { min-width: 480px; }
    .lms-table thead th,
    .lms-table tbody td { padding: .6rem .7rem; font-size: .82rem; }
}

/* ─── Print (Certificate) ────────────────────────────── */
@media print {
    .lms-navbar, .lms-footer, .no-print { display: none !important; }
    .certificate-wrapper { box-shadow: none; border-width: 4px; }
    body { background: #fff; }
}
