/* ============================================================================
   NAV BHARAT MIRROR - MASTER ENHANCEMENT STYLES
   INTEGRATED: Phases 1-5 (Reader, Voice, Analysis, User Tools, Mobile)
   FIXED: Highlighters visible on Desktop, strictly blocked in Sidebar.
   ============================================================================ */

:root {
    --enh-primary: #e63946;
    --enh-panel-bg: #ffffff;
    --enh-text: #212529;
    --enh-border: #dee2e6;
    --enh-shadow: rgba(0, 0, 0, 0.15);
}

/* --- CORE DARK MODE LOGIC --- */
body.enh-dark-mode {
    --enh-panel-bg: #1a1a1a;
    --enh-text: #f8f9fa;
    --enh-border: #333;
    --enh-shadow: rgba(0, 0, 0, 0.5);
    background-color: #121212 !important;
}

body.enh-dark-mode p, 
body.enh-dark-mode h1, 
body.enh-dark-mode h2, 
body.enh-dark-mode h3,
body.enh-dark-mode div:not(.enh-stats-bar):not(.enh-modal-content),
body.enh-dark-mode .sidebar-panel,
body.enh-dark-mode .sidebar-panel .card-header { 
    color: #f8f9fa !important; 
}

body.enh-dark-mode .sidebar-panel, 
body.enh-dark-mode .card,
body.enh-dark-mode .article-canvas {
    background-color: #1a1a1a !important;
    border-color: #333 !important;
}

/* --- THREE-PANEL SIDEBAR STYLES --- */
.left-sidebar-container {
    position: sticky;
    top: 100px;
}

.sidebar-panel {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
    border: 1px solid var(--enh-border);
}

.sidebar-panel .card-header {
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-panel .card-header h5 {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.sidebar-thumb {
    height: 140px;
    object-fit: cover;
    transition: transform 0.3s;
}

.sidebar-feature-item:hover .sidebar-thumb { 
    transform: scale(1.05); 
}

.rank-num {
    font-size: 1.2rem;
    min-width: 25px;
}

.recent-thumb-small {
    background-position: center;
    flex-shrink: 0;
}

/* --- JUMP-TO NAVIGATION (SEC 4) --- */
#enh-jump-menu {
    background: var(--enh-panel-bg);
    border: 1px solid var(--enh-border);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
}
#enh-jump-menu h6 { font-weight: 700; text-transform: uppercase; font-size: 0.8rem; color: #888; margin-bottom: 10px; }
#enh-jump-menu ul { list-style: none; padding: 0; margin: 0; }
#enh-jump-menu li { margin-bottom: 8px; border-bottom: 1px dashed var(--enh-border); padding-bottom: 4px; }
#enh-jump-menu a { text-decoration: none; color: var(--enh-primary); font-size: 0.95rem; font-weight: 600; transition: 0.2s; }
#enh-jump-menu a:hover { padding-left: 5px; color: #000; }

/* --- ANALYTICS & PROGRESS (SEC 4) --- */
#enh-progress-wrap { position: fixed; top: 0; left: 0; width: 100%; height: 5px; z-index: 1000000; }
#enh-progress-fill { height: 100%; width: 0%; background: var(--enh-primary); transition: width 0.1s; }

#enh-completion-badge {
    position: fixed;
    bottom: 100px;
    right: 25px;
    background: #28a745;
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    display: none;
    z-index: 9999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.enh-return-prompt {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--enh-panel-bg);
    border: 2px solid var(--enh-primary);
    padding: 12px 25px;
    border-radius: 50px;
    z-index: 1000002;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 15px;
}

/* --- TOOLBAR & FAB --- */
#enh-toolbar-container {
    position: fixed !important;
    bottom: 25px !important;
    right: 25px !important;
    z-index: 999999 !important;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 15px;
}

.enh-fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--enh-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.enh-fab-main:hover { 
    transform: scale(1.05); 
}

#enh-tools-panel {
    display: none; 
    flex-direction: column;
    gap: 15px;
    background: var(--enh-panel-bg);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid var(--enh-border);
    box-shadow: 0 8px 32px var(--enh-shadow);
    width: 280px;
}

.enh-tool-section { 
    border-bottom: 1px solid var(--enh-border); 
    padding-bottom: 12px; 
}

.enh-tool-section:last-child {
    border-bottom: none;
}

.enh-label { 
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase; 
    color: #888; 
    display: block; 
    margin-bottom: 8px; 
}

.enh-btn-group { 
    display: flex; 
    gap: 8px; 
}

.enh-btn-group button { 
    flex: 1; 
    padding: 8px; 
    font-size: 13px; 
    cursor: pointer; 
    border: 1px solid var(--enh-border); 
    background: transparent; 
    color: var(--enh-text); 
    border-radius: 6px; 
    transition: all 0.2s;
}

.enh-btn-group button:hover {
    background: var(--enh-primary);
    color: white;
    border-color: var(--enh-primary);
}

/* --- CATEGORY HIGHLIGHTERS --- */
.news-card, .card, .featured-image-container {
    position: relative !important;
}

/* FIXED: Overlap prevention logic for card layout */
.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-card .card-body h5 {
    height: 3em; 
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    margin-bottom: 10px;
}

.enh-category-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--enh-primary);
    color: #fff !important;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: none;
}

/* --- STRICT BLOCKER: PREVENT HIGHLIGHTERS & TAGS IN SIDEBAR --- */
aside .enh-category-tag, 
.sidebar-wrapper .enh-category-tag,
.sidebar-sticky .enh-category-tag,
.sidebar-item-container .enh-category-tag,
aside .enh-subcategory-tag,
.sidebar-wrapper .enh-subcategory-tag {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* --- SIDEBAR WIDGET SPECIFIC STYLES --- */
.news-card-sidebar:hover .recent-thumb-small {
    transform: scale(1.05);
}
.sidebar-text-wrap a:hover {
    color: var(--enh-primary) !important;
}

/* --- ARTICLE TYPOGRAPHY & MS-ALIGNMENT --- */
.article-canvas {
    background: #fff;
    padding: 10px;
}

.article-body-text {
    text-align: justify !important;
    hyphens: auto;
    line-height: 1.85;
}

.ms-article-header { 
    text-align: left !important; 
    margin-top: 2.5rem; 
    margin-bottom: 1.2rem; 
    font-weight: 800; 
    color: #1d3557; 
    border-bottom: 2px solid #eee; 
    padding-bottom: 8px;
}

.ms-article-ul { 
    margin-bottom: 2rem; 
    padding-left: 1.5rem; 
    text-align: left; 
}

.ms-article-li { 
    margin-bottom: 0.8rem; 
    line-height: 1.6; 
}

.enh-reading-highlight {
    background-color: rgba(230, 57, 70, 0.1);
    border-radius: 4px;
    border-left: 3px solid var(--enh-primary);
    padding-left: 5px;
}

/* --- SECTION 4: USER TOOL MODALS --- */
.enh-modal {
    position: fixed;
    z-index: 1000001;
    left: 0; 
    top: 0;
    width: 100%; 
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: none; 
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.enh-modal-content {
    background-color: var(--enh-panel-bg);
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    color: var(--enh-text);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

/* --- FOCUS MODE --- */
body.enh-focus-active {
    background-color: #ffffff !important;
}

body.enh-focus-active .container {
    max-width: 100% !important;
    padding: 0 10% !important;
}

body.enh-focus-active .left-sidebar-container {
    display: none !important;
}

/* --- ANALYSIS STYLES --- */
#enh-summary-box {
    display: none;
    background: #fff9db;
    border: 1px solid #fab005;
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #212529;
}

body.enh-dark-mode #enh-summary-box {
    background: #332b00;
    border-color: #fab005;
    color: #fff;
}

.enh-hl-person { background-color: #ffadad !important; color: #000 !important; padding: 0 2px; border-radius: 3px; }
.enh-hl-date { background-color: #caffbf !important; color: #000 !important; padding: 0 2px; border-radius: 3px; }

/* --- MOBILE RESPONSIVENESS (SEC 5) --- */
@media (max-width: 991.98px) {
    #enh-tools-panel {
        width: 240px;
        right: 10px;
    }
    
    .article-body-text {
        text-align: left !important;
    }
    
    body.enh-focus-active .container {
        padding: 0 15px !important;
    }

    .left-sidebar-container {
        display: none !important;
    }

    #enh-offline-status { display: none; background: #6c757d; color: white; text-align: center; font-size: 12px; padding: 5px 0; font-weight: bold; }
}
