@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #12151B;
  --panel: #1A1F27;
  --border: #2B323D;
  --text: #ECEEF1;
  --text-dim: #8B93A3;
  --amber: #E8A33D;
  --teal: #35BFA7;
  --red: #E8615A;
  --radius: 8px;
}

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

html { font-size: 16px; }
body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.mono { font-family: 'JetBrains Mono', monospace; }

.page { display: none; min-height: 100vh; }
.page.active { display: flex; }

/* LOGIN PAGE */
#login-page {
  width: 100%;
  min-height: 100vh;
}
.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
  background: linear-gradient(135deg, #12151B 0%, #1A1F27 100%);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,163,61,0.08) 0%, transparent 70%);
}
.brand {
  position: relative;
  z-index: 1;
  margin-bottom: 2rem;
}
.brand-logo {
  display: block;
  width: 116px;
  height: 116px;
  object-fit: contain;
  background: transparent;
  margin-bottom: 0.75rem;
}
.brand h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}
.brand-sub {
  color: var(--text-dim);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.terminal-log {
  position: relative;
  z-index: 1;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  max-width: 420px;
}
.terminal-line {
  color: var(--text-dim);
  padding: 0.3rem 0;
  opacity: 0;
  animation: fadeInLine 0.5s forwards;
}
.terminal-line:nth-child(1) { animation-delay: 0.5s; }
.terminal-line:nth-child(2) { animation-delay: 1.2s; }
.terminal-line:nth-child(3) { animation-delay: 1.9s; }
.terminal-line.success { color: var(--teal); }

@keyframes fadeInLine {
  to { opacity: 1; }
}

.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
}
.login-card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1.1rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.form-group input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--amber);
}
.form-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
  padding: 0.5rem 0.8rem;
  background: rgba(232,97,90,0.1);
  border-radius: var(--radius);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background: var(--amber);
  color: #12151B;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: #d49130; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-full { width: 100%; }

.btn-icon {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}
.btn-icon:hover { border-color: var(--amber); }

/* DASHBOARD */
#dashboard-page {
  flex-direction: row;
}
.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar-brand {
  padding: 0 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--amber);
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}
.sidebar-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: transparent;
  flex: 0 0 auto;
}
.sidebar-menu {
  list-style: none;
  flex: 1;
}
.sidebar-menu li {
  padding: 0.75rem 1.5rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-size: 0.95rem;
}
.sidebar-menu li:hover {
  background: rgba(232,163,61,0.05);
  color: var(--text);
}
.sidebar-menu li.active {
  background: rgba(232,163,61,0.1);
  color: var(--amber);
  border-left-color: var(--amber);
}
.sidebar-logout {
  margin: 1rem 1.5rem;
  padding: 0.7rem;
  background: rgba(232,97,90,0.1);
  color: var(--red);
  border: 1px solid rgba(232,97,90,0.3);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.sidebar-logout:hover { background: rgba(232,97,90,0.2); }

.content {
  margin-left: 240px;
  flex: 1;
  padding: 2rem;
  min-height: 100vh;
}
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.content-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
}

/* DROPZONE */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 2rem;
  transition: all 0.3s;
  background: var(--panel);
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--amber);
  background: rgba(232,163,61,0.05);
}
.dropzone-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.dropzone p { color: var(--text-dim); margin-bottom: 0.3rem; }
.dropzone-hint { font-size: 0.8rem; color: var(--text-dim); opacity: 0.6; }

/* UPLOAD PROGRESS */
.upload-progress {
  margin-bottom: 2rem;
}
.upload-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.upload-bar-container {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.upload-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--teal));
  border-radius: 4px;
  transition: width 0.3s;
}
.upload-info {
  font-size: 0.85rem;
  color: var(--text-dim);
  min-width: 180px;
  max-width: 260px;
  text-align: right;
}
.upload-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-speed { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.upload-status {
  font-size: 0.8rem;
  min-width: 80px;
  text-align: center;
}
.upload-status.done { color: var(--teal); }
.upload-status.error { color: var(--red); }

/* FILE TABLE */
.table-wrapper {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.file-table {
  width: 100%;
  border-collapse: collapse;
}
.file-table th {
  background: rgba(232,163,61,0.08);
  padding: 0.8rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.file-table td {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.file-table tr:last-child td { border-bottom: none; }
.file-table tr:hover td { background: rgba(232,163,61,0.03); }
.file-table .mono { color: var(--text-dim); font-size: 0.85rem; }
.empty-state {
  text-align: center !important;
  color: var(--text-dim);
  padding: 2rem !important;
  opacity: 0.6;
}

/* BUTTONS */
.btn-download, .btn-delete {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-download { background: rgba(53,191,167,0.15); color: var(--teal); }
.btn-download:hover { background: rgba(53,191,167,0.25); }
.btn-delete { background: rgba(232,97,90,0.15); color: var(--red); }
.btn-delete:hover { background: rgba(232,97,90,0.25); }
.row-actions { white-space: nowrap; }
.btn-secondary {
  padding: 0.7rem 1.5rem;
  background: var(--border);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
}
.btn-danger {
  padding: 0.7rem 1.5rem;
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
}

/* TOAST */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 360px;
  border: 1px solid;
}
.toast-success { background: rgba(53,191,167,0.15); border-color: var(--teal); color: var(--teal); }
.toast-error { background: rgba(232,97,90,0.15); border-color: var(--red); color: var(--red); }
.toast-info { background: rgba(232,163,61,0.15); border-color: var(--amber); color: var(--amber); }

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

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
}
.modal-content h3 { margin-bottom: 1rem; }
.modal-content p { color: var(--text-dim); margin-bottom: 1.5rem; }
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* BOTTOM NAV */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
  z-index: 100;
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
}
.nav-btn.active { color: var(--amber); }

/* VIEWS */
.view { display: none; }
.view.active { display: block; }

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
}
.status-berhasil { background: rgba(53,191,167,0.15); color: var(--teal); }
.status-gagal { background: rgba(232,97,90,0.15); color: var(--red); }
.status-dihapus { background: rgba(232,163,61,0.15); color: var(--amber); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .content { margin-left: 0; padding: 1rem; padding-bottom: 5rem; }
  .login-left { display: none; }
  .login-right { flex: 1; }
  #toast-container { bottom: 4.5rem; left: 0.75rem; right: 0.75rem; }
  .toast { max-width: none; }
  .table-wrapper { border: 0; background: transparent; overflow: visible; }
  .file-table, .file-table tbody, .file-table tr, .file-table td { display: block; width: 100%; }
  .file-table thead { display: none; }
  .file-table tr {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
  }
  .file-table tr:hover td { background: transparent; }
  .file-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
    overflow-wrap: anywhere;
  }
  .file-table td:last-child { border-bottom: 0; }
  .file-table td::before {
    content: attr(data-label);
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: left;
    flex: 0 0 auto;
  }
  .file-table td.empty-state { display: block; text-align: center !important; border: 0; }
  .file-table td.empty-state::before { display: none; }
  .row-actions { justify-content: flex-end; }
  .upload-item { flex-wrap: wrap; gap: 0.6rem; }
  .upload-status { min-width: 72px; text-align: left; }
  .upload-bar-container { flex-basis: calc(100% - 90px); }
  .upload-info { min-width: 100%; max-width: none; text-align: left; }
}
@media (max-width: 360px) {
  .content { padding: 0.75rem; padding-bottom: 5rem; }
  .login-card { padding: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
