/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

body.module-page-body {
    background:
        radial-gradient(circle at 8% 12%, rgba(37, 99, 235, 0.18), transparent 32%),
        radial-gradient(circle at 92% 18%, rgba(14, 165, 233, 0.14), transparent 28%),
        linear-gradient(180deg, #eef4ff 0%, #f7fbff 52%, #f4f7fb 100%);
    color: #1f2937;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.navbar {
    padding: 1.1rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.7rem;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: 0.5px;
    flex: 0 0 auto;
}

.logo i {
    margin-right: 12px;
    color: #3498db;
    font-size: 1.9rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    white-space: nowrap;
}

.hamburger {
    display: none;
    color: #2c3e50;
    font-size: 1.6rem;
    cursor: pointer;
    border: 1px solid rgba(44, 62, 80, 0.4);
    border-radius: 8px;
    padding: 6px 10px;
}

.nav-link {
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    transition: color 0.3s ease;
    position: relative;
    padding-bottom: 4px;
}

.nav-link:hover {
    color: #3498db;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #3498db;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Logo image */
.logo-img {
    max-height: 52px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* Gallery Hero Section */
.gallery-hero {
    position: relative;
    width: 100%;
    height: 450px;
    margin-top: 70px;
    /* offset for fixed header */
    overflow: hidden;
    background: linear-gradient(135deg, #3d5a80, #764ba2);
}

.gallery-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    cursor: pointer;
}

.gallery-slide.active {
    opacity: 1;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
}

.gallery-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.92);
    text-align: center;
    padding: 2rem;
    gap: 1rem;
}

.gallery-empty-state i {
    font-size: 4rem;
    opacity: 0.6;
}

.gallery-empty-state p {
    font-size: 2.2rem;
    font-weight: 700;
    text-shadow: 1px 2px 6px rgba(0, 0, 0, 0.3);
    margin: 0;
}

.gallery-empty-state span {
    font-size: 1.1rem;
    opacity: 0.85;
}

/* Gallery arrows */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: background 0.25s, transform 0.25s;
    backdrop-filter: blur(4px);
}

.gallery-arrow:hover {
    background: rgba(255, 255, 255, 0.38);
    transform: translateY(-50%) scale(1.08);
}

.gallery-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.gallery-arrow-prev {
    left: 18px;
}

.gallery-arrow-next {
    right: 18px;
}

/* Gallery dots */
.gallery-dots {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
}

.gallery-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.25s, transform 0.25s;
}

.gallery-dot.active {
    background: #fff;
    transform: scale(1.25);
}


/* Module Styles */
.module {
    padding: 80px 0;
    position: relative;
}

.module:first-of-type {
    padding-top: 120px;
}

.module-page {
    padding-top: 140px;
    padding-bottom: 80px;
    position: relative;
}

.module-page::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: radial-gradient(circle at 20% 12%, #000 14%, transparent 62%);
    opacity: 0.34;
    z-index: 0;
}

.module-page .module {
    position: relative;
    z-index: 1;
}

.module-page .container {
    max-width: 1240px;
}

.module-gallery-head {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

.module-gallery-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    color: #475569;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.module-gallery-head h1 {
    font-size: clamp(1.9rem, 4.2vw, 2.8rem);
    line-height: 1.15;
    color: #1e3a8a;
    margin: 0;
}

.module-gallery-hero {
    margin-top: 0;
    height: 320px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 46px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
    z-index: 1;
}

.module-gallery-hero .gallery-empty-state p {
    font-size: 1.85rem;
}

.module-gallery-hero .gallery-empty-state span {
    max-width: 760px;
}

.module-page .section-header {
    text-align: left;
    margin-bottom: 1.7rem;
    padding: 1.35rem 1.45rem;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.82));
    box-shadow: 0 20px 46px rgba(15, 23, 42, 0.12);
}

.module-page .section-header h2,
.module-page .section-header p {
    color: #2c3e50;
    text-shadow: none;
}

.module-page .section-header h2 {
    font-size: clamp(1.9rem, 3.2vw, 2.5rem);
    margin-bottom: 0.35rem;
    letter-spacing: 0.01em;
}

.module-page .section-header p {
    color: #64748b;
    font-size: 1.03rem;
    max-width: 70ch;
}

.module-list {
    display: grid;
    gap: 1.1rem;
}

.module-folder {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(203, 213, 225, 0.78);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.1);
    overflow: hidden;
}

.module-folder-summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.module-folder-summary:hover {
    background: rgba(219, 234, 254, 0.45);
}

.module-folder-summary::-webkit-details-marker {
    display: none;
}

.module-folder-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #243447;
    font-weight: 700;
}

.module-folder-title i {
    color: #f39c12;
}

.module-folder-count {
    color: #7b8894;
    font-size: 0.9rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.7);
}

.module-folder-children {
    display: grid;
    gap: 0.85rem;
    padding: 0 1.05rem 1.05rem 1.75rem;
}

.nested-file-item {
    box-shadow: none;
    border: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.94);
}

.module-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.93);
    border: 1px solid rgba(203, 213, 225, 0.76);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.1);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.module-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 26px 52px rgba(15, 23, 42, 0.14);
}

.module-list-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.module-list-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(14, 165, 233, 0.12));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #3498db;
    font-size: 1.4rem;
}

.module-list-text h3 {
    margin-bottom: 0.35rem;
    color: #1e293b;
    font-size: 1.2rem;
    letter-spacing: 0.01em;
}

.module-list-text p {
    margin-bottom: 0.25rem;
    color: #64748b;
    font-size: 0.95rem;
}

.module-list-meta {
    font-size: 0.85rem;
    color: #94a3b8;
}

.module.alternate-bg {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.more-link {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    padding: 8px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.more-link:hover {
    background: #fff;
    color: #5a2b72;
    border-color: #fff;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.section-header p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
}

.section-header i {
    color: #f39c12;
    margin-right: 10px;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.content-item {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.content-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.content-icon {
    font-size: 3rem;
    color: #e74c3c;
    margin-bottom: 1rem;
}

.content-item h3 {
    color: #7f8c8d;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-weight: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.content-item p {
    display: none;
}

/* Button Styles */
.btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Video Grid — gallery-style covers */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.8rem;
    margin-top: 2rem;
}

.video-card {
    position: relative;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    background: #111;
    min-height: 280px;
}

.video-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
}

/* Background Cover Image */
.video-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
    transition: transform 0.5s ease, filter 0.3s ease;
}

.video-card:hover .video-card-bg {
    transform: scale(1.06);
    filter: brightness(0.85);
}

/* Play overlay - Centered */
.video-play-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(0, 0, 0, 0.15);
}

.video-card:hover .video-play-overlay {
    opacity: 1;
}

.video-play-overlay i {
    font-size: 3.5rem;
    color: white;
    background: rgba(0, 0, 0, 0.45);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 4px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s ease;
    backdrop-filter: blur(2px);
}

.video-card:hover .video-play-overlay i {
    transform: scale(1.1);
}

/* Video info overlay - Bottom gradient */
.video-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 3rem 1.4rem 1.3rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0) 100%);
    transition: padding-bottom 0.3s ease;
}

.video-card:hover .video-card-info {
    padding-bottom: 1.6rem;
}

.video-card-info h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.4rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.video-card-info p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.overview-carousel {
    position: relative;
    min-height: 340px;
}

.overview-carousel-track {
    position: relative;
    min-height: 340px;
}

.overview-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overview-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.overview-slide-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.overview-slide .overview-card {
    width: 100%;
    margin: 0;
    min-height: 280px;
}

.overview-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(31, 41, 55, 0.75);
    color: #fff;
    cursor: pointer;
}

.overview-carousel-prev {
    left: 1rem;
}

.overview-carousel-next {
    right: 1rem;
}

.overview-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.overview-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
}

.overview-carousel-dot.active {
    background: #fff;
    transform: scale(1.2);
}

/* Admin Panel */
.admin-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.admin-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    border: 2px solid #3498db;
    color: #3498db;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn.active,
.tab-btn:hover {
    background: #3498db;
    color: white;
}

.tab-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    text-align: center;
}

.upload-form {
    max-width: 600px;
    margin: 0 auto;
}

.upload-form input,
.upload-form textarea {
    width: 100%;
    padding: 15px;
    margin-bottom: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.upload-form input:focus,
.upload-form textarea:focus {
    outline: none;
    border-color: #3498db;
}

.upload-form textarea {
    min-height: 120px;
    resize: vertical;
}

.upload-form button {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #3498db;
}

.footer-section p {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: #3498db;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: #3498db;
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    color: white;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: #2980b9;
    transform: translateY(-3px);
}

.footer-bottom {
    border-top: 1px solid #34495e;
    padding-top: 1rem;
    text-align: center;
    opacity: 0.8;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    z-index: 2001;
}

.close:hover {
    color: #333;
}

.content-modal {
    max-width: 1180px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.96));
    box-shadow: 0 30px 80px rgba(12, 26, 75, 0.28);
}

.preview-shell {
    display: grid;
    gap: 1rem;
}

.preview-tabs {
    display: inline-flex;
    gap: 0.65rem;
    padding: 0.45rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    width: fit-content;
}

.preview-tab {
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #34495e;
    background: transparent;
    cursor: pointer;
    transition: all 0.22s ease;
}

.preview-tab:hover,
.preview-tab.active {
    color: #ffffff;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

.preview-tab.is-empty {
    opacity: 0.85;
}

.preview-panel-wrap {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid #dce6f4;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.preview-panel {
    display: none;
    padding: 1rem;
}

.preview-panel.active {
    display: block;
}

.html-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.html-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #6c7a86;
}

.html-nav-btn {
    border: 1px solid #d5dbe2;
    background: #fff;
    color: #2c3e50;
    border-radius: 999px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.html-nav-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.html-nav-btn:hover:not(:disabled) {
    border-color: #3498db;
    color: #3498db;
}

.content-viewer iframe,
.content-viewer video {
    width: 100%;
    height: 540px;
    border: none;
    border-radius: 10px;
    background: #fff;
}

.content-viewer-image {
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 10px;
    display: block;
    background: #fff;
}

.content-viewer iframe {
    box-shadow: inset 0 0 0 1px #e3e6ea;
}

.content-fallback {
    text-align: center;
    padding: 2rem;
}

.content-fallback a {
    color: #3498db;
    text-decoration: none;
}

.content-meta {
    margin-top: 1rem;
    text-align: left;
}

.content-meta h4 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.content-tag {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0.75rem;
}

.html-preview {
    background: #fff;
    border: 1px solid #dce6f4;
    border-radius: 10px;
    padding: 1.25rem;
    min-height: 560px;
    font-family: "Noto Sans SC", sans-serif;
    color: #2c3e50;
    overflow: auto;
}

.html-empty {
    color: #667085;
    padding: 1rem;
    text-align: center;
    font-size: 0.95rem;
}

/* Floating search widget */
.search-fab {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.search-panel {
    position: fixed;
    right: 28px;
    bottom: 96px;
    width: min(420px, calc(100% - 56px));
    height: 520px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 320px;
    min-height: 380px;
    resize: both;
}

.search-panel.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.search-panel.search-panel-floating {
    right: auto;
    bottom: auto;
}

.search-panel.active.search-panel-floating {
    transform: none;
}

.search-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f1f3;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
}

.search-panel-header h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-panel-header h3 i {
    color: #667eea;
}

.search-close {
    border: none;
    background: transparent;
    color: #7f8c8d;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
}

.search-close:hover {
    background: #f0f1f3;
    color: #2c3e50;
}

.search-panel-resizer {
    position: absolute;
    width: 16px;
    height: 16px;
    right: 0;
    bottom: 0;
    cursor: nwse-resize;
    z-index: 3;
    background:
        linear-gradient(135deg, transparent 48%, rgba(102, 126, 234, 0.75) 49%, rgba(102, 126, 234, 0.75) 51%, transparent 52%),
        linear-gradient(135deg, transparent 62%, rgba(102, 126, 234, 0.55) 63%, rgba(102, 126, 234, 0.55) 65%, transparent 66%);
}

.search-panel.dragging {
    transition: none;
}

/* Chat messages area */
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-results::-webkit-scrollbar {
    width: 5px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: #d5dbe2;
    border-radius: 10px;
}

/* Chat input area - pinned at bottom */
.search-panel-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #f0f1f3;
    flex-shrink: 0;
    background: #fafbfc;
}

.search-panel-input input {
    flex: 1;
    border: 1px solid #e3e6ea;
    border-radius: 22px;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.search-panel-input input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.search-panel-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}

.search-panel-send:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Chat messages */
.chat-message {
    display: flex;
    margin-bottom: 0.25rem;
}

.chat-message span,
.chat-message .message-content {
    display: inline-block;
    padding: 0.6rem 0.9rem;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.55;
    max-width: 85%;
    word-wrap: break-word;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.user span {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
    background: #f4f5f7;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
}

.chat-message.loading .message-content {
    opacity: 0.7;
}

/* Streaming cursor */
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #667eea;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursor-blink 0.7s step-end infinite;
}

@keyframes cursor-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Markdown content inside assistant messages */
.message-content .markdown-body {
    font-size: 0.88rem;
    line-height: 1.6;
}

.message-content .markdown-body h1,
.message-content .markdown-body h2,
.message-content .markdown-body h3 {
    margin: 0.6rem 0 0.3rem;
    font-weight: 600;
    color: #2c3e50;
}

.message-content .markdown-body h1 {
    font-size: 1.15rem;
}

.message-content .markdown-body h2 {
    font-size: 1.05rem;
}

.message-content .markdown-body h3 {
    font-size: 0.95rem;
}

.message-content .markdown-body p {
    margin: 0.3rem 0;
}

.message-content .markdown-body ul,
.message-content .markdown-body ol {
    margin: 0.3rem 0;
    padding-left: 1.4rem;
}

.message-content .markdown-body li {
    margin-bottom: 0.15rem;
}

.message-content .markdown-body blockquote {
    margin: 0.5rem 0;
    padding: 0.4rem 0.8rem;
    border-left: 3px solid #667eea;
    background: rgba(102, 126, 234, 0.06);
    border-radius: 0 6px 6px 0;
    color: #555;
    font-size: 0.85rem;
}

.message-content .markdown-body code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.message-content .markdown-body pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 0.75rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message-content .markdown-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.message-content .markdown-body strong {
    font-weight: 600;
    color: #2c3e50;
}

.message-content .markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    font-size: 0.83rem;
}

.message-content .markdown-body th,
.message-content .markdown-body td {
    border: 1px solid #e3e6ea;
    padding: 0.35rem 0.5rem;
    text-align: left;
}

.message-content .markdown-body th {
    background: #f4f5f7;
    font-weight: 600;
}

/* Citation / Reference section */
.chat-citations {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}

.chat-citations-label {
    font-size: 0.75rem;
    color: #8a97a4;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.chat-citations-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chat-citation-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    font-size: 0.78rem;
    color: #667eea;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

.chat-citation-chip:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: #667eea;
    transform: translateY(-1px);
}

.chat-citation-chip i {
    font-size: 0.7rem;
}

/* Legacy chat-sources kept for compatibility */
.chat-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
}

.search-empty {
    color: #a0a6ad;
    font-size: 0.9rem;
    text-align: center;
    padding: 2rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        width: 100%;
        padding-top: 1rem;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .content-grid,
    .video-grid {
        grid-template-columns: 1fr;
    }

    .admin-tabs {
        flex-direction: column;
        align-items: center;
    }

    .tab-btn {
        width: 200px;
    }

    .hamburger {
        display: inline-flex;
    }

    .nav-container {
        flex-wrap: wrap;
    }

    .section-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .module-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .module-page {
        padding-top: 118px;
    }

    .module-gallery-head {
        margin-bottom: 0.75rem;
    }

    .module-gallery-head h1 {
        font-size: 1.6rem;
    }

    .module-gallery-hero {
        height: 240px;
        border-radius: 14px;
    }

    .module-page .section-header {
        padding: 1rem 1.05rem;
        border-radius: 14px;
        margin-bottom: 1.1rem;
    }

    .module-page .section-header h2 {
        font-size: 1.62rem;
    }

    .module-folder-summary {
        padding: 0.95rem 1rem;
    }

    .module-folder-children {
        padding: 0 0.7rem 0.85rem 0.95rem;
    }

    .content-viewer iframe,
    .content-viewer video {
        height: 320px;
    }

    .overview-slide-row {
        grid-template-columns: 1fr;
    }

    .preview-tab {
        padding: 0.52rem 0.95rem;
        font-size: 0.9rem;
    }

    .html-preview {
        min-height: 340px;
    }

    .search-fab {
        right: 18px;
        bottom: 18px;
    }

    .search-panel {
        right: 18px;
        bottom: 86px;
        min-width: 0;
        min-height: 0;
        resize: none;
    }

    .search-panel-header {
        cursor: default;
    }

    .search-panel-resizer {
        display: none;
    }
}

.qa-login-modal {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 18% 22%, rgba(59, 130, 246, 0.3), transparent 44%),
        radial-gradient(circle at 82% 76%, rgba(16, 185, 129, 0.24), transparent 38%),
        rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2400;
    padding: 1rem;
}

.qa-login-modal.active {
    display: flex;
}

.qa-login-card {
    width: min(420px, 100%);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(240, 247, 255, 0.95));
    border-radius: 20px;
    box-shadow:
        0 28px 70px rgba(15, 23, 42, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.72);
    padding: 1.2rem 1.15rem 1.15rem;
    position: relative;
    overflow: hidden;
}

.qa-login-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: linear-gradient(90deg, #3b82f6, #2563eb, #0ea5e9);
}

.qa-login-hero {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.9rem;
}

.qa-login-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
    font-size: 1.45rem;
}

.qa-login-card h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.12rem;
    letter-spacing: 0.01em;
}

.qa-login-card p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.92rem;
}

.qa-login-close {
    position: absolute;
    right: 10px;
    top: 10px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.qa-login-close:hover {
    color: #0f172a;
    transform: scale(1.05);
}

.qa-login-form {
    display: grid;
    gap: 0.75rem;
}

.qa-login-form input {
    border: 1px solid #cfd8e3;
    border-radius: 12px;
    padding: 0.72rem 0.86rem;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.92);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.qa-login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
    background: #fff;
}

.qa-login-form .btn {
    margin-top: 0.1rem;
    border-radius: 12px;
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.24);
}

.qa-login-form .btn:hover {
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
}

.qa-login-error {
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    font-size: 0.88rem;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Success Message */
.success-message {
    background: #27ae60;
    color: white;
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    text-align: center;
    display: none;
}

/* Error Message */
.error-message {
    background: #e74c3c;
    color: white;
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    text-align: center;
    display: none;
}
