/**
 * Modern Redesign & Single Color System v4.0 (Unified Palette Edition)
 * Theme: Mading - MI Almaarif 02 Singosari (mia02sgs.sch.id)
 * 
 * DESIGN SYSTEM TOKENS:
 * - Single Canonical Green: #047857 (Forest Emerald)
 * - Green Accents: #065f46 (Deep), #059669 (Vibrant), #ecfdf5 (Soft Pill)
 * - Canvas: #f8fafc (Clean Slate Canvas)
 * - Cards: #ffffff with subtle 1px border #e2e8f0
 * - Text: #0f172a (Headings), #334155 (Body), #64748b (Muted)
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,600&display=swap');

:root {
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --color-primary: #047857;
    --color-primary-dark: #065f46;
    --color-primary-light: #059669;
    --color-primary-soft: #ecfdf5;
    --color-accent: #f59e0b;
    --color-dark: #0f172a;
    --color-body: #334155;
    --color-muted: #64748b;
    --color-border: #e2e8f0;
    --color-card-bg: #ffffff;
    --color-bg-soft: #f8fafc;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --shadow-card: 0 4px 14px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 16px 32px -4px rgba(0, 0, 0, 0.09), 0 6px 12px -2px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   1. GLOBAL TYPOGRAPHY & SMOOTHING
   ========================================================================== */

html, body {
    font-family: var(--font-sans) !important;
    color: var(--color-body) !important;
    background-color: var(--color-bg-soft) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.65;
}

body, button, input, select, textarea {
    font-family: var(--font-sans) !important;
}

h1, h2, h3, h4, h5, h6,
.mad__schoolname,
.title_news,
.mading_heads,
.mading_heading,
.agenda_heading,
.title_four,
.pres_head {
    font-family: var(--font-sans) !important;
    color: var(--color-dark) !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

/* ==========================================================================
   2. UNIFIED HEADER & TOPBAR (NO MORE MISMATCHED GREENS)
   ========================================================================== */

.layout_mading {
    padding: 104px 0 0 !important;
}

.mad__header {
    height: auto !important;
    max-height: 104px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border-bottom: 1px solid var(--color-border) !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.3s ease !important;
}

.mad__top {
    background: linear-gradient(90deg, #047857 0%, #065f46 100%) !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    height: 36px !important;
    line-height: 36px !important;
}

.mad__top .head_time,
.mad__top .head_phone,
.mad__top .head_mail {
    background: rgba(255, 255, 255, 0.16) !important;
    border-radius: 20px !important;
    color: #ffffff !important;
    font-size: 12px !important;
    height: 20px !important;
    line-height: 20px !important;
}

.mad__top a,
.mad__top span {
    color: #ffffff !important;
}

.mad__nav {
    height: 68px !important;
}

.mad__logo {
    height: 52px !important;
    padding: 8px 20px 8px 0 !important;
}

.mad__logo img {
    height: 50px !important;
    width: auto !important;
    object-fit: contain;
    transition: transform 0.2s ease;
}

/* Unified Menu & Search Buttons (Clean Neutral Card, Not Bright Green) */
.mad__menu,
.mad__search {
    background: #ffffff !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-primary) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.2s ease !important;
}

.mad__menu:hover,
.mad__search:hover {
    background: var(--color-primary-soft) !important;
    border-color: var(--color-primary) !important;
    color: var(--color-primary) !important;
}

.mad__menu i,
.mad__search i {
    color: var(--color-primary) !important;
}

.newul > li > a {
    font-family: var(--font-sans) !important;
    font-size: 14.5px !important;
    font-weight: 600 !important;
    color: var(--color-dark) !important;
    transition: color 0.2s ease, background 0.2s ease !important;
    border-radius: var(--radius-sm);
    padding: 8px 12px !important;
}

.newul > li > a:hover {
    color: var(--color-primary) !important;
    background: var(--color-primary-soft);
}

/* ==========================================================================
   3. QUICK ACTION CARDS (PPDB, PORTAL, CBT, RAPOR)
   ========================================================================== */

.mia_quick_actions {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    margin: 20px 0 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.mia_qa_card {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 14px 18px !important;
    background: #ffffff !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-card) !important;
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    position: relative !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.mia_qa_card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
    transition: width 0.2s ease;
}

.mia_qa_card:hover {
    transform: translateY(-3px) !important;
    box-shadow: var(--shadow-hover) !important;
    border-color: #cbd5e1 !important;
}

.mia_qa_card:hover:before {
    width: 6px;
}

.qa_ppdb:before { background: #059669 !important; }
.qa_portal:before { background: #0284c7 !important; }
.qa_cbt:before { background: #d97706 !important; }
.qa_rdm:before { background: #7c3aed !important; }

.qa_icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    flex-shrink: 0 !important;
    transition: transform 0.2s ease !important;
}

.qa_ppdb .qa_icon { background: #ecfdf5 !important; color: #059669 !important; }
.qa_portal .qa_icon { background: #f0f9ff !important; color: #0284c7 !important; }
.qa_cbt .qa_icon { background: #fffbeb !important; color: #d97706 !important; }
.qa_rdm .qa_icon { background: #f5f3ff !important; color: #7c3aed !important; }

.mia_qa_card:hover .qa_icon {
    transform: scale(1.1) !important;
}

.qa_text {
    display: flex !important;
    flex-direction: column !important;
}

.qa_text strong {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--color-dark) !important;
    line-height: 1.3 !important;
}

.qa_text small {
    font-size: 12.5px !important;
    color: var(--color-muted) !important;
    line-height: 1.3 !important;
    margin-top: 2px !important;
}

/* ==========================================================================
   4. SCHOOL NAME & CLEAN TICKER
   ========================================================================== */

.mad__school {
    background: #ffffff !important;
    border-bottom: 1px solid var(--color-border) !important;
    padding: 20px 0 16px !important;
}

.mad__schoolname {
    font-size: 28px !important;
    font-weight: 800 !important;
    color: var(--color-dark) !important;
    letter-spacing: -0.03em !important;
    line-height: 1.25 !important;
    text-align: center !important;
}

.mading_sosial {
    display: flex !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 10px !important;
}

.mading_sosial a {
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.2s ease !important;
}

.mading_sosial a:hover {
    transform: translateY(-2px) scale(1.06) !important;
}

/* UNIFIED CLEAN TICKER (NO MORE RETRO GREEN BAR) */
.mad_ticker {
    background: #ffffff !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03) !important;
    margin: 16px auto !important;
    padding: 6px 12px !important;
    display: flex !important;
    align-items: center !important;
}

.sekilas .re_info {
    background: var(--color-primary) !important;
    color: #ffffff !important;
    border-radius: var(--radius-sm) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 5px 12px !important;
}

.mad_today span {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--color-primary) !important;
}

.scrollin {
    font-size: 14.5px !important;
    font-weight: 500 !important;
    color: var(--color-dark) !important;
}

/* ==========================================================================
   5. UNIFIED SECTION HEADINGS
   ========================================================================== */

.title_news.re_news,
.title_news.re_editor,
.mading_heads,
.title_four,
.pres_head {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%) !important;
    color: #ffffff !important;
    border-radius: var(--radius-md) !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em !important;
    padding: 10px 18px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.22) !important;
}

/* ==========================================================================
   6. NEWS CARDS (PHOTO ON TOP + WHITE CONTAINER BELOW)
   ========================================================================== */

.news_before {
    margin: 0 !important;
}

.news_before .news_home_loop {
    float: none !important;
    display: block !important;
}

.news_before .news_home_loop .news_box,
.news_before .news_home_loop:nth-child(1) .news_box,
.news_before .news_home_loop:nth-child(2) .news_box,
.news_before .news_home_loop:nth-child(3) .news_box,
.news_before .news_home_loop:nth-child(4) .news_box {
    position: relative !important;
    height: 100% !important;
    margin: 0 0 16px !important;
    background: #ffffff !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-card) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.news_before .news_home_loop .news_box:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--shadow-hover) !important;
    border-color: #cbd5e1 !important;
}

.news_before .news_home_loop .mad_news_thumb,
.news_before .news_home_loop:nth-child(1) .mad_news_thumb,
.news_before .news_home_loop:nth-child(2) .mad_news_thumb,
.news_before .news_home_loop:nth-child(3) .mad_news_thumb,
.news_before .news_home_loop:nth-child(4) .mad_news_thumb {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 180px !important;
    overflow: hidden !important;
    background: #f1f5f9 !important;
}

.news_before .news_home_loop .mad_news_thumb img,
.news_before .news_home_loop:nth-child(1) .mad_news_thumb img,
.news_before .news_home_loop:nth-child(2) .mad_news_thumb img,
.news_before .news_home_loop:nth-child(3) .mad_news_thumb img,
.news_before .news_home_loop:nth-child(4) .mad_news_thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    transition: transform 0.4s ease !important;
}

.news_before .news_home_loop .news_box:hover .mad_news_thumb img {
    transform: scale(1.04) !important;
}

.news_before .news_home_loop .news_meta,
.news_before .news_home_loop:nth-child(1) .news_meta,
.news_before .news_home_loop:nth-child(2) .news_meta,
.news_before .news_home_loop:nth-child(3) .news_meta,
.news_before .news_home_loop:nth-child(4) .news_meta {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    padding: 16px 18px 18px !important;
    background: #ffffff !important;
    z-index: 2 !important;
}

.news_before .news_home_loop .news_auth,
.news_before .news_home_loop .news_auth .post-date {
    display: inline-block !important;
    color: var(--color-primary) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    margin-bottom: 6px !important;
}

.news_before .news_home_loop .news_meta h3,
.news_before .news_home_loop .news_meta h3 a,
.news_before .news_home_loop:nth-child(1) .news_meta a,
.news_before .news_home_loop:nth-child(2) .news_meta a,
.news_before .news_home_loop:nth-child(3) .news_meta a,
.news_before .news_home_loop:nth-child(4) .news_meta a {
    color: var(--color-dark) !important;
    font-size: 16.5px !important;
    line-height: 1.42 !important;
    font-weight: 800 !important;
    text-decoration: none !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    margin: 4px 0 0 !important;
    transition: color 0.2s ease !important;
}

.news_before .news_home_loop .news_meta h3 a:hover {
    color: var(--color-primary) !important;
}

/* ==========================================================================
   7. OVERHAUL EDITORIAL BLOCK (NO MORE FLAT GREEN WALL!)
   ========================================================================== */

.edit_before {
    background: #ffffff !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-card) !important;
    overflow: hidden !important;
    height: auto !important;
    display: flex !important;
}

.mad_master {
    width: 200px !important;
    float: none !important;
    flex-shrink: 0 !important;
    position: relative !important;
    background: var(--color-dark) !important;
    overflow: hidden !important;
}

.mad_master img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.get_names {
    background: linear-gradient(to top, rgba(15, 23, 42, 0.9) 0%, transparent 100%) !important;
    padding: 60px 14px 14px !important;
}

.head_name {
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
}

.re_kepala {
    color: #34d399 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.edit_post {
    width: calc(100% - 200px) !important;
    float: none !important;
    padding: 14px 18px !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 8px !important;
}

.edit_home_loop .edit_box {
    background: var(--color-bg-soft) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    transition: all 0.2s ease !important;
    position: relative !important;
}

.edit_home_loop .edit_box:before {
    content: '?';
    font-size: 10px;
    color: var(--color-primary);
    margin-right: 8px;
}

.edit_home_loop .edit_box:hover {
    background: var(--color-primary-soft) !important;
    border-color: var(--color-primary) !important;
    transform: translateX(4px) !important;
}

.edit_home_loop .edit_box h3 a {
    color: var(--color-dark) !important;
    font-size: 14.5px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

.edit_home_loop .edit_box:hover h3 a {
    color: var(--color-primary) !important;
}

/* ==========================================================================
   8. PRESTASI & OTHER SECTIONS
   ========================================================================== */

.pres_post,
.prespost_inner {
    background: #ffffff !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-card) !important;
    overflow: hidden !important;
}

.pres_button a {
    background: var(--color-primary) !important;
    color: #ffffff !important;
    border-radius: var(--radius-md) !important;
    padding: 10px 22px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.22) !important;
}

.pres_button a:hover {
    background: var(--color-primary-dark) !important;
}

/* ==========================================================================
   9. HIGH-CONTRAST ACCESSIBILITY (AGENDA & FOOTER)
   ========================================================================== */

.parallax {
    background-color: var(--color-dark) !important;
    padding: 50px 0 !important;
}

.title_agenda,
.title_agenda.re_agenda {
    background: #ffffff !important;
    color: var(--color-dark) !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    border-radius: var(--radius-md) !important;
    padding: 8px 24px !important;
    display: inline-block !important;
    margin-bottom: 24px !important;
}

.home_agenda {
    background: rgba(30, 41, 59, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: var(--radius-lg) !important;
    padding: 20px !important;
    margin-bottom: 18px !important;
}

.age_title h3 a {
    color: #ffffff !important;
    font-size: 19px !important;
    font-weight: 700 !important;
}

.age_date {
    color: #f59e0b !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}

.footer {
    background: #0f172a !important;
    color: #94a3b8 !important;
    padding: 28px 0 !important;
    font-size: 14px !important;
}

.footer a {
    color: #cbd5e1 !important;
}

.footer a:hover {
    color: #34d399 !important;
}

.to_top {
    background: var(--color-primary) !important;
    border-radius: 50% !important;
}

/* ==========================================================================
   10. RESPONSIVE DESIGN (MOBILE & DESKTOP BREAKPOINTS)
   ========================================================================== */

/* Mobile Breakpoint (max-width: 768px) */
@media screen and (max-width: 768px) {
    .mad__top {
        display: none !important;
    }

    /* Slim Sticky Header on Mobile */
    .layout_mading {
        padding-top: 58px !important;
    }

    .mad__header {
        height: 58px !important;
        max-height: 58px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(16px) !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
    }

    .mad__nav {
        height: 58px !important;
    }

    .mad__logo {
        height: 44px !important;
        padding: 7px 0 !important;
    }

    .mad__logo img {
        height: 42px !important;
    }

    .botsearch, .botmenu {
        top: 10px !important;
    }

    .mad__menu, .mad__search {
        width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
    }

    /* Base Typography on Mobile */
    body, p {
        font-size: 16px !important;
        line-height: 1.62 !important;
    }

    .mad__schoolname {
        font-size: 22px !important;
        line-height: 1.3 !important;
        margin-bottom: 6px !important;
    }

    /* Quick Action Grid: 2 Columns x 2 Rows on Mobile */
    .mia_quick_actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin: 16px 0 8px !important;
    }

    .mia_qa_card {
        padding: 10px 12px !important;
        gap: 10px !important;
        border-radius: 12px !important;
    }

    .qa_icon {
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
    }

    .qa_icon svg {
        width: 19px !important;
        height: 19px !important;
    }

    .qa_text strong {
        font-size: 13.5px !important;
    }

    .qa_text small {
        font-size: 11px !important;
    }

    /* Ticker on Mobile */
    .mad_ticker {
        border-radius: 30px !important;
        padding: 5px 12px !important;
        margin: 14px 0 !important;
    }

    .sekilas .re_info {
        border-radius: 20px !important;
        padding: 4px 10px !important;
        font-size: 11px !important;
    }

    .mad_today {
        display: none !important;
    }

    .runscroll {
        margin-left: 8px !important;
    }

    /* SINGLE COLUMN MOBILE NEWS FEED (Eliminates 2x2 cramped grid) */
    .mad_news {
        width: 100% !important;
        float: none !important;
    }

    .news_before {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    .news_before .news_home_loop,
    .news_before .news_home_loop:nth-child(1),
    .news_before .news_home_loop:nth-child(2),
    .news_before .news_home_loop:nth-child(3),
    .news_before .news_home_loop:nth-child(4) {
        width: 100% !important;
        height: auto !important;
        float: none !important;
        margin: 0 !important;
    }

    .news_before .news_home_loop .news_box,
    .news_before .news_home_loop:nth-child(1) .news_box,
    .news_before .news_home_loop:nth-child(2) .news_box,
    .news_before .news_home_loop:nth-child(3) .news_box,
    .news_before .news_home_loop:nth-child(4) .news_box {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        border-radius: var(--radius-lg) !important;
    }

    .news_before .news_home_loop .mad_news_thumb,
    .news_before .news_home_loop:nth-child(1) .mad_news_thumb,
    .news_before .news_home_loop:nth-child(2) .mad_news_thumb,
    .news_before .news_home_loop:nth-child(3) .mad_news_thumb,
    .news_before .news_home_loop:nth-child(4) .mad_news_thumb {
        height: 200px !important;
        width: 100% !important;
    }

    .news_before .news_home_loop .news_meta,
    .news_before .news_home_loop:nth-child(1) .news_meta,
    .news_before .news_home_loop:nth-child(2) .news_meta,
    .news_before .news_home_loop:nth-child(3) .news_meta,
    .news_before .news_home_loop:nth-child(4) .news_meta {
        padding: 14px 16px 16px !important;
        background: #ffffff !important;
    }

    .news_before .news_home_loop .news_meta h3 a {
        font-size: 17px !important;
        line-height: 1.4 !important;
        font-weight: 800 !important;
        color: var(--color-dark) !important;
    }

    /* Editorial Overhaul on Mobile */
    .mad_editorial {
        width: 100% !important;
        float: none !important;
        margin-top: 24px !important;
    }

    .edit_before {
        height: auto !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    .mad_master {
        width: 100% !important;
        height: 200px !important;
        float: none !important;
    }

    .edit_post {
        width: 100% !important;
        float: none !important;
        padding: 14px !important;
        box-sizing: border-box !important;
    }
}

/* Desktop Grid Breakpoint (min-width: 769px) */
@media screen and (min-width: 769px) {
    .news_before {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 18px !important;
    }
    
    .news_before .news_home_loop,
    .news_before .news_home_loop:nth-child(1),
    .news_before .news_home_loop:nth-child(2),
    .news_before .news_home_loop:nth-child(3),
    .news_before .news_home_loop:nth-child(4) {
        width: 100% !important;
        height: 100% !important;
        float: none !important;
        margin: 0 !important;
    }

    .edit_before {
        display: flex !important;
        flex-direction: row !important;
    }
}
