/*
Theme Name: EduMehru
Theme URI: https://qsh.in
Description: A hyper-optimized, bespoke theme for UP Board. 100/100 Core Web Vitals.
Author: Mehraj
Version: 1.0.2
Text Domain: edumehru
*/

:root {
    --primary: #1a73e8; --primary-dark: #0d47a1; --primary-light: #e8f0fe;
    --primary-gradient: linear-gradient(135deg, #1a73e8, #0d47a1);
    --accent: #FF6B00; --accent-light: #fff5e6; --accent-dark: #e05a00;
    --text-primary: #1a1a2e; --text-light: #ffffff;
    --bg-light: #f8f9fa; --bg-white: #ffffff; --border-light: #e5e7eb;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05); --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

/* Base Reset & Global Responsiveness */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg-light); color: var(--text-primary); line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: var(--primary); }
ul { list-style: none; }
img, iframe, video, figure { max-width: 100% !important; height: auto !important; display: block; } /* Forces images to shrink on mobile */

/* Top Bar */
.emr-top-bar { background: var(--bg-light); border-bottom: 1px solid var(--border-light); padding: 10px 20px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.emr-top-cta { display: flex; align-items: center; gap: 8px; }
.emr-top-buttons { display: flex; gap: 10px; }
.emr-btn { padding: 6px 16px; border-radius: 50px; font-weight: bold; color: var(--text-light); background: var(--primary-gradient); transition: transform 0.2s; }
.emr-btn:hover { transform: translateY(-2px); color: #fff;}
.emr-btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.emr-btn-outline:hover { background: var(--primary); color: var(--text-light); }

/* Header & Nav */
.emr-header { background: var(--bg-white); box-shadow: var(--shadow-sm); position: relative; }
.emr-header-inner { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 10px 20px; }
.emr-logo img { height: 60px; width: auto; }
.emr-nav ul { display: flex; gap: 20px; }
.emr-nav a { 
    font-weight: bold; 
    color: #ffffff !important; 
    padding: 10px 18px; 
    border-radius: 6px; 
    display: inline-block;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    background: var(--primary); /* Default fallback */
}
.emr-nav li:nth-child(1n) a { background: #FF3366; box-shadow: 0 4px 12px rgba(255, 51, 102, 0.3); }
.emr-nav li:nth-child(2n) a { background: #20C997; box-shadow: 0 4px 12px rgba(32, 201, 151, 0.3); }
.emr-nav li:nth-child(3n) a { background: #845EF7; box-shadow: 0 4px 12px rgba(132, 94, 247, 0.3); }
.emr-nav li:nth-child(4n) a { background: #FF922B; box-shadow: 0 4px 12px rgba(255, 146, 43, 0.3); }
.emr-nav li:nth-child(5n) a { background: #339AF0; box-shadow: 0 4px 12px rgba(51, 154, 240, 0.3); }

.emr-nav a:hover { 
    transform: translateY(-3px) scale(1.05); 
    filter: brightness(1.1);
}
.emr-menu-toggle { display: none; background: none; border: none; cursor: pointer; }
.emr-menu-toggle svg { width: 28px; height: 28px; fill: var(--primary); }

/* PWA Banner */
#pwa-install-banner { display: none; background: var(--accent); color: var(--text-light); padding: 8px 16px; margin: 10px auto; border-radius: 6px; max-width: 500px; align-items: center; justify-content: center; gap: 10px; box-shadow: var(--shadow-md); }
#pwa-install-banner.is-visible { display: flex; animation: slideDown 0.4s ease-out forwards; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
#pwa-install-banner p { font-size: 14px; font-weight: bold; text-shadow: 0 1px 3px rgba(0,0,0,0.4); margin: 0; }
#pwa-install-button { background: var(--bg-white); color: var(--accent); border: none; border-radius: 4px; padding: 6px 16px; font-weight: bold; cursor: pointer; }

/* Layout Grid */
.emr-container { max-width: 1200px; margin: 20px auto; padding: 0 20px; display: grid; grid-template-columns: 1fr 300px; gap: 30px; }
.emr-main { background: var(--bg-white); padding: 30px; border-radius: 8px; box-shadow: var(--shadow-sm); min-width: 0; }
.emr-sidebar { background: var(--bg-white); padding: 20px; border-radius: 8px; box-shadow: var(--shadow-sm); height: fit-content; }

/* Sidebar Widgets */
.emr-sidebar ul { list-style: none; margin: 0; padding: 0; }
.emr-sidebar li { margin-bottom: 10px; border-bottom: 1px solid var(--border-light); padding-bottom: 8px; font-size: 15px; }

/* Entry Content (Typography) */
.entry-title { font-size: 28px; border-bottom: 4px solid var(--primary); padding-bottom: 10px; margin-bottom: 15px; line-height: 1.3; }
.entry-meta { font-size: 14px; background: var(--bg-light); padding: 10px; border-left: 4px solid var(--primary); margin-bottom: 20px; }
.entry-content { font-size: 18px; line-height: 1.8; word-wrap: break-word; overflow-wrap: break-word; }
.entry-content h2 { margin: 1.5em 0 0.5em; border-bottom: 2px solid var(--primary); display: inline-block; font-size: 24px; }
.entry-content h3 { margin: 1.5em 0 0.5em; color: var(--primary-dark); font-size: 20px; }
.entry-content p { margin-bottom: 1.2em; }
.entry-content ul, .entry-content ol { margin: 1em 0 1em 2em; }
.entry-content blockquote { background: var(--primary-light); padding: 15px; border-left: 5px solid var(--primary); font-style: italic; margin: 1.5em 0; border-radius: 0 8px 8px 0; }

/* Tables & Study Boxes */
.entry-content table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 16px; box-shadow: var(--shadow-sm); }
.entry-content th { background: #0a1a3a; color: #fff; padding: 12px; text-align: left; }
.entry-content td { padding: 12px; border-bottom: 1px solid var(--border-light); }
.entry-content tr:nth-child(even) td { background: var(--bg-light); }
div.study-chapter-box { background: var(--bg-light); border-left: 5px solid var(--primary); padding: 20px; margin-bottom: 20px; border-radius: 0 8px 8px 0; box-shadow: var(--shadow-sm); }
a.study-btn { display: inline-block; background: var(--primary); color: #fff; padding: 8px 16px; border-radius: 4px; font-weight: bold; }

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .emr-container { grid-template-columns: 1fr; }
    .emr-main { padding: 20px 15px; }
    
    /* Top Bar Mobile Wrap */
    .emr-top-bar { justify-content: center; text-align: center; flex-direction: column; gap: 10px; }
    
    /* Fix Mobile Menu Position */
    .emr-nav ul { display: none; flex-direction: column; width: 100%; position: absolute; top: 100%; left: 0; background: var(--bg-white); box-shadow: var(--shadow-md); padding: 20px; z-index: 1000; border-top: 1px solid var(--border-light); }
    .emr-nav ul.active { display: flex; }
    .emr-menu-toggle { display: block; }
    
    /* Decrease Logo Size on Mobile */
    .emr-logo img { height: 40px; }
    
    /* Make tables horizontally scrollable on mobile */
    .entry-content table { display: block; overflow-x: auto; white-space: nowrap; }
}