/* ==========================================================================
    1. RESET & CORE VARIABLES
    ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 88px;
    --transition-speed: 0.3s;
    --easing: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: #000000 !important;
    color: #f8fafc;
    font-family: 'Plus Jakarta Sans', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
    2. SIDEBAR STYLING
    ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    height: calc(100vh - 32px);
    margin: 16px;
    padding: 24px 16px;
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    transition: width var(--transition-speed) var(--easing),
                transform var(--transition-speed) var(--easing);
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
    padding: 0 4px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #00d084, #00b4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.toggle-btn {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    text-decoration: none;
    color: #94a3b8;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s var(--easing);
    border: 1px solid transparent;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #f1f5f9;
}

.sidebar a .icon {
    font-size: 1.2rem;
    min-width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: color 0.2s ease;
}

.sidebar a:hover .icon {
    color: #f1f5f9;
}

.sidebar a.active {
    background: linear-gradient(135deg, rgba(0, 208, 132, 0.08), rgba(0, 180, 255, 0.08));
    border-color: rgba(0, 208, 132, 0.25);
    color: #00d084;
    font-weight: 600;
}

.sidebar a.active .icon {
    color: #00d084;
}

.text { white-space: nowrap; }

.sidebar.collapsed .logo,
.sidebar.collapsed .text { display: none; }
.sidebar.collapsed .sidebar-top { justify-content: center; }
.sidebar.collapsed .toggle-btn { transform: rotate(180deg); }

/* ==========================================================================
    3. GRID MANAGEMENT & ADAPTIVE COMPONENT
    ========================================================================== */
.container {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px 40px;
    transition: margin-left var(--transition-speed) var(--easing);

    display: grid;
    grid-template-columns: 1fr 300px; /* Default 2 Kolom */
    gap: 40px;
    align-items: start;
    justify-content: center;
    max-width: 1100px;
    margin-right: auto;
}

/* FIX: Hanya hilangkan sidebar kanan jika element .dashboard (halaman admin) aktif */
.container:has(.dashboard) {
    grid-template-columns: 1fr !important; /* Paksa 1 kolom penuh */
    max-width: 100% !important;
    padding-right: 60px;
}

.container:has(.dashboard) .right-sidebar {
    display: none !important; /* Sidebar kanan hanya hancur di ruang /admin */
}

.container:has(.dashboard) .main-feed-area {
    max-width: 100% !important;
    justify-self: start;
}

.sidebar.collapsed ~ .container {
    margin-left: var(--sidebar-collapsed-width);
}

.main-feed-area {
    max-width: 640px;
    width: 100%;
    justify-self: end;
}

/* ==========================================================================
    4. RIGHT SIDEBAR CARD COMPONENTS
    ========================================================================== */
.right-sidebar {
    position: sticky;
    top: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.widget-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px;
}

.widget-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.widget-title i { font-size: 1.1rem; }

.trend-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    list-style: none;
}

.trend-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #e2e8f0;
    font-size: 0.938rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.trend-item a:hover { color: #00b4ff; }

.trend-count {
    font-size: 0.75rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 10px;
    border-radius: 100px;
    font-weight: 600;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.875rem;
    color: #94a3b8;
    padding-left: 16px;
}

.rules-list li::marker { color: #00d084; }

.header-content {
    text-align: center;
    margin-bottom: 32px;
}

.title {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 6px;
}

.tagline {
    font-size: 0.938rem;
    color: #64748b;
}

.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; height: 64px;
    background: rgba(11, 17, 32, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 990;
}

.mobile-header .logo {
    font-weight: 800;
    background: linear-gradient(90deg, #00d084, #00b4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mobile-header .toggle-btn {
    all: unset;
    cursor: pointer;
    color: #94a3b8;
    font-size: 20px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 995;
}

.toast {
    position: fixed; bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(40px);
    background: #10b981; color: white; padding: 12px 24px;
    border-radius: 100px; font-size: 0.875rem; font-weight: 600;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    opacity: 0; pointer-events: none; z-index: 10000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.plasma-bg-container {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1; overflow: hidden;
    background: #000000 !important;
}

#plasmaCanvas { width: 100%; height: 100%; display: block; }

/* ==========================================================================
    5. SHINY ANIMATION TEXT ENGINE (SILVER & METALLIC PREMIUM EFFECT)
    ========================================================================== */
.shiny-text {
    display: inline-block;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent;
    background-size: 200% auto;
    will-change: background-position;
}

.logo-brand {
    background-image: linear-gradient(120deg, #00d084 0%, #00d084 30%, #00b4ff 50%, #00d084 70%, #00d084 100%);
    --shiny-speed: 2.8s;
}

.header-content .title .shiny-text {
    background-image: linear-gradient(90deg, #94a3b8 0%, #94a3b8 25%, #ffffff 50%, #94a3b8 75%, #94a3b8 100%);
    --shiny-speed: 2.2s;
}

.shiny-animate-left {
    animation: shineLeft var(--shiny-speed, 2.5s) linear infinite !important;
}

@keyframes shineLeft {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

/* ==========================================================================
    6. RESPONSIVE LAYOUT ENGINE
    ========================================================================== */
@media (max-width: 1024px) {
    .container { grid-template-columns: 1fr; }
    .right-sidebar { display: none; }
    .main-feed-area { justify-self: center; }
}

@media (max-width: 900px) {
    .mobile-header { display: flex; }
    .sidebar {
        width: 260px !important; height: 100vh; margin: 0;
        border-radius: 0; border: none;
        border-right: 1px solid rgba(255, 255, 255, 0.06);
        transform: translateX(-100%);
    }
    .sidebar.active { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,0.8); }
    .container {
        margin-left: 0 !important; width: 100%;
        padding: 94px 16px 40px 16px;
    }
    .title { font-size: 1.85rem; }
    .sidebar-overlay.active { display: block; }
}

.sidebar-separator {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    margin: 18px 0 8px 14px;
    transition: opacity var(--transition-speed);
}

.sidebar.collapsed .sidebar-separator { opacity: 0; }

.logout-link:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.15) !important;
}

.logout-link:hover .icon { color: #ef4444 !important; }
