/**
 * ====================================================================
 * THEME: EMERALD MADRASAH (Bright Vibrant Header & 3D Depth Navbar)
 * Framework: Bootstrap 5.3+ & Modern CSS Custom Properties
 * ====================================================================
 */

:root {
    --theme-primary: #059669;
    --theme-primary-dark: #047857;
    --theme-primary-light: #ecfdf5;
    --theme-accent: #d97706;
    --theme-accent-hover: #b45309;
    --theme-secondary: #064e3b;
    --theme-header-bg: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    --theme-navbar-bg: linear-gradient(180deg, #063929 0%, #022218 100%);
    --theme-navbar-border-top: rgba(52, 211, 153, 0.45);
    --theme-navbar-active: linear-gradient(180deg, #059669 0%, #047857 100%);
    --theme-navbar-active-shadow: 0 3px 8px rgba(5, 150, 105, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    --theme-gradient: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    --theme-gradient-subtle: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
    --theme-body-bg: #f8fafc;
    --theme-card-bg: #ffffff;
    --theme-text-main: #1e293b;
    --theme-text-muted: #64748b;
    --theme-border: #e2e8f0;
    --theme-border-accent: rgba(5, 150, 105, 0.2);
    --theme-radius-sm: 8px;
    --theme-radius-md: 14px;
    --theme-radius-lg: 20px;
    --theme-shadow-sm: 0 2px 8px rgba(6, 78, 59, 0.04);
    --theme-shadow-md: 0 8px 24px -4px rgba(6, 78, 59, 0.08), 0 4px 8px -2px rgba(6, 78, 59, 0.03);
    --theme-shadow-lg: 0 16px 36px -6px rgba(6, 78, 59, 0.12), 0 6px 12px -2px rgba(6, 78, 59, 0.04);
    --theme-shadow-hover: 0 20px 40px -8px rgba(5, 150, 105, 0.2);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--theme-body-bg);
    color: var(--theme-text-main);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--theme-primary);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover { color: var(--theme-primary-dark); }

/* ======================================================= */
/* BARIS 1: THEME HEADER BRANDING (PUTIH BERSIH & ELEGAN)  */
/* ======================================================= */
.theme-header-bar {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.theme-header-bar::after {
    display: none;
}

.header-logo-img {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
    transition: transform 0.3s ease;
}

.header-logo-img:hover {
    transform: scale(1.06);
}

.header-brand-title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #0f172a;
    line-height: 1.2;
    text-transform: uppercase;
}

.header-brand-tagline {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* ======================================================= */
/* BARIS 2: THEME NAVBAR (3D DEPTH BACKGROUND & BEVELS)    */
/* ======================================================= */
.theme-navbar {
    background: var(--theme-navbar-bg);
    border-top: 1px solid var(--theme-navbar-border-top);
    border-bottom: 2px solid #000000;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -2px 0 rgba(0, 0, 0, 0.6);
    z-index: 1030;
    position: relative;
}

.theme-navbar .nav-link {
    font-size: 12.5px;
    font-weight: 700;
    color: #f8fafc !important;
    padding: 13px 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: 6px;
    margin: 4px 1px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    border: 1px solid transparent;
}

.theme-navbar .nav-link:hover,
.theme-navbar .nav-link:focus,
.theme-navbar .nav-item.show .nav-link {
    background: var(--theme-navbar-active);
    color: #ffffff !important;
    box-shadow: var(--theme-navbar-active-shadow);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.theme-navbar .nav-item.active .nav-link,
.theme-navbar .nav-link.active {
    background: var(--theme-navbar-active);
    color: #ffffff !important;
    box-shadow: var(--theme-navbar-active-shadow);
    border: 1px solid rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.nav-search-btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.nav-search-btn:hover {
    background: var(--theme-navbar-active);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: var(--theme-navbar-active-shadow);
    transform: translateY(-1px);
}

.theme-offcanvas-header {
    background: var(--theme-header-bg);
}

.dropdown-menu {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-md);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    padding: 8px;
    background: #ffffff;
    font-size: 13px;
    min-width: 220px;
    animation: fadeInMenu 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--theme-radius-sm);
    color: var(--theme-text-main);
    transition: all 0.15s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--theme-primary-light);
    color: var(--theme-primary-dark);
    transform: translateX(3px);
}

@media (min-width: 992px) {
    .dropdown-submenu { position: relative; }
    .dropdown-submenu > .dropdown-menu {
        top: 0;
        left: 100%;
        margin-top: -8px;
        margin-left: 2px;
        display: none;
    }
    .dropdown-submenu:hover > .dropdown-menu { display: block; }
}

.hero-slider-wrap {
    border-radius: var(--theme-radius-lg);
    overflow: hidden;
    box-shadow: var(--theme-shadow-md);
    margin-bottom: 28px;
    border: 1px solid var(--theme-border);
}

.hero-slider-wrap .carousel-item {
    height: 420px;
    background-color: #064e3b;
}

.hero-slider-wrap .carousel-item img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.hero-slider-caption {
    background: linear-gradient(180deg, rgba(2, 44, 34, 0) 0%, rgba(2, 44, 34, 0.85) 70%, rgba(2, 44, 34, 0.95) 100%);
    padding: 40px 30px 24px 30px;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: left;
}

.hero-slider-caption p {
    font-size: 14px;
    color: #e2e8f0;
    margin: 0;
}

.headmaster-speech-card {
    background: #ffffff;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-lg);
    box-shadow: var(--theme-shadow-md);
    padding: 24px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.headmaster-speech-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--theme-gradient);
}

.headmaster-speech-card:hover { box-shadow: var(--theme-shadow-hover); }

.headmaster-photo-wrap {
    position: relative;
    display: inline-block;
    border-radius: var(--theme-radius-md);
    padding: 5px;
    background: var(--theme-gradient);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.2);
}

.headmaster-photo-wrap img {
    border-radius: calc(var(--theme-radius-md) - 4px);
    width: 130px;
    height: 165px;
    object-fit: cover;
    display: block;
    background: #e2e8f0;
}

.headmaster-badge {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--theme-accent);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(217, 119, 6, 0.35);
}

.speech-quote-box {
    position: relative;
    background: var(--theme-gradient-subtle);
    border: 1px solid var(--theme-border-accent);
    border-radius: var(--theme-radius-md);
    padding: 18px 22px;
}

.speech-quote-box .quote-icon {
    font-size: 28px;
    color: var(--theme-primary);
    opacity: 0.25;
    line-height: 1;
    margin-bottom: -8px;
}

.quick-action-card {
    background: #ffffff;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--theme-shadow-sm);
    transition: all 0.25s ease;
    text-decoration: none;
    color: var(--theme-text-main);
    height: 100%;
}

.quick-action-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--theme-shadow-md);
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

.quick-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--theme-primary-light);
    color: var(--theme-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.quick-action-card:hover .quick-action-icon {
    background: var(--theme-primary);
    color: #ffffff;
    transform: scale(1.06);
}

.section-title-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--theme-border);
    position: relative;
}

.section-title-wrap::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--theme-primary);
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--theme-secondary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-card {
    background: #ffffff;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-md);
    overflow: hidden;
    box-shadow: var(--theme-shadow-sm);
    margin-bottom: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--theme-shadow-md);
    border-color: var(--theme-border-accent);
}

.post-thumb-wrap {
    position: relative;
    overflow: hidden;
    height: 180px;
    background: #022c22;
}

.post-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-thumb-img { transform: scale(1.06); }

.post-badge-cat {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(6, 78, 59, 0.85);
    backdrop-filter: blur(6px);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}

.post-card-body { padding: 16px; }

.post-card-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
}

.post-card-title a { color: var(--theme-text-main); }
.post-card-title a:hover { color: var(--theme-primary); }

.post-card-meta {
    font-size: 11.5px;
    color: var(--theme-text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--theme-border);
}

.sidebar-widget {
    background: #ffffff;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-md);
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: var(--theme-shadow-sm);
}

.widget-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--theme-secondary);
    margin-bottom: 14px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--theme-border);
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 35px;
    height: 2px;
    background: var(--theme-primary);
}

.btn-theme-primary {
    background: var(--theme-primary);
    color: #ffffff;
    font-weight: 600;
    border-radius: var(--theme-radius-sm);
    padding: 7px 16px;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.btn-theme-primary:hover {
    background: var(--theme-primary-dark);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.3);
}

.site-footer {
    background: #022c22;
    color: #94a3b8;
    padding: 46px 0 20px 0;
    margin-top: 50px;
    font-size: 13px;
    border-top: 3px solid var(--theme-primary);
}

.footer-brand {
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 10px;
}

.footer-heading {
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li { margin-bottom: 8px; }

.footer-links a {
    color: #94a3b8;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #34d399;
    padding-left: 4px;
}

.footer-bottom {
    margin-top: 36px;
    padding-top: 18px;
    border-top: 1px solid #064e3b;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 991.98px) {
    .header-brand-title { font-size: 16px; }
    .header-brand-tagline { font-size: 11px; }
    .hero-slider-wrap .carousel-item { height: 240px; }
    .headmaster-speech-card { padding: 18px; }
    .headmaster-photo-wrap { margin-bottom: 12px; }
}


/* LIGHTBOX ZOOM */
/* TOPIK KHUSUS AUTO LANDSCAPE & PORTRAIT */
.topic-photo-wrap {
    position: relative;
    display: block;
    background: #f8fafc;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.topic-photo-wrap.topic-landscape {
    width: 100% !important;
    max-width: 100% !important;
}

.topic-photo-wrap.topic-portrait {
    max-width: 150px !important;
    margin: 0 auto !important;
}

.image-popup-zoom {
    position: relative;
    display: block;
    cursor: zoom-in;
    overflow: hidden;
    border-radius: calc(var(--theme-radius-md, 12px) - 4px);
}
.image-popup-zoom:hover img {
    transform: scale(1.06);
}
.image-zoom-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    color: #ffffff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0.85;
    transition: all 0.25s ease;
    z-index: 5;
}
.image-popup-zoom:hover .image-zoom-overlay {
    opacity: 1;
    transform: scale(1.15);
    background: var(--theme-primary, #0284c7);
}

/* ======================================================= */
/* MODERN DYNAMIC ENHANCEMENTS & GLASSMORPHISM              */
/* ======================================================= */

/* Reading Scroll Progress Bar */
#scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3.5px;
    background: linear-gradient(90deg, #10b981 0%, #34d399 50%, #fbbf24 100%);
    width: 0%;
    z-index: 9999;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
    transition: width 0.1s linear;
}

/* Glassmorphism Sticky Navbar Blur */
.theme-navbar.sticky-top {
    background: rgba(4, 40, 28, 0.92) !important;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    transition: all 0.3s ease;
}

/* Enhanced Post Cards Elevation & Micro-Animations */
.post-card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease !important;
}

.post-card:hover {
    transform: translateY(-6px) scale(1.01) !important;
    box-shadow: 0 20px 30px -10px rgba(5, 150, 105, 0.18), 0 8px 12px -4px rgba(0, 0, 0, 0.05) !important;
}

.post-thumb-img {
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.post-card:hover .post-thumb-img {
    transform: scale(1.08) rotate(0.5deg) !important;
}

/* Quick Action Card Hover */
.quick-action-card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, background-color 0.3s ease !important;
}

.quick-action-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 24px -6px rgba(5, 150, 105, 0.2) !important;
}

/* Floating Back to Top Button */
#backToTopBtn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    border: none;
    outline: none;
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 9998;
}

#backToTopBtn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

#backToTopBtn:hover {
    transform: translateY(-4px) scale(1.1);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 12px 28px rgba(5, 150, 105, 0.5);
}

/* Live Search Modal Preview Styles */
.live-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.live-search-item:hover {
    background-color: #f1f5f9;
    transform: translateX(4px);
    color: #059669;
}

.live-search-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Shimmer Loading Skeleton Effect */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-box {
    display: inline-block;
    height: 1em;
    position: relative;
    overflow: hidden;
    background-color: #e2e8f0;
    background-image: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

/* Post Content & Sub-Profile Typography Styling */
.post-content-body h1, 
.post-content-body h2, 
.post-content-body h3, 
.post-content-body h4 {
    color: #0f172a;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.post-content-body h2 {
    font-size: 1.35rem;
    border-left: 4px solid var(--theme-primary);
    padding-left: 12px;
}

.post-content-body h3 {
    font-size: 1.15rem;
}

.post-content-body p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.post-content-body ul, 
.post-content-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.post-content-body li {
    margin-bottom: 0.35rem;
    line-height: 1.6;
}

.post-content-body table {
    width: 100% !important;
    margin: 1.25rem 0;
    font-size: 13.5px;
}

.post-content-body table th {
    background-color: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.03em;
    padding: 10px 12px;
}

.post-content-body table td {
    padding: 10px 12px;
    vertical-align: middle;
}

.post-content-body blockquote {
    border-left: 4px solid var(--theme-primary);
    background-color: #f8fafc;
    padding: 12px 18px;
    margin: 1.25rem 0;
    border-radius: 0 10px 10px 0;
    font-style: italic;
    color: #475569;
}
