/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1115;
    --bg-secondary: #161a21;
    --bg-tertiary: #1e232b;
    --bg-hover: #262c36;
    --border: #2a313d;
    --text-primary: #e6e9ef;
    --text-secondary: #9aa4b2;
    --text-muted: #6b7480;
    --accent: #4f8cff;
    --accent-hover: #3a7aee;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --sidebar-width: 240px;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.25s ease;
}

/* Sidebar tertutup (toggle hamburger) */
.sidebar.is-closed {
    transform: translateX(-100%);
}

/* Overlay mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    display: none;
}
.sidebar-overlay.is-visible {
    display: block;
}
.sidebar__brand {
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar__brand-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 14px;
}

.sidebar__brand-text {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.sidebar__nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar__section {
    margin-bottom: 6px;
}

.sidebar__section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 12px 12px 6px;
    font-weight: 600;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}

.sidebar__link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar__link.is-active {
    background: rgba(79, 140, 255, 0.12);
    color: var(--accent);
    font-weight: 500;
}

.sidebar__link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar__footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== MAIN ===== */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar__toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.topbar__title {
    font-size: 16px;
    font-weight: 600;
}

.content {
    padding: 24px;
    flex: 1;
}

/* ===== CARD ===== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

.card__title {
    font-size: 15px;
    font-weight: 600;
}

.card__subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== FORM ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group--full {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-control {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    transition: border 0.15s, background 0.15s;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    background: var(--bg-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa4b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px;
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* ===== CHECKBOX ===== */
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox__box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    transition: all 0.15s;
    flex-shrink: 0;
}

.checkbox input:checked + .checkbox__box {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox__box::after {
    content: "";
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s;
    margin-top: -2px;
}

.checkbox input:checked + .checkbox__box::after {
    transform: rotate(45deg) scale(1);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--accent);
    color: #fff;
}

.btn--primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn--ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn--ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn--danger {
    background: transparent;
    border-color: var(--border);
    color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

.btn--sm {
    padding: 6px 10px;
    font-size: 12px;
}

.btn--icon {
    padding: 6px;
    width: 30px;
    height: 30px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

/* ===== TABLE ===== */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}

.data-table thead th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table .group-row td {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--accent);
    font-size: 12.5px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.3px;
}

.data-table .group-row .group-count {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 6px;
    font-size: 11.5px;
}

.cell-mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(79, 140, 255, 0.15);
    color: var(--accent);
}

.badge--dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 5px;
}

/* ===== EMPTY STATE ===== */
.empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty svg {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty p {
    font-size: 13px;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

.toast {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    min-width: 240px;
    box-shadow: var(--shadow);
    animation: slideIn 0.25s ease;
    font-size: 13px;
}

.toast--success {
    border-left-color: var(--success);
}

.toast--danger {
    border-left-color: var(--danger);
}

.toast--warning {
    border-left-color: var(--warning);
}

@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
    /* Di mobile, default sidebar TERSEMBUNYI */
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.is-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .sidebar-overlay.is-visible {
        display: block;
    }
}

/* ===== SIDEBAR TREE ===== */
.sidebar__tree { padding: 4px 8px 8px; }

.sidebar__empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    font-style: italic;
}

.sidebar__tree-group {
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.sidebar__tree-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.4px;
    list-style: none;
    user-select: none;
    transition: background 0.15s;
}
.sidebar__tree-summary::-webkit-details-marker { display: none; }
.sidebar__tree-summary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar__tree-caret {
    width: 0;
    height: 0;
    border-left: 4px solid currentColor;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    transition: transform 0.15s;
    flex-shrink: 0;
}
.sidebar__tree-group[open] .sidebar__tree-caret {
    transform: rotate(90deg);
}

.sidebar__tree-name { flex: 1;color:white;font-weight:bold }

.sidebar__tree-count {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 10.5px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 500;
}

.sidebar__tree-list {
    list-style: none;
    padding: 2px 0 4px 14px;
    margin: 0;
}

.sidebar__tree-item {
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: background 0.15s;
    cursor: pointer;
}
.sidebar__tree-item:hover { background: var(--bg-hover); }

.sidebar__tree-email {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__tree-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.sidebar__tree-email-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__tree-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    padding-left: 11px;
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.sidebar__tree-balance {
    color: var(--success);
    font-weight: 600;
    font-size:16px;
    font-family: ui-monospace, monospace;
}
.sidebar__tree-total {
    color: var(--text-secondary);
    font-family: ui-monospace, monospace;
}
.sidebar__tree-sep {
    color: var(--text-muted);
    opacity: 0.5;
}
.sidebar__tree-loading {
    color: var(--text-muted);
    font-style: italic;
}
.sidebar__tree-err {
    color: var(--warning);
}
.sidebar__tree-stale {
    color: var(--warning);
    font-size: 10px;
}
/* ===== LAYOUT (index, pages) ===== */
.layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
}

@media (max-width: 860px) {
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}
.page-subtitle {
    color: var(--text-secondary);
    font-size: 13.5px;
    margin-bottom: 0;
}

/* ===== SELECTED ACCOUNT ===== */
.selected-account {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 20px;
}
.selected-account__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.selected-account__server {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}
.selected-account__key {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== SERVER GRID ===== */
.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 8px;
}
.server-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.15s;
}
.server-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

/* ===== FILE LIST TOOLBAR ===== */
.file-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.file-list-info {
    font-size: 12.5px;
    color: var(--text-muted);
}

/* ===== FILE GRID ===== */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.file-card {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, transform 0.15s;
}
.file-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.file-card__check {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    background: rgba(15, 17, 21, 0.85);
    border-radius: 5px;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.file-card__thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-tertiary);
    overflow: hidden;
}
.file-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.file-card__thumb.is-error img { display: none; }
.file-card__thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.file-card__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
}

.file-card__body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.file-card__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.file-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}
.file-card__meta-item { white-space: nowrap; }
.file-card__money { color: var(--success); }
.file-card__code {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: auto;
}

.file-card__actions {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.file-card__actions .btn {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 11.5px;
}

/* ===== LOADING ===== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== TOPBAR (semua halaman) ===== */
.topbar {
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar__toggle {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border 0.15s;
}
.topbar__toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}
.topbar__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== LAYOUT (index, pages) ===== */
.layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
}

.main-content__body {
    padding: 24px;
    flex: 1;
}

@media (max-width: 860px) {
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .main-content__body {
        padding: 16px;
    }
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}
.page-subtitle {
    color: var(--text-secondary);
    font-size: 13.5px;
}

/* ===== SELECTED ACCOUNT ===== */
.selected-account {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 20px;
}
.selected-account__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.selected-account__server {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}
.selected-account__key {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== SERVER GRID ===== */
.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 8px;
}
.server-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.15s;
}
.server-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

/* ===== FILE LIST TOOLBAR ===== */
.file-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.file-list-toolbar__left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.file-list-info {
    font-size: 12.5px;
    color: var(--text-muted);
}

/* ===== FILE LIST (baris) ===== */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-row {
    display: grid;
    grid-template-columns: 28px 160px 1fr;
    gap: 14px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, background 0.15s;
    align-items: center;
}
.file-row:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.file-row__check {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.file-row__thumb {
    position: relative;
    width: 160px;
    aspect-ratio: 16 / 9;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}
.file-row__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.file-row__thumb.is-error img { display: none; }
.file-row__thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.file-row__duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 10.5px;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: ui-monospace, monospace;
}

.file-row__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.file-row__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.file-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11.5px;
    color: var(--text-muted);
}
.file-row__meta-item { white-space: nowrap; }
.file-row__money { color: var(--success); }

.file-row__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}
.file-row__link {
    font-size: 11.5px;
    color: var(--accent);
    text-decoration: none;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.file-row__link:hover {
    background: rgba(79, 140, 255, 0.1);
    border-color: var(--accent);
}
.file-row__link svg {
    width: 12px;
    height: 12px;
}

@media (max-width: 640px) {
    .file-row {
        grid-template-columns: 28px 110px 1fr;
        gap: 10px;
    }
    .file-row__thumb { width: 110px; }
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.pagination__info {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 140px;
    text-align: center;
}
.pagination__info strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== LOADING ===== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal__title {
    font-size: 15px;
    font-weight: 600;
}
.modal__close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 18px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.modal__close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.modal__body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.modal__footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-domain-row {
    display: flex;
    gap: 8px;
}
.modal-domain-row .form-control {
    flex: 1;
}

.modal-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    max-height: 220px;
    overflow-y: auto;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}
.modal-preview__empty {
    color: var(--text-muted);
    font-style: italic;
    font-family: inherit;
}

.modal-total {
    font-size: 12.5px;
    color: var(--text-muted);
    text-align: center;
}
.modal-total strong {
    color: var(--accent);
    font-weight: 600;
}
/* ===== REMOTE STATUS LIST ===== */
.remote-status-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
}
.remote-status-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: start;
}
.remote-status-item__url {
    grid-column: 1 / -1;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.remote-status-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.remote-status-badge {
    background: rgba(79, 140, 255, 0.15);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}
.remote-status-code {
    font-family: ui-monospace, monospace;
    font-size: 11.5px;
    color: var(--text-secondary);
}
.remote-status-date {
    font-size: 11px;
    color: var(--text-muted);
}
.remote-status-progress {
    grid-column: 1 / -1;
    background: var(--bg-tertiary);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}
.remote-status-progress__bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
}
.remote-status-delete {
    grid-row: 2;
    grid-column: 2;
    align-self: center;
}