@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: radial-gradient(circle at top center, #0d1b2a 0%, #050811 100%);
    background-attachment: fixed;
    color: #f8fafc;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Memastikan footer selalu terdorong ke paling bawah layar di semua perangkat */
footer {
    margin-top: auto !important;
    width: 100%;
}

/* Header & Navigasi Sticky + Efek Blur */
.top-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: rgba(5, 8, 17, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(30, 41, 59, 0.7);
    padding: 14px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.pill-btn {
    text-decoration: none;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #1e293b;
    padding: 8px 15px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.pill-btn:hover {
    border-color: #14b8a6;
    color: #ffffff;
}

.pill-btn.active {
    background: rgba(20, 184, 166, 0.15);
    border-color: #14b8a6;
    color: #2dd4bf;
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.2);
}

/* Hero Title Center */
.hero-section {
    text-align: center;
    padding: 24px 16px 26px 16px;
}

.hero-title {
    font-size: 36px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.hero-title span {
    color: #14b8a6;
}

.hero-subtitle {
    color: #94a3b8;
    font-size: 14px;
    margin-top: 8px;
}

/* Container Melebar Bento Grid */
.container-wide {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto 36px auto;
    padding: 0 24px;
}

.main-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.sidebar-form {
    position: sticky;
    top: 85px;
    min-width: 0;
}

.main-layout > main {
    min-width: 0;
}

/* Grid 2 Kolom di Beranda */
.diskusi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

/* Grid 5 Kolom Ke Samping di Halaman Semua Postingan */
.semua-diskusi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.semua-diskusi-grid .bento-card {
    padding: 16px;
    border-radius: 14px;
}

.semua-diskusi-grid .bento-card h2 {
    font-size: 16px;
    margin-bottom: 6px;
}

.semua-diskusi-grid .bento-card p {
    font-size: 12.5px;
    line-height: 1.5;
}

.semua-diskusi-grid .komentar-box {
    padding: 8px 10px;
}

.semua-diskusi-grid .btn-detail-post {
    padding: 8px 10px;
    font-size: 11.5px;
    margin-top: 10px;
}

/* Kartu Dark Bento */
.bento-card {
    background: #0d1322;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    transition: border-color 0.2s ease, transform 0.2s ease;
    min-width: 0;
    word-wrap: break-word;
}

.bento-card:hover {
    border-color: #2dd4bf55;
}

.icon-box {
    width: 36px;
    height: 36px;
    background: #131c31;
    border: 1px solid #1e293b;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2dd4bf;
    font-weight: bold;
    margin-bottom: 12px;
}

.bento-card h2, .bento-card h3 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-weight: 700;
    line-height: 1.35;
}

.bento-card p {
    color: #94a3b8;
    line-height: 1.6;
    font-size: 14px;
    margin-top: 0;
}

/* =========================================================
   GRAFIK FLEKSIBEL OTOMATIS (PROFIL & MONITOR GRAFIK)
   Mengotak Rapi di PC, Laptop, Tablet, dan Handphone
   ========================================================= */
.personal-chart-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
    margin-top: 14px !important;
}

.chart-subcard {
    min-width: 0 !important;
    overflow: hidden;
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 225px;
}

/* Grid Monitor Grafik (monitor.html) agar selalu fleksibel & mengotak */
.container-wide > div[style*="grid-template-columns"]:has(canvas) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
}

.container-wide > div[style*="grid-template-columns"] > .bento-card:has(canvas),
.container-wide > .bento-card:has(canvas) {
    min-width: 0 !important;
    overflow: hidden;
}

canvas {
    max-width: 100% !important;
}

/* =========================================================
   STYLING MODERN KHUSUS HALAMAN PROFIL
   ========================================================= */
#profilHeaderCard {
    background: linear-gradient(135deg, #0f172a 0%, #091522 60%, #0a2229 100%) !important;
    border: 1px solid rgba(45, 212, 191, 0.25) !important;
    position: relative;
    overflow: hidden;
}

#profilHeaderCard .avatar-circle {
    width: 74px !important;
    height: 74px !important;
    font-size: 28px !important;
    box-shadow: 0 0 24px rgba(20, 184, 166, 0.35);
    border: 2px solid #2dd4bf !important;
}

#profilHeaderCard .follow-stat-pill {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid #1e293b !important;
    padding: 7px 14px !important;
    border-radius: 999px !important;
    font-size: 12.5px !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

#profilHeaderCard .follow-stat-pill:hover {
    border-color: #14b8a6 !important;
    background: rgba(20, 184, 166, 0.12) !important;
    transform: translateY(-1px);
}

#btnBukaEditProfil, #btnFollowToggle {
    padding: 9px 18px !important;
    font-size: 12px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* Form Input Dark Mode */
input, textarea, select {
    width: 100%;
    background: #080c16;
    border: 1px solid #1e293b;
    color: #f8fafc;
    padding: 11px 14px;
    margin: 6px 0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    border-color: #14b8a6;
}

input::placeholder, textarea::placeholder {
    color: #475569;
}

button {
    width: 100%;
    background: #14b8a6;
    color: #042f2e;
    border: none;
    padding: 11px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}

button:hover {
    background: #2dd4bf;
    transform: translateY(-1px);
}

/* List Komentar & Tag Pil */
.komentar-list {
    max-height: 230px;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 12px;
}

.komentar-list::-webkit-scrollbar {
    width: 5px;
}

.komentar-list::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 10px;
}

.komentar-box {
    background: #080c16;
    border: 1px solid #1e293b;
    border-left: 3px solid #14b8a6;
    padding: 12px 15px;
    margin-top: 8px;
    border-radius: 10px;
    min-width: 0;
    transition: border-color 0.2s ease;
}

.komentar-box:hover {
    border-color: #2dd4bf55;
}

.tag-pill {
    display: inline-block;
    background: #131c31;
    border: 1px solid #1e293b;
    color: #2dd4bf;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
}

/* Dropdown Notifikasi Responsif (Desktop & Mobile) */
.notif-wrapper {
    position: relative;
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: 44px;
    width: 330px;
    max-height: 400px;
    overflow-y: auto;
    background: #0d1322;
    border: 1px solid #1e293b;
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.75);
    padding: 12px;
    display: none;
    z-index: 2000;
}

/* =========================================================
   MONITOR PC & LAPTOP LEBAR (>= 1200px):
   Grafik Pribadi Profil 3 Kolom Sejajar
   ========================================================= */
@media (min-width: 1200px) {
    #panelStatistikPribadi {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
        align-items: stretch;
    }

    #panelStatistikPribadi > div:first-child,
    #panelStatistikPribadi > #personalInsightBox {
        grid-column: 1 / -1;
    }

    #panelStatistikPribadi > .personal-chart-grid {
        display: contents !important;
    }

    #panelStatistikPribadi > .chart-subcard {
        margin-top: 0 !important;
    }
}

/* =========================================================
   LAPTOP SEDANG (<= 1280px): Semua Postingan 4 Kolom
   ========================================================= */
@media (max-width: 1280px) {
    .semua-diskusi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* =========================================================
   TABLET & LAYAR SEDANG (<= 960px):
   Header Rapi 2 Baris, Grid 2-3 Kolom & Footer Rata Tengah
   ========================================================= */
@media (max-width: 960px) {
    .top-header {
        padding: 10px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .nav-group {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
    }

    .nav-group .pill-btn {
        width: 100%;
        padding: 7px 8px;
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Header Monitor Grafik (2 tombol navigasi) agar tetap sejajar rapi */
    .top-header:has(.nav-group a:nth-child(2):last-child) .nav-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #authHeaderArea {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        padding-top: 6px;
        border-top: 1px solid rgba(30, 41, 59, 0.6);
    }

    #authHeaderArea a.pill-btn {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        justify-content: center;
    }

    #authHeaderArea #btnLoginTop {
        width: 100% !important;
        justify-content: center;
    }

    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-form {
        position: static;
    }

    .diskusi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .semua-diskusi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }

    /* Grafik Profil & Monitor Grafik Otomatis 2 Kolom Kiri-Kanan di Tablet */
    .personal-chart-grid,
    .container-wide > div[style*="grid-template-columns"]:has(canvas) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    /* Footer Rapi Rata Tengah untuk Tablet & Ponsel */
    footer {
        padding: 18px 16px !important;
        text-align: center !important;
    }

    footer > div {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
    }

    footer > div > div {
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 8px 14px !important;
        line-height: 1.5;
    }

    footer a {
        padding: 4px 10px;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.75);
        border: 1px solid #1e293b;
        font-size: 11.5px;
    }

    footer > div > div:last-child span:last-child {
        width: 100%;
        display: block;
        margin-top: 4px;
        color: #64748b;
        font-size: 11.5px;
    }
}

/* =========================================================
   PONSEL / SMARTPHONE (<= 640px):
   Semua Kartu & Grafik Otomatis Mengotak 2 Kolom Kiri-Kanan
   ========================================================= */
@media (max-width: 640px) {
    .top-header {
        padding: 10px 12px;
        gap: 7px;
    }

    .nav-group {
        gap: 5px;
    }

    .nav-group .pill-btn {
        padding: 6px 6px;
        font-size: 10px;
        letter-spacing: 0;
        gap: 4px;
    }

    #authHeaderArea .pill-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .hero-section {
        padding: 16px 12px 16px 12px;
    }

    .hero-title {
        font-size: 25px;
    }

    .hero-subtitle {
        font-size: 11.5px;
    }

    .container-wide {
        padding: 0 12px;
        margin-bottom: 24px;
        margin-top: 18px !important;
    }

    .diskusi-grid,
    .semua-diskusi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .diskusi-grid .bento-card,
    .semua-diskusi-grid .bento-card {
        padding: 12px !important;
        border-radius: 12px;
    }

    .diskusi-grid .bento-card h2,
    .semua-diskusi-grid .bento-card h2 {
        font-size: 14px !important;
        margin-bottom: 6px !important;
    }

    .diskusi-grid .bento-card p,
    .semua-diskusi-grid .bento-card p {
        font-size: 12px !important;
        line-height: 1.45 !important;
    }

    .diskusi-grid .komentar-box,
    .semua-diskusi-grid .komentar-box {
        padding: 7px 9px !important;
        margin-top: 6px !important;
    }

    .diskusi-grid .tag-pill,
    .semua-diskusi-grid .tag-pill {
        font-size: 9.5px !important;
        padding: 2px 7px !important;
    }

    .btn-detail-post {
        padding: 8px 10px !important;
        font-size: 11px !important;
        margin-top: 10px !important;
    }

    .bento-card {
        padding: 14px;
    }

    /* =====================================================
       GRAFIK PROFIL & MONITOR GRAFIK DI HANDPHONE:
       Langsung Mengotak 2 Kolom Kiri-Kanan Tanpa Bertimpa
       ===================================================== */
    .personal-chart-grid,
    .container-wide > div[style*="grid-template-columns"]:has(canvas) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 9px !important;
    }

    .chart-subcard,
    .container-wide > div[style*="grid-template-columns"]:has(canvas) > .bento-card {
        padding: 11px 9px !important;
        border-radius: 12px !important;
    }

    .chart-subcard h4,
    .container-wide > div[style*="grid-template-columns"]:has(canvas) h3 {
        font-size: 12px !important;
        margin-bottom: 3px !important;
        line-height: 1.3;
    }

    .chart-subcard p,
    .container-wide > div[style*="grid-template-columns"]:has(canvas) p {
        font-size: 10px !important;
        line-height: 1.3 !important;
        margin-bottom: 6px !important;
    }

    .chart-canvas-wrap {
        height: 155px !important;
        margin-top: 6px !important;
    }

    #panelStatistikPribadi > .chart-subcard {
        margin-top: 10px !important;
    }

    #panelStatistikPribadi > .chart-subcard .chart-canvas-wrap {
        height: 170px !important;
    }

    /* Profil Modern di Ponsel */
    #profilHeaderCard > div {
        flex-direction: column !important;
        gap: 14px !important;
    }

    #profilHeaderCard > div > div:first-child {
        align-items: flex-start !important;
        gap: 14px !important;
    }

    #profilHeaderCard .avatar-circle {
        width: 58px !important;
        height: 58px !important;
        font-size: 22px !important;
    }

    #profilHeaderCard h2 {
        font-size: 19px !important;
    }

    #profilHeaderCard .tag-pill {
        font-size: 10px !important;
        padding: 2px 8px !important;
    }

    #profilHeaderCard > div > div:last-child {
        width: 100%;
    }

    #btnBukaEditProfil, #btnFollowToggle {
        width: 100% !important;
        justify-content: center;
        padding: 9px 14px !important;
    }

    /* 3 Kotak Statistik Angka Atas (Profil & Monitor) Sejajar 3 Kolom */
    .container-wide > div[style*="grid-template-columns"]:not(:has(canvas)) {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .container-wide > div[style*="grid-template-columns"]:not(:has(canvas)) .bento-card {
        padding: 12px 6px !important;
        border-radius: 12px !important;
    }

    .container-wide > div[style*="grid-template-columns"]:not(:has(canvas)) h2 {
        font-size: 21px !important;
    }

    .container-wide > div[style*="grid-template-columns"]:not(:has(canvas)) span {
        font-size: 9px !important;
        line-height: 1.25;
        display: block;
    }

    /* Tombol Tab Profil (Statistik, Topik, Komentar) Sejajar 3 Kolom di Ponsel */
    #tabStatistikBtn, #tabTopikBtn, #tabKomenBtn {
        flex: 1 1 30%;
        text-align: center;
        padding: 7px 6px !important;
        font-size: 10px !important;
        letter-spacing: 0;
    }

    .notif-dropdown {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: 96px !important;
        width: auto !important;
        max-width: calc(100vw - 24px) !important;
        max-height: 65vh !important;
    }
}

/* Tambahan Perbaikan Posisi & Scrollbar Notifikasi */
.notif-dropdown {
    scrollbar-width: thin;
    scrollbar-color: #1e293b #080c16;
}

.notif-dropdown::-webkit-scrollbar {
    width: 6px;
}

.notif-dropdown::-webkit-scrollbar-track {
    background: #080c16;
    border-radius: 999px;
}

.notif-dropdown::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 999px;
}

@media (max-width: 980px) {
    .notif-dropdown {
        position: fixed !important;
        top: 114px !important;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        max-width: 460px !important;
        max-height: 65vh !important;
        z-index: 3500 !important;
    }
}

@media (max-width: 640px) {
    .notif-dropdown {
        top: 96px !important;
    }
}