/* =========================================
   VARIABLES & BASE RESET
   ========================================= */
:root {
    --bg-base: #121212; 
    --bg-surface: #1a1a1a;
    --bg-input: #1e1e1e;
    --border-color: #333;
    --text-main: #e0e0e0;
    --text-muted: #aaa;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
}

/* =========================================
   LAYOUT UTAMA (HOME VS BROWSE)
   ========================================= */
/* Khusus halaman Home (index.html) */
body.home-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.home-page .container {
    width: 100%;
    max-width: 650px;
    text-align: center;
}

/* Khusus halaman Browse (browse.html) */
.browse-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* =========================================
   NAVBAR (BROWSE PAGE)
   ========================================= */
.navbar {
    background-color: var(--bg-surface);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.navbar-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
    transition: color 0.3s;
}

.navbar-links a:hover, .navbar-links a.active {
    color: #ffffff;
}

/* =========================================
   KOMPONEN HOME PAGE (INDEX)
   ========================================= */
h1 {
    font-size: 3rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: #ffffff;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 40px;
}

.search-container {
    position: relative;
    margin-bottom: 30px;
    width: 100%;
}

.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: none;
    z-index: 50;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    text-align: left;
}

.dropdown.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 14px 20px;
    color: var(--text-main);
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #2a2a2a;
}

.see-all-item {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
}

.see-all-item:hover {
    color: #fff;
}

.ott-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
}

.ott-link {
    text-decoration: none;
    color: var(--text-muted);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.ott-link:hover {
    background-color: #252525;
    color: #fff;
}

.btn-browse {
    display: inline-block;
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 14px 32px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-browse:hover {
    background-color: var(--bg-surface);
    border-color: #555;
}

/* =========================================
   KOMPONEN BROWSE PAGE & FORM INPUT
   ========================================= */
.search-bar, #searchInput {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
    color: #fff;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-bar:focus, #searchInput:focus {
    border-color: #5c85d6;
}

.controls-wrapper {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-pills {
    display: flex;
    gap: 10px;
}

.pill {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill:hover {
    background-color: #252525;
    color: #fff;
}

.pill.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

/* Tabel UI */
.table-container {
    overflow-x: auto;
    background-color: var(--bg-input);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #252525;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    white-space: nowrap;
}

tbody tr {
    transition: background-color 0.2s;
    cursor: pointer;
}

tbody tr:hover {
    background-color: #2a2a2a;
}

tbody tr:last-child td {
    border-bottom: none;
}

.col-title {
    font-weight: 600;
    color: #fff;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-size, .col-files {
    white-space: nowrap;
}

#noResults {
    text-align: center;
    color: #666;
    font-size: 1.2rem;
    padding: 40px;
    display: none;
}

/* =========================================
   BADGES (SHARED)
   ========================================= */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-tv { background-color: #2b4c7e; color: #cce0ff; }
.badge-movie { background-color: #7e2b38; color: #ffcccc; }
.badge-db { background-color: #333; color: #aaa; border: 1px solid #444; }

/* =========================================
   MODAL POPUP (SHARED)
   ========================================= */
.modal-overlay, .modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--bg-surface);
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 850px; /* Ukuran lebar yang lega */
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.modal-title {
    margin: 0;
    color: #fff;
    font-size: 1.3rem;
    line-height: 1.4;
    padding-right: 20px;
    font-weight: bold;
}

.close-btn, .close {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover, .close:hover { 
    color: #fff; 
}

.modal-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #ccc;
    align-items: center;
    flex-wrap: wrap;
}

.modal-size-text {
    color: #a8e6b8;
    font-weight: 600;
    background-color: #1f3a28;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* =========================================
   FILE TREE (GAYA CLEAN AL-NYAA.SI)
   ========================================= */
.file-tree-container {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px; /* Jarak luar container */
    margin-bottom: 20px;
    text-align: left;
}

details.folder-accordion {
    /* Menghapus gaya kardus / box */
    margin-bottom: 0; 
}

details.folder-accordion > summary {
    padding: 6px 8px; /* Lebih padat */
    cursor: pointer;
    font-weight: 600;
    color: #ddd;
    outline: none;
    user-select: none;
    border-radius: 4px;
    display: flex;
    align-items: center; /* Untuk alignment icon SVG */
    transition: background-color 0.2s, color 0.2s;
}

details.folder-accordion > summary:hover {
    background-color: #1a1a1a;
    color: #fff;
}

.folder-content {
    /* Sistem indentasi menjorok ke kanan */
    padding-left: 24px; 
}

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

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px; /* Lebih padat */
    font-size: 0.9rem;
    color: #bbb;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

/* Hover ala list menyatu */
.file-item:hover { 
    color: #fff; 
    background-color: #1a1a1a;
}

.file-name {
    word-break: break-all;
    padding-right: 15px;
    display: flex;
    align-items: center; /* Untuk alignment icon SVG */
}

/* Class Icon SVG (Digunakan di main.js) */
.tree-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    fill: currentColor;
    flex-shrink: 0;
}

.file-size-badge {
    background-color: #2a2a2a;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    color: #aaa;
}

.loading-text, .error-text { 
    text-align: center; 
    padding: 20px; 
}
.loading-text { color: #888; font-style: italic; }
.error-text { color: #ff6b6b; }

/* Custom Scrollbar untuk File Tree */
.file-tree-container::-webkit-scrollbar { width: 8px; }
.file-tree-container::-webkit-scrollbar-track { background: var(--bg-base); }
.file-tree-container::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
.file-tree-container::-webkit-scrollbar-thumb:hover { background: #555; }

/* Modal Footer & Button */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: auto;
}

.btn-dl {
    background-color: var(--accent-blue);
    color: white;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s;
    display: inline-block;
}

.btn-dl:hover { 
    background-color: var(--accent-blue-hover); 
}
