/* ============================================
   GHURY ENCYCLOPEDIA — MODERN ACADEMIC DESIGN SYSTEM
   1% Side Margin & Soft Grey-White Shadow Theme
   ============================================ */

:root {
    --walls-side-margin: 1%;
    --ency-side-margin: 1%;
    --ency-bg: #f8fafc;
    --ency-card-bg: #ffffff;
    --ency-border: #e2e8f0;
    --ency-border-hover: #cbd5e1;
    --ency-text-main: #0f172a;
    --ency-text-muted: #475569;
    --ency-text-subtle: #64748b;
    --ency-primary: #3b82f6;
    --ency-primary-hover: #2563eb;
    --ency-primary-light: #eff6ff;
    --ency-accent: #8b5cf6;
    --ency-success: #10b981;
    --ency-warning: #f59e0b;
    --ency-radius-lg: 16px;
    --ency-radius-md: 12px;
    --ency-radius-sm: 8px;
    --ency-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --ency-shadow-md: 0 2px 10px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    --ency-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.07), 0 2px 8px rgba(0, 0, 0, 0.03);
    --ency-font-family: 'Noto Sans Bengali', 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --ency-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    :root {
        --walls-side-margin: 0%;
        --ency-side-margin: 0%;
    }
}

body {
    background-color: var(--ency-bg);
    color: var(--ency-text-main);
    font-family: var(--ency-font-family);
}

.walls-container,
.ency-container {
    width: calc(100% - (var(--walls-side-margin, 1%) * 2)) !important;
    max-width: 100% !important;
    margin-left: var(--walls-side-margin, 1%) !important;
    margin-right: var(--walls-side-margin, 1%) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

.walls-grid,
.ency-grid {
    display: grid;
    grid-template-columns: var(--walls-sidebar-width, 280px) 1fr;
    gap: var(--walls-gap, 20px);
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 10px 0 !important;
    box-sizing: border-box !important;
}

/* Direct root fallback if used without .walls-container */
main.main-content > .walls-grid,
main.main-content > .ency-grid {
    width: calc(100% - (var(--walls-side-margin, 1%) * 2)) !important;
    margin-left: var(--walls-side-margin, 1%) !important;
    margin-right: var(--walls-side-margin, 1%) !important;
}

.walls-container > .walls-grid,
.walls-container > .ency-grid,
.ency-container > .walls-grid,
.ency-container > .ency-grid {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Encyclopedia Sidebar - Non-sticky (scrolls naturally with page) */
.walls-sidebar,
.ency-sidebar,
.walls-grid .walls-sidebar {
    position: static !important;
    top: auto !important;
    height: auto !important;
    align-self: start;
}


/* ============================================
   HERO KNOWLEDGE HEADER
   ============================================ */
.ency-hero-section {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #1e293b 100%);
    border-radius: var(--ency-radius-lg);
    padding: 40px 32px;
    color: #ffffff;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ency-hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
}

.ency-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.ency-hero-title {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ency-hero-subtitle {
    font-size: 1.05rem;
    color: #94a3b8;
    max-width: 680px;
    line-height: 1.6;
    margin-bottom: 28px;
}

/* Hero Search Bar */
.ency-hero-search {
    position: relative;
    max-width: 650px;
}

.ency-search-form {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 50px;
    padding: 6px 6px 6px 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transition: var(--ency-transition);
}

.ency-search-form:focus-within {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4), 0 8px 25px rgba(0, 0, 0, 0.3);
}

.ency-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #0f172a;
    background: transparent;
    font-weight: 500;
}

.ency-search-button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--ency-transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ency-search-button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
}

/* Quick Topic Pills */
.ency-quick-topics {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.topic-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50px;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--ency-transition);
}

.topic-tag:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Stats Ticker */
.ency-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--ency-card-bg);
    border: 1px solid var(--ency-border);
    border-radius: var(--ency-radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--ency-shadow-sm);
    transition: var(--ency-transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ency-shadow-md);
    border-color: var(--ency-primary-light);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--ency-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--ency-primary-light);
    color: var(--ency-primary);
}

.stat-info h4 {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0;
    color: var(--ency-text-main);
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--ency-text-subtle);
    margin: 2px 0 0 0;
    font-weight: 600;
}

/* ============================================
   ACADEMIC TOOLBAR & STUDY CONTROLS
   ============================================ */
.ency-study-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ency-card-bg);
    border: 1px solid var(--ency-border);
    border-radius: var(--ency-radius-md);
    padding: 12px 20px;
    margin-bottom: 24px;
    box-shadow: var(--ency-shadow-sm);
    flex-wrap: wrap;
    gap: 12px;
}

.study-nav-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.study-tab-btn {
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ency-text-muted);
    text-decoration: none;
    transition: var(--ency-transition);
    border: 1px solid transparent;
}

.study-tab-btn:hover {
    color: var(--ency-primary);
    background: var(--ency-primary-light);
}

.study-tab-btn.active {
    background: var(--ency-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

/* ============================================
   ARTICLE CARDS (ACADEMIC FEED)
   ============================================ */
.ency-post-card {
    background: var(--ency-card-bg);
    border: 1px solid var(--ency-border);
    border-radius: var(--ency-radius-lg);
    box-shadow: var(--ency-shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--ency-transition);
    cursor: pointer;
}

.ency-post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ency-shadow-hover);
    border-color: rgba(59, 130, 246, 0.3);
}

.ency-post-body {
    padding: 24px;
}

.ency-post-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ency-category-badge {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 50px;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.ency-read-time {
    font-size: 0.8rem;
    color: var(--ency-text-subtle);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ency-post-title {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 12px;
}

.ency-post-title a {
    color: var(--ency-text-main);
    text-decoration: none;
    transition: var(--ency-transition);
}

.ency-post-title a:hover {
    color: var(--ency-primary);
}

.ency-post-summary-link {
    color: var(--ency-text-muted);
    text-decoration: none;
    display: block;
    transition: var(--ency-transition);
}

.ency-post-summary-link:hover {
    color: var(--ency-text-main);
}

.ency-post-summary {
    color: inherit;
    font-size: 0.96rem;
    line-height: 1.65;
    margin-bottom: 0;
    text-align: justify;
    text-justify: inter-word;
    text-align-last: left;
}

.ency-detail-content {
    font-size: 1.08rem;
    line-height: 1.85;
    color: var(--ency-text-main, #0f172a);
    text-align: justify;
    text-justify: inter-word;
    text-align-last: left;
    word-break: break-word;
}

.ency-detail-content p,
.ency-detail-content div,
.ency-detail-content li {
    margin-bottom: 1.25rem;
    text-align: justify;
    text-justify: inter-word;
    text-align-last: left;
}

.entry-summary {
    text-align: justify;
    text-justify: inter-word;
    text-align-last: left;
}

.ency-post-image {
    width: 100%;
    max-height: 360px;
    overflow: hidden;
    background: #f1f5f9;
}

.ency-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.ency-post-card:hover .ency-post-image img {
    transform: scale(1.03);
}

.ency-post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--ency-border);
    flex-wrap: wrap;
    gap: 12px;
}

.ency-author-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ency-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.ency-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.ency-author-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--ency-text-main);
    text-decoration: none;
}

.ency-author-name:hover {
    color: var(--ency-primary);
}

.ency-author-sub {
    font-size: 0.78rem;
    color: var(--ency-text-subtle);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.ency-read-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border-radius: 50px;
    font-weight: 700;
    padding: 8px 22px;
    text-decoration: none;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transition: var(--ency-transition);
}

.ency-read-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
    color: #ffffff;
}

/* ============================================
   RIGHT ACADEMIC SIDEBAR & CATEGORY EXPLORER
   ============================================ */
.ency-side-card {
    background: var(--ency-card-bg);
    border: 1px solid var(--ency-border);
    border-radius: var(--ency-radius-lg);
    box-shadow: var(--ency-shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.ency-side-card-header {
    padding: 20px;
    border-bottom: 1px solid var(--ency-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ency-side-card-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
    color: var(--ency-text-main);
}

.category-item-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--ency-radius-sm);
    text-decoration: none;
    color: var(--ency-text-main);
    transition: var(--ency-transition);
}

.category-item-link:hover {
    background: var(--ency-primary-light);
    color: var(--ency-primary);
}

.category-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--ency-primary-light);
    color: var(--ency-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--ency-transition);
}

.category-item-link:hover .category-icon-box {
    background: var(--ency-primary);
    color: #ffffff;
}

.category-badge-count {
    background: var(--ency-bg);
    border: 1px solid var(--ency-border);
    color: var(--ency-text-subtle);
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ===================================================
   Sidebar Card & Category Styles (Identical to /walls/)
   =================================================== */
.sidebar-card {
    background: var(--walls-sidebar-bg, #ffffff) !important;
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--walls-card-shadow, 0 2px 10px rgba(0, 0, 0, 0.04));
    border: 1px solid var(--walls-border, #e2e8f0);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.sidebar-card .sidebar-header {
    text-align: center;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--walls-border-light, #f1f5f9);
    margin-bottom: 18px;
    display: block;
}

.sidebar-card .sidebar-icon {
    width: 56px;
    height: 56px;
    background: var(--sidebar-icon-bg, linear-gradient(135deg, #e0e7ff, #ede9fe));
    border: 1px solid var(--walls-border, #e2e8f0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.sidebar-card .sidebar-icon i {
    font-size: 1.8rem;
    color: var(--sidebar-icon-color, #4f46e5);
}

.sidebar-card .sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--walls-text-main, #1e293b);
    margin: 0;
    text-align: center;
}

.sidebar-categories {
    display: flex;
    flex-direction: column;
}

.sidebar-cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--walls-text-secondary, #475569);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.sidebar-cat-link:hover {
    background: var(--walls-border-light, #f8fafc);
    color: #4f46e5;
}

.sidebar-cat-link.active {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    font-weight: 600;
}

.cat-count {
    background: var(--walls-border-light, rgba(0,0,0,0.06));
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--walls-text-muted, #64748b);
}

.sidebar-cat-link.active .cat-count {
    background: rgba(79, 70, 229, 0.15);
    color: #4f46e5;
}

/* Dark mode overrides */
[data-theme="dark"] .sidebar-card {
    background: var(--walls-sidebar-bg, #131c2e) !important;
    border-color: var(--walls-border, #222f43);
}

[data-theme="dark"] .sidebar-card .sidebar-header {
    border-bottom-color: var(--walls-border-light, #1a2536);
}

[data-theme="dark"] .sidebar-card .sidebar-icon {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .sidebar-card .sidebar-icon i {
    color: #818cf8;
}

[data-theme="dark"] .sidebar-card .sidebar-title {
    color: var(--walls-text-main, #f8fafc);
}

[data-theme="dark"] .sidebar-cat-link {
    color: #cbd5e1;
}

[data-theme="dark"] .cat-count {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

[data-theme="dark"] .sidebar-cat-link.active .cat-count {
    background: rgba(99, 102, 241, 0.25);
    color: #818cf8;
}

/* Floating Action Button */
.floating-create-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
    z-index: 1000;
    text-decoration: none;
    transition: var(--ency-transition);
}

.floating-create-btn:hover {
    transform: scale(1.08) rotate(90deg);
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.45);
}
