/* ADMIN */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* SIDEBAR */
.admin-sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  flex-shrink: 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 8px;
  margin-bottom: 8px;
  margin-top: 20px;
}

.sidebar-section-label:first-child { margin-top: 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
}

.sidebar-link:hover { background: var(--bg3); color: var(--text); }
.sidebar-link.active { background: var(--accent-glow); color: var(--accent); border: 1px solid var(--border-accent); }
.sidebar-link svg { flex-shrink: 0; }

/* MAIN CONTENT */
.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.admin-page { display: none; }
.admin-page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-family: 'Syne', cursive;
  font-size: 32px;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.page-subtitle { font-size: 14px; color: var(--text2); }

/* OVERVIEW CARDS */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.overview-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.overview-card:hover { border-color: var(--border-accent); }

.overview-val {
  font-family: 'Syne', cursive;
  font-size: 36px;
  color: var(--accent);
  letter-spacing: 1px;
  line-height: 1;
  margin-bottom: 6px;
}

.overview-label {
  font-size: 13px;
  color: var(--text2);
}

.overview-icon {
  font-size: 24px;
  margin-bottom: 10px;
}

/* TABLE */
.preset-table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.preset-table {
  width: 100%;
  border-collapse: collapse;
}

.preset-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.preset-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.preset-table tbody tr {
  transition: background 0.2s;
}

.preset-table tbody tr:hover { background: var(--bg3); }

.table-thumb {
  width: 56px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg3);
}

.table-thumb-placeholder {
  width: 56px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.action-btn:hover { color: var(--accent); border-color: var(--border-accent); background: var(--accent-glow); }
.action-btn.delete:hover { color: var(--danger); border-color: rgba(255,68,68,0.3); background: rgba(255,68,68,0.08); }

/* UPLOAD FORM */
.upload-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 700px;
}

.upload-card h3 {
  font-family: 'Syne', cursive;
  font-size: 20px;
  letter-spacing: 1px;
  margin-bottom: 20px;
  color: var(--text2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* FILE DROP ZONE */
.file-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg3);
}

.file-drop:hover, .file-drop.dragging {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.file-drop-icon { font-size: 28px; margin-bottom: 8px; }
.file-drop p { font-size: 14px; color: var(--text2); margin-bottom: 4px; }
.file-drop span { font-size: 12px; color: var(--text3); }
.file-drop input { display: none; }

.file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.file-preview-thumb {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
}

.file-preview-name { font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-size { font-size: 11px; color: var(--text3); }

.file-remove {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: color 0.2s;
}
.file-remove:hover { color: var(--danger); }

/* AUDIO EXTRACT */
.extract-section {
  background: linear-gradient(135deg, rgba(180,130,255,0.05), transparent);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 8px;
}

.extract-section p {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-bar-wrap {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
  display: none;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s;
}

/* SETTINGS */
.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  max-width: 560px;
}

.settings-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* LOGIN */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  font-family: 'Syne', cursive;
  font-size: 32px;
  letter-spacing: 3px;
  margin-bottom: 6px;
}

.login-logo span { color: var(--accent); }
.login-sub { font-size: 13px; color: var(--text2); margin-bottom: 28px; }
.login-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }

  /* Sidebar jadi top tab bar di mobile */
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 52px;
    z-index: 50;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: rgba(17,17,20,0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .admin-sidebar::-webkit-scrollbar { display: none; }

  .sidebar-section-label { display: none; }

  .sidebar-link {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    white-space: nowrap;
    width: auto;
    border-radius: 99px;
  }

  .admin-main {
    padding: 16px 16px 80px; /* bottom padding for bottom nav */
  }

  .form-row { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: repeat(2, 1fr); }

  .page-header { flex-direction: column; gap: 12px; }
  .page-title { font-size: 24px; }

  /* Table horizontal scroll */
  .preset-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .preset-table {
    min-width: 500px;
  }

  /* Settings */
  .settings-card { padding: 16px; }

  /* Input size fix iOS */
  input, textarea, select {
    font-size: 16px !important;
  }

  /* Login card */
  .login-card { padding: 28px 20px; }
}

/* Login logo image */
.login-logo-wrap {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 18px; overflow: hidden;
  border: 1.5px solid rgba(180,130,255,0.3);
  box-shadow: 0 12px 30px rgba(180,130,255,0.15);
}
.login-logo-wrap img { width: 100%; height: 100%; object-fit: cover; }
.login-logo { font-family: 'Syne', sans-serif; font-size: 24px; font-weight: 800; letter-spacing: 1px; margin-bottom: 6px; }
.login-logo span { color: var(--accent); }

/* CATEGORY CHECKBOX GROUP */
.cat-checkbox-group {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0;
}
.cat-checkbox {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 99px;
  border: 1px solid var(--border); cursor: pointer;
  transition: all 0.2s; user-select: none;
  font-size: 13px; font-weight: 500; color: var(--text2);
}
.cat-checkbox:hover { border-color: var(--border-accent); color: var(--accent); }
.cat-checkbox input[type="checkbox"] { display: none; }
.cat-checkbox:has(input:checked) {
  background: linear-gradient(135deg, var(--accent), var(--accent-pink));
  border-color: transparent; color: #fff; font-weight: 600;
}

/* EDIT MODAL FILE PICKER */
.edit-file-pick {
  display: flex; flex-direction: column; gap: 8px;
}
.edit-file-current {
  font-size: 12px; color: var(--text3);
  word-break: break-all; min-height: 0;
}
.edit-pick-btn {
  width: 100%; text-align: center;
  padding: 10px 14px; font-size: 13px;
}
.edit-modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 8px; margin-top: 4px;
  position: sticky; bottom: 0;
  background: var(--bg2);
  padding-bottom: 4px;
}

/* DRIVE MANAGER */
.drive-list { display: flex; flex-direction: column; gap: 16px; }
.drive-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.drive-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drive-card-name { font-weight: 700; font-size: 15px; color: var(--text); }
.drive-card-email { font-size: 12px; color: var(--text3); margin-top: 2px; }
.drive-usage-bar-wrap { margin-bottom: 8px; }
.drive-usage-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.drive-usage-bar {
  height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden;
}
.drive-usage-fill {
  height: 100%; border-radius: 99px; transition: width 0.5s ease;
}
.drive-usage-fill.green  { background: linear-gradient(90deg, #00d4a0, #00b894); }
.drive-usage-fill.orange { background: linear-gradient(90deg, #f39c12, #e67e22); }
.drive-usage-fill.red    { background: linear-gradient(90deg, #ff4d6d, #c0392b); }
.drive-pct { font-size: 12px; font-weight: 600; margin-top: 4px; }
.drive-pct.green  { color: #00d4a0; }
.drive-pct.orange { color: #f39c12; }
.drive-pct.red    { color: #ff4d6d; }
