/* ==========================================================================
   MASTER STYLESHEET - MOE GLASSMORPHISM THEME (STABLE & RESPONSIVE)
   ========================================================================== */

/* --- 1. VARIABLES --- */
:root {
    --moe-maroon: #8a1538; 
    --moe-maroon-glass: rgba(138, 21, 56, 0.85); 
    --gold-accent: #d4af37; 
    --ink-color: #2c3e50;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-bg-hover: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px rgba(138, 21, 56, 0.08);
}

/* --- 2. GLOBAL RESET --- */
html, body {
    margin: 0;
    padding: 0;
    /* Removed the aggressive overflow-x: hidden that was causing render loops */
}

body {
    background-color: #f0f4f8;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(138, 21, 56, 0.06), transparent 35%),
        radial-gradient(circle at 85% 80%, rgba(212, 175, 55, 0.08), transparent 35%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.8), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
    font-family: 'Crimson Text', serif;
    color: var(--ink-color);
    display: flex;
    flex-direction: column;
}

/* Ensure images don't break containers */
img {
    max-width: 100%;
    height: auto;
}

/* --- 3. TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cinzel', serif;
    color: var(--moe-maroon);
}

.section-main-title, 
.mv-title, 
.staff-name-title, 
.table-section-title, 
.form-section-title {
    color: var(--moe-maroon) !important;
    font-weight: bold;
}

.section-main-title {
    border-bottom: 2px solid var(--gold-accent);
    padding-bottom: 5px;
    margin-bottom: 25px;
    display: inline-block;
}

/* --- 4. HEADER (STICKY) --- */
.leather-header {
    background-color: var(--moe-maroon-glass);
    backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--gold-accent);
    color: #fff;
    padding: 10px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 1000;
    position: sticky;
    top: 0;
    width: 100%;
}
.header-title-area h4 { border: none; color: #fff; }

/* --- 5. BOOK LAYOUT (MAIN CONTAINER) --- */
.book-stage {
    margin: 40px auto;
    max-width: 1400px;
    width: 100%;
    padding: 0 15px;
    flex-grow: 1;
}

.book-container {
    display: flex;
    flex-direction: row;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    min-height: 80vh;
    box-shadow: 0 25px 50px rgba(0,0,0,0.08), inset 0 0 0 1px var(--glass-border);
    border-radius: 12px;
}

.book-spine {
    width: 5px;
    background: var(--glass-border);
}

.page-left {
    width: 280px;
    flex-shrink: 0;
    padding: 30px 20px;
    background-color: rgba(255, 255, 255, 0.4);
    border-right: 1px solid var(--glass-border);
}

.page-right {
    flex-grow: 1;
    padding: 40px;
    background-color: rgba(255, 255, 255, 0.6);
    /* Allow content inside here to scroll if needed, preventing overall page stretch */
    min-width: 0; 
}

/* --- 6. NAVIGATION & TRANSLATE --- */
.book-nav .nav-link { color: var(--ink-color); font-size: 1.1rem; padding: 12px 15px; border-bottom: 1px dotted rgba(138, 21, 56, 0.2); transition: 0.3s; }
.book-nav .nav-link:hover { background-color: rgba(138, 21, 56, 0.1); color: var(--moe-maroon); font-weight: 600; }
.mobile-toc-toggle { cursor: pointer; padding: 8px 12px; border-radius: 5px; border: 1px solid var(--glass-border); }
.book-search-input { background: rgba(255, 255, 255, 0.8); border: 1px solid rgba(138, 21, 56, 0.2); border-radius: 20px; padding: 5px 15px; width: 100%; }

.goog-te-banner-frame, .goog-logo-link, .goog-te-gadget span { display: none !important; }
body { top: 0px !important; }
.goog-te-combo { font-family: 'Cinzel', sans-serif; font-size: 0.8rem; color: #fff; background-color: var(--moe-maroon); padding: 5px; border-radius: 4px; border: 1px solid var(--gold-accent); }

/* --- 7. HOMEPAGE SLIDER --- */
#mainCarousel {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    margin-bottom: 30px;
    width: 100%;
}
.slider-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.glass-caption {
    position: absolute; bottom: 0; left: 0; right: 0; 
    padding: 12px 15px; 
    background: rgba(138, 21, 56, 0.75); 
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(212, 175, 55, 0.4); 
    text-align: center;
}
.glass-title-link { text-decoration: none !important; display: block; width: 100%; }
.glass-title-link:hover .glass-title { color: var(--gold-accent); }
.glass-title {
    color: #fff; font-family: 'Cinzel', serif; 
    font-size: clamp(0.9rem, 3vw, 1.2rem); margin: 0; 
    text-decoration: none !important; border: none !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    display: block; width: 100%;
}
.carousel-caption, .hero-slider-caption { display: none !important; }

/* --- 8. GLASSMORPHISM CARDS --- */
.theme-paper-card, .mv-card, .quick-link-card, .duty-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.theme-paper-card:hover, .mv-card:hover, .quick-link-card:hover, .duty-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(138, 21, 56, 0.15);
    border-color: var(--gold-accent);
}

.theme-paper-card::before, .duty-card::before, .mv-card::before {
    content: ''; display: block; height: 4px;
    background: linear-gradient(90deg, var(--moe-maroon), var(--gold-accent), var(--moe-maroon));
    border-top-left-radius: 12px; border-top-right-radius: 12px;
}

.theme-paper-card { padding: 30px; margin-bottom: 40px; }
.mv-card { padding: 30px; text-align: center; height: 100%; }
.mv-icon { font-size: 2.5rem; color: var(--moe-maroon); margin-bottom: 15px; }

/* --- 9. WIDGET CARDS (LINKS & DUTIES) --- */
.quick-link-card {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 40px 20px; text-align: center; text-decoration: none !important; 
    height: 100%; min-height: 200px;
}
.quick-link-icon { font-size: 3.5rem; color: var(--moe-maroon); margin-bottom: 20px; transition: 0.3s; }
.quick-link-card:hover .quick-link-icon { color: var(--gold-accent); transform: scale(1.1); }
.quick-link-title { color: var(--moe-maroon); font-size: 1.3rem; margin: 0; font-weight: bold; }

.duty-card { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.duty-header { padding: 25px; background: rgba(255,255,255,0.4); border-bottom: 1px dashed rgba(138,21,56,0.2); }
.duty-body { padding: 25px; flex-grow: 1; }
.duty-subtitle { color: var(--moe-maroon) !important; border-bottom: 2px solid var(--moe-maroon); display: inline-block; padding-bottom: 3px; margin-bottom: 15px; font-weight: bold; font-size: 1.1rem; }

/* --- 10. STAFF PROFILES --- */
.staff-card-head {
    background: var(--glass-bg); border: 2px solid var(--gold-accent);
    padding: 30px; border-radius: 12px; box-shadow: var(--glass-shadow); text-align: center;
}
.staff-photo { border-radius: 8px; border: 3px solid var(--glass-border); object-fit: cover; width: 250px; height: 250px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.staff-head-credentials { font-size: 1rem; color: #555; margin-bottom: 10px; }
.staff-head-designation { font-size: 1.2rem; color: var(--gold-accent); font-weight: bold; }
.staff-designation-badge { display: inline-block; background: var(--moe-maroon); color: #fff; padding: 4px 10px; border-radius: 4px; font-size: 0.8rem; text-transform: uppercase; }
.code-badge { background: #555; }

/* --- 11. LISTS & FORMS --- */
.bullet-list { list-style: none; padding-left: 0; margin-bottom: 0; }
.bullet-list li { font-size: 1.05rem; margin-bottom: 10px; padding-left: 20px; position: relative; line-height: 1.5; color: var(--ink-color); }
.bullet-list li::before { content: '❖'; color: var(--gold-accent); position: absolute; left: 0; }
.bullet-list-sub { padding-left: 20px; margin-top: 10px; }
.bullet-list-sub li::before { content: '•'; color: var(--moe-maroon); font-size: 1.2rem; line-height: 1.2; }

.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; }
.form-item { background: var(--glass-bg); border: 1px solid var(--glass-border); padding: 12px 15px; border-radius: 6px; display: flex; align-items: flex-start; transition: 0.3s; color: var(--ink-color); }
.form-item:hover { background: #fff; border-color: var(--gold-accent); transform: translateX(5px); }
.form-item i { color: var(--gold-accent); margin-right: 10px; margin-top: 4px; }

/* --- 12. TABLES (RESPONSIVE SCROLL FIXED) --- */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto; /* Allows table to scroll horizontally without breaking the page */
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}
.stats-table { width: 100%; border-collapse: collapse; min-width: 600px; /* Forces scroll if container is too small */ }
.stats-table th { background-color: var(--moe-maroon-glass); color: #fff; padding: 12px; text-align: left; white-space: nowrap; border: 1px solid var(--glass-border); font-family: 'Cinzel', serif; }
.stats-table td { background-color: var(--glass-bg); padding: 10px; border: 1px solid var(--glass-border); color: var(--ink-color); font-family: 'Crimson Text', serif; }
.stats-table tr:nth-child(even) td { background-color: rgba(255,255,255,0.3); }
.table-total-row td { font-weight: bold; background-color: rgba(212, 175, 55, 0.2) !important; }

/* --- 13. FOOTER --- */
.site-footer {
    width: 100%;
    background: rgba(138, 21, 56, 0.98); 
    backdrop-filter: blur(15px); 
    border-top: 3px solid var(--gold-accent); 
    padding: 2rem 0;
    margin-top: auto;
}

/* --- 14. MOBILE RESPONSIVE TWEAKS --- */
@media (max-width: 991px) {
    .book-stage { padding: 10px; margin: 20px auto; }
    .book-container { flex-direction: column; }
    .page-left { width: 100%; border-right: none; border-bottom: 2px solid var(--gold-accent); border-radius: 12px 12px 0 0; }
    .page-right { width: 100%; padding: 20px 15px; border-radius: 0 0 12px 12px; }
    .theme-paper-card { padding: 20px 15px; }
}

@media (max-width: 768px) {
    .quick-link-card { min-height: 160px; padding: 25px 15px; }
    .quick-link-icon { font-size: 2.5rem; }
    .quick-link-title { font-size: 1.1rem; }
    .glass-caption { padding: 8px 10px; }
    .staff-photo { width: 200px; height: 200px; }
}

/* ==========================================================================
   PLANNING COMPREHENSIVE SECTION - ANIMATED WIDGET STYLE (ATHINATHA STYLE)
   ========================================================================== */

/* --- ENFORCE MAROON HEADINGS & ICONS --- */
.mv-title,
.section-main-title,
.staff-name-title,
.table-section-title,
.form-section-title,
.maroon-icon {
    color: var(--moe-maroon) !important;
}

/* --- STAFF HEAD SECTION --- */
.staff-card-head {
    background: var(--glass-bg); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid var(--moe-maroon) !important; 
    padding: 30px; 
    border-radius: 12px; 
    position: relative;
    box-shadow: var(--glass-shadow); 
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    overflow: hidden;
    z-index: 1;
}
.staff-head-credentials {
    font-family: 'Crimson Text', serif; 
    color: var(--ink-color); 
    font-size: 1.1rem; 
    line-height: 1.5;
    font-weight: normal;
}
.staff-head-designation {
    font-family: 'Crimson Text', serif; 
    color: var(--moe-maroon) !important; 
    font-weight: bold; 
    font-size: 1.25rem; 
    margin-top: 10px; 
    margin-bottom: 10px;
}
.staff-head-contact {
    font-size: 1.05rem; 
    color: var(--ink-color);
}
.section-description {
    font-family: 'Crimson Text', serif; 
    font-size: 1.15rem; 
    color: var(--ink-color); 
    max-width: 900px; 
    margin: 0 auto; 
    line-height: 1.6;
}

/* --- TABLE CONTAINER FIX --- */
.planning-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--moe-maroon) !important; 
    border-radius: 8px;
    background: var(--glass-bg);
    margin-bottom: 1rem;
}
.planning-table-wrapper .stats-table {
    margin-bottom: 0;
    min-width: 400px;
    border: none;
    width: 100%;
    border-collapse: collapse;
}
.planning-table-wrapper .stats-table th {
    background-color: var(--moe-maroon-glass);
    color: #fff;
    font-family: 'Cinzel', serif;
    padding: 12px 10px;
    text-align: left;
    font-weight: normal;
    white-space: nowrap;
}
.planning-table-wrapper .stats-table td {
    padding: 10px;
    font-family: 'Crimson Text', serif;
    color: var(--ink-color);
    font-size: 1.05rem;
    white-space: nowrap;
    border-top: none;
    border-bottom: 1px solid rgba(138, 21, 56, 0.1);
}
.planning-table-wrapper .stats-table tr:last-child td {
    border-bottom: none;
}
.planning-table-wrapper .stats-table tr:nth-child(even) td {
    background-color: rgba(255,255,255,0.3);
}
.planning-table-wrapper .stats-table tr:hover td {
    background-color: var(--glass-bg-hover);
}
.table-total-row td {
    font-weight: bold;
    background-color: rgba(138, 21, 56, 0.1) !important; 
    color: var(--moe-maroon) !important;
}

/* --- ENHANCED ALL CARDS (ANIMATED WIDGET STYLE) --- */
.theme-paper-card, .duty-card {
    background: var(--glass-bg); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border); 
    border-radius: 12px; 
    position: relative; 
    box-shadow: var(--glass-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    overflow: hidden; 
    z-index: 1;
}

.duty-card {
    height: 100%; 
    display: flex;
    flex-direction: column;
}

/* Beautiful Shimmer Hover Effect for ALL cards */
.theme-paper-card::after, .duty-card::after, .staff-card-head::after { 
    content: ''; 
    position: absolute; top: 0; left: -100%; 
    width: 50%; height: 100%; 
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%); 
    transform: skewX(-25deg); 
    transition: all 0.7s ease; 
    z-index: -1; 
    pointer-events: none; /* Prevents shimmering layer from blocking text */
}
.theme-paper-card:hover::after, .duty-card:hover::after, .staff-card-head:hover::after { left: 200%; }

/* Widget Bouncy Hover */
.theme-paper-card:hover, .duty-card:hover, .staff-card-head:hover { 
    transform: translateY(-10px) scale(1.02); 
    box-shadow: 0 20px 40px rgba(138, 21, 56, 0.15); 
    border-color: var(--moe-maroon) !important; 
}

.duty-header { 
    padding: 25px; 
    border-bottom: 1px dashed rgba(138, 21, 56, 0.2); 
    background: rgba(255, 255, 255, 0.3);
}
.duty-body { 
    padding: 25px; 
    flex-grow: 1; 
}

.duty-subtitle {
    font-family: 'Cinzel', serif; 
    color: var(--moe-maroon) !important; 
    border-bottom: 2px solid var(--moe-maroon) !important; 
    display: inline-block; 
    padding-bottom: 4px; 
    margin-bottom: 15px;
    font-weight: 800;
    font-size: 1.15rem;
}

/* --- LISTS --- */
.bullet-list { list-style: none; padding-left: 0; margin-bottom: 0; text-align: left; }
.bullet-list li { font-size: 1.05rem; margin-bottom: 10px; padding-left: 20px; position: relative; line-height: 1.5; color: var(--ink-color); }
.bullet-list li::before { 
    content: '❖'; 
    color: var(--moe-maroon) !important; 
    position: absolute; left: 0; 
}
.bullet-list-sub { list-style: none; padding-left: 20px; margin-top: 8px; margin-bottom: 8px; text-align: left; }
.bullet-list-sub li { margin-bottom: 6px; padding-left: 18px; font-size: 1rem; }
.bullet-list-sub li::before {
    content: '•'; 
    color: var(--moe-maroon) !important; 
    position: absolute; left: 0; 
    font-size: 1.3rem; line-height: 1.1;
}

/* --- FORMS GRID --- */
.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 15px; }
.form-item {
    background: var(--glass-bg); 
    border: 1px solid var(--glass-border); 
    padding: 12px 15px; 
    border-radius: 4px;
    font-family: 'Crimson Text', serif; 
    color: var(--ink-color); 
    display: flex; 
    align-items: flex-start;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.form-item:hover { 
    background: var(--glass-bg-hover); 
    transform: translateX(10px) scale(1.02); 
    border-color: var(--moe-maroon) !important; 
    box-shadow: 0 5px 15px rgba(138, 21, 56, 0.1);
}
.form-item i { 
    color: var(--moe-maroon) !important; 
    margin-right: 12px; 
    margin-top: 4px; 
    font-size: 1rem; 
    transition: 0.3s ease;
}
.form-item:hover i {
    transform: scale(1.2);
}

/* --- BADGES & CONTACT ROW --- */
.staff-contact-row {
    margin-top: 10px;
    font-size: 0.95rem;
    color: var(--ink-color);
}
.code-badge {
    background: #555;
    color: #fff;
}

/* --- MOBILE SPECIFIC FIXES --- */
@media (max-width: 768px) {
    .planning-comprehensive-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    .theme-paper-card {
        padding: 20px 10px; 
    }
    .duty-card {
        margin-left: 0;
        margin-right: 0;
    }
    .duty-header, .duty-body {
        padding: 15px 10px;
    }
}

/* ==========================================================================
   LOGGED IN ADMIN OVERRIDES (PAGE EDITOR FIX)
   ========================================================================== */

/* Remove glass effects, animations, and traps when the admin is logged in */
body.admin-logged-in .book-stage,
body.admin-logged-in .book-container,
body.admin-logged-in .page-left,
body.admin-logged-in .page-right {
    perspective: none !important;
    transform: none !important;
    animation: none !important;
    opacity: 1 !important;
    overflow: visible !important; /* CRITICAL: Allows dropdowns and fullscreen editor to escape */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.admin-logged-in .book-container {
    background: #fdfbf7 !important; /* Solid clean background for editing */
    box-shadow: 0 5px 25px rgba(0,0,0,0.1) !important;
    border: 1px solid #e0dbc9 !important;
}

body.admin-logged-in .page-right {
    background: #ffffff !important; /* Pure white background for the editor */
}

/* Specific fix for Summernote editor fullscreen mode and dropdowns */
body.admin-logged-in .note-editor.note-frame {
    background: #fff !important;
    border: 1px solid #ccc !important;
}

body.admin-logged-in .note-editor.note-frame.fullscreen {
    z-index: 1050 !important;
    background: #fff !important;
}

body.admin-logged-in .modal-backdrop {
    z-index: 1040 !important;
}