/* --- RESET & VARIABLES --- */
:root {
    --bg-body: #0f172a;       /* Dark Blue/Slate */
    --bg-sidebar: #1e293b;    /* Lighter Slate */
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;        /* Blue */
    --accent-hover: #2563eb;
    --border: #334155;
    --success: #10b981;
    --danger: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 20px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: 0.3s;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand span { color: var(--accent); }

.nav-links { 
    display: flex; 
    flex-direction: column; 
    gap: 5px; 
    overflow-y: auto;
    flex-grow: 1; 
}

.nav-item {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

.nav-icon { width: 20px; text-align: center; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px 0 0 0;
    border-top: 1px solid var(--border);
    margin-top: 10px;
}
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background-color: var(--border);
    transition: all 0.3s ease;
}
.status-dot.active {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- MAIN CONTENT --- */
.main-content {
    margin-left: 260px;
    padding: 30px;
    width: calc(100% - 260px);
    transition: 0.3s;
}
header { margin-bottom: 40px; }
h1 { font-size: 1.8rem; margin-bottom: 10px; }
p.subtitle { color: var(--text-secondary); }

/* --- CARDS (DASHBOARD) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.stat-label { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 5px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text-primary); }
.info-box {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 15px; border-radius: 12px;
}

/* =========================================
   🚀 CLEAN PROFESSIONAL API LIST (FINAL)
   ========================================= */

/* Container: List Vertikal */
#dynamic-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 40px;
    width: 100%;
}

/* Kartu Utama: Wrapper Accordion */
.api-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex; /* Susun Header dan Body vertikal */
    flex-direction: column;
    transition: border-color 0.2s;
}

.api-card:hover {
    border-color: #475569;
    background: #1f2937; /* Sedikit terang saat hover */
}

/* --- HEADER (Baris Atas - Selalu Terlihat) --- */
.api-card-header {
    display: flex; /* Susun Kiri & Kanan Horizontal */
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    cursor: pointer;
    user-select: none;
}

/* Kiri: Method & Path */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 45%; /* Ambil 45% lebar */
}

.badge-method {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    min-width: 50px;
    text-align: center;
}
.badge-method.GET { background-color: #0ea5e9; }
.badge-method.POST { background-color: #8b5cf6; }

.api-path {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Kanan: Judul & Panah */
.header-right {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Taruh panah di ujung kanan */
    gap: 15px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f1f5f9;
    text-align: right;
}

.arrow-icon {
    color: var(--text-secondary);
    font-size: 1rem;
    transition: transform 0.3s;
    width: 20px; /* Fix lebar agar layout tidak goyang saat rotate */
    text-align: center;
}

.api-card.active .arrow-icon {
    transform: rotate(180deg);
    color: var(--accent);
}

/* --- BODY (Bagian Bawah - Hidden Detail) --- */
.api-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #0b1120;
    border-top: 1px solid transparent;
}

.api-card.active .api-card-body {
    max-height: 400px;
    border-top-color: var(--border);
    padding: 20px;
}

.api-full-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* --- TOMBOL --- */
.btn-action {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-action:hover {
    background-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn-disabled {
    background: #334155;
    color: #94a3b8;
    cursor: not-allowed;
}

/* =========================================
   MODAL & SEARCH & UTILS
   ========================================= */

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    align-items: center; justify-content: center;
}
.modal-box {
    background: var(--bg-card);
    width: 90%; max-width: 500px;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 25px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}
.form-group { margin-bottom: 15px; }
.form-group label { display: block; color: var(--text-secondary); margin-bottom: 5px; font-size: 0.85rem; }
.form-group input {
    width: 100%; padding: 12px;
    background: #0f172a; border: 1px solid var(--border);
    border-radius: 8px; color: white; outline: none;
}
.form-group input:focus { border-color: var(--accent); }
.btn-primary {
    width: 100%; padding: 12px;
    background: var(--accent); color: white;
    border: none; border-radius: 8px;
    font-weight: 600; cursor: pointer; margin-top: 10px;
}
.result-box {
    background: #000; color: #10b981;
    padding: 15px; border-radius: 8px;
    margin-top: 20px; font-family: monospace;
    font-size: 0.85rem; white-space: pre-wrap;
    display: none; border: 1px solid var(--border);
}

/* --- SEARCH BAR --- */
.search-container { margin-bottom: 25px; position: relative; }
.search-input {
    width: 100%;
    padding: 15px 20px 15px 50px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
    outline: none;
}
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.search-icon-overlay {
    position: absolute;
    left: 20px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
    pointer-events: none;
}
.hidden { display: none !important; }

/* --- PREMIUM CODE BLOCK --- */
.code-wrapper {
    background: #1a1b26;
    border: 1px solid #414868;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.code-header {
    background: #16161e;
    padding: 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2f354b;
    height: 48px;
}
.header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mac-dots { display: flex; gap: 6px; flex-shrink: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }
.code-title {
    color: #7aa2f7;
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.btn-copy {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #414868;
    color: #a9b1d6;
    height: 30px; padding: 0 10px; width: auto;
    font-size: 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    flex-shrink: 0; white-space: nowrap; margin-left: 10px;
}
.btn-copy:hover { background: #7aa2f7; color: #1a1b26; border-color: #7aa2f7; }
.code-content {
    padding: 15px; margin: 0; overflow-x: auto;
    color: #c0caf5; font-size: 0.8rem; line-height: 1.5; text-align: left;
}
.kwd { color: #bb9af7; font-weight: bold; } 
.func { color: #7aa2f7; } 
.str { color: #9ece6a; } 
.num { color: #ff9e64; } 
.comment { color: #565f89; font-style: italic; } 
.punc { color: #89ddff; }

/* --- LOADING SCREEN --- */
.loader-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}
.loader-hidden { opacity: 0; visibility: hidden; }
.loader-content { text-align: center; }
.spinner-gif {
    width: 200px; height: auto;
    margin-bottom: 15px; border-radius: 10px;
}
.loader-content p {
    color: var(--text-secondary); margin-top: 15px;
    font-size: 0.9rem; letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulseText 1.5s infinite;
}
@keyframes pulseText {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- MOBILE COMPONENTS --- */
.toggle-btn {
    display: none;
    background: transparent; border: none;
    color: var(--danger); font-size: 1.5rem; cursor: pointer;
}
.hamburger-float {
    display: none;
    position: fixed; top: 15px; left: 15px; z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px; border-radius: 8px;
    cursor: pointer; font-size: 1.2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.sidebar-overlay {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 99;
    backdrop-filter: blur(2px);
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0; width: 100%;
        padding: 70px 20px 20px 20px;
    }
    .sidebar {
        width: 260px; height: 100vh; position: fixed;
        left: -270px; top: 0;
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 300;
        border-right: 1px solid var(--border);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar.show { left: 0; }
    .hamburger-float, .toggle-btn, .sidebar-overlay.show { display: block; }
    .brand { margin-bottom: 20px; justify-content: space-between; }
    
    /* Mobile List Layout */
    .api-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 15px;
    }
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    .header-right {
        width: 100%;
        justify-content: space-between;
        padding-top: 5px;
    }
    .card-title {
        text-align: left;
        flex-grow: 1;
    }
}