/*
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.2.4
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 – Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    width: 100%;
}
* { 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; word-wrap: break-word; }
a { text-decoration: none; color: var(--primary); }
ul { list-style: none; }
img, iframe, video, figure { max-width: 100%; height: auto; display: block; }

/* 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); }
/* Logo size control - DOUBLED SIZE */
.emr-logo svg {
    max-height: 180px !important;
    width: auto !important;
    height: auto !important;
    display: inline-block !important;
}

/* Mobile adjustments - Doubled size */
@media (max-width: 768px) {
    .emr-logo svg {
        max-height: 120px !important;
    }
}

/* Header & Nav */
.emr-header { background: var(--bg-white); box-shadow: var(--shadow-sm); position: relative; width: 100%; }
.emr-header-inner { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 10px 20px; width: 100%; }
.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);
}
.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: #1e293b; color: #ffffff; padding: 10px 16px; margin: 15px auto; border-radius: 12px; max-width: 480px; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); border: 1px solid #334155; }
#pwa-install-banner.is-visible { display: flex; animation: slideDown 0.4s ease-out forwards; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-15px); } to { opacity: 1; transform: translateY(0); } }
.pwa-banner-text { display: flex; flex-direction: column; flex: 1; text-align: left; gap: 2px; }
#pwa-install-banner p { font-size: 15px; font-weight: 600; margin: 0; }
.pwa-install-count { font-size: 11px; font-weight: 400; opacity: 0.8; display: flex; align-items: center; gap: 4px; }
#app-install { background: #1a73e8; color: #ffffff; border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; flex-shrink: 0; }
#app-install:hover { background: #1557b0; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }

/* Layout Grid – prevent overflow */
.emr-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    width: 100%;
}
.emr-main {
    background: var(--bg-white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    overflow: hidden;          /* clips any accidental overflow */
    word-wrap: break-word;
    word-break: break-word;
    width: 100%;
}
.emr-sidebar {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
    width: 100%;
}

/* Sidebar Widgets */
.widget { margin-bottom: 25px; }
.widget-title { font-size: 18px; margin-bottom: 15px; border-bottom: 2px solid var(--primary); padding-bottom: 5px; }
.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: 24px; color: #28a745; font-weight: 700; border-bottom: 4px solid #28a745; 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; word-break: break-word; }
.entry-content p { margin-bottom: 1.2em; }
.entry-content > p:first-of-type { margin-top: 0; }
.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; }

/* ===== BEAUTIFUL HEADINGS ===== */
.entry-content h2 {
    background: #1565C0;
    color: #fff;
    padding: 12px 20px;
    border-left: 8px solid #FF6B00;
    border-radius: 0 8px 8px 0;
    display: inline-block;
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 8px rgba(21, 101, 192, 0.3);
}

.entry-content h3 {
    background: #2E7D32;
    color: #fff;
    padding: 10px 18px;
    border-left: 6px solid #FFB300;
    border-radius: 0 6px 6px 0;
    display: inline-block;
    margin-top: 1.5em;
    margin-bottom: 0.6em;
    font-size: 22px;
    font-weight: 600;
    box-shadow: 0 3px 6px rgba(46, 125, 50, 0.25);
}

.entry-content h4 {
    padding: 8px 16px;
    border-left: 6px solid #26A69A;
    border-radius: 0 6px 6px 0;
    display: inline-block;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(106, 27, 154, 0.2);
}

/* ===== POST TAGS ===== */
.post-tags {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.post-tags .tag-label {
    font-weight: 700;
    color: var(--primary-dark);
    margin-right: 5px;
    font-size: 15px;
}
.post-tags a {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.post-tags a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ===== RELATED POSTS ===== */
.related-posts {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 3px solid var(--primary);
}
.related-posts h3 {
    font-size: 26px;
    margin-bottom: 25px;
    color: var(--primary-dark);
    background: none;
    color: #1a1a2e;
    border: none;
    padding: 0;
    display: block;
}
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.related-post-card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}
.related-post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}
.related-post-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}
.related-post-card .card-body {
    padding: 15px;
}
.related-post-card h4 {
    font-size: 16px;
    margin: 0 0 8px 0;
    line-height: 1.3;
    background: none;
    color: var(--text-primary);
    padding: 0;
    border: none;
    display: block;
}
.related-post-card h4 a {
    color: var(--primary-dark);
    text-decoration: none;
}
.related-post-card h4 a:hover {
    color: var(--primary);
}
.related-post-card .excerpt {
    font-size: 14px;
    color: #555;
    margin: 0;
    line-height: 1.5;
}
@media (max-width: 992px) {
    .related-posts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .related-posts-grid { grid-template-columns: 1fr; }
}

/* ===== BEAUTIFUL COMMENT FORM ===== */
#comments { margin-top: 40px; padding-top: 20px; border-top: 2px solid var(--border-light); }
.comment-reply-title { font-size: 24px; margin-bottom: 20px; color: var(--primary-dark); }
.comment-respond { background: var(--bg-light); padding: 25px; border-radius: 8px; box-shadow: var(--shadow-sm); }
.comment-form { display: flex; flex-direction: column; gap: 15px; }
.comment-form p { margin: 0; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 16px;
    background: #fff;
    transition: border-color 0.3s;
}
.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}
.comment-form textarea { min-height: 120px; resize: vertical; }
.comment-form .form-submit input[type="submit"] {
    background: var(--primary-gradient);
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.comment-form .form-submit input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
}
.comment-list { list-style: none; padding: 0; }
.comment-list .comment { background: #fff; padding: 20px; margin-bottom: 15px; border-radius: 8px; border: 1px solid var(--border-light); }
.comment-list .comment .comment-author { font-weight: bold; }
.comment-list .comment .comment-meta { font-size: 13px; color: #666; }
.comment-list .comment .reply a { color: var(--primary); font-weight: 600; text-decoration: underline; }

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .emr-container { grid-template-columns: 1fr; }
    .emr-main { padding: 20px 15px; }
    
    .emr-top-bar { justify-content: center; text-align: center; flex-direction: column; gap: 10px; }
    
    .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; }
    
    .emr-logo img { height: 40px; }
    
    .entry-content table { display: block; overflow-x: auto; white-space: nowrap; }
}
/* 6. Native Social Sharing Styles */
.emr-social-share {
    margin: 30px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
}
.share-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}
.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none !important;
}
.share-btn:hover {
    transform: translateY(-3px);
    color: #fff !important;
}
.share-fb { background-color: #1877f2; box-shadow: 0 4px 10px rgba(24, 119, 242, 0.3); }
.share-x { background-color: #000000; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); }
.share-wa { background-color: #25d366; box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3); }
.share-tg { background-color: #229ED9; box-shadow: 0 4px 10px rgba(34, 158, 217, 0.3); }

@media (max-width: 600px) {
    .emr-social-share {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
