/* ===========================================================
   APLIKASI DATA KUMPUL — Design System
   =========================================================== */

:root {
  --brand-1: #6C5CE7;
  --brand-2: #4F7CFF;
  --brand-3: #00C2A8;
  --brand-gradient: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 100%);

  --bg: #F3F4FB;
  --surface: #FFFFFF;
  --surface-2: #F7F8FD;
  --border: #E7E9F5;
  --text: #1E2130;
  --text-muted: #6B7089;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(30,33,48,.05);
  --shadow: 0 6px 20px rgba(30,33,48,.07);
  --shadow-lg: 0 16px 40px rgba(30,33,48,.14);

  --sidebar-w: 264px;
}

[data-theme="dark"] {
  --bg: #12131C;
  --surface: #1A1C29;
  --surface-2: #21232F;
  --border: #2D2F3F;
  --text: #EDEEF7;
  --text-muted: #9497B0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .25s ease, color .25s ease;
}

a { color: var(--brand-2); }

::selection { background: rgba(108,92,231,.25); }

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===========================================================
   Auth pages (login / register)
   =========================================================== */
.auth-bg {
  background: radial-gradient(circle at 20% 20%, #7B6EF6 0%, transparent 45%),
              radial-gradient(circle at 80% 80%, #4F7CFF 0%, transparent 45%),
              linear-gradient(135deg, #5B4FE0 0%, #2C3E91 100%);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  min-height: 100vh;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp .5s ease both;
}

.auth-brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  margin: 0 auto;
  box-shadow: 0 8px 20px rgba(108,92,231,.35);
}

/* ===========================================================
   App shell — sidebar layout
   =========================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #241F3D 0%, #1B1830 100%);
  color: #DEDBF5;
  display: flex;
  flex-direction: column;
  padding: 1.1rem .9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem .5rem 1.2rem;
  font-weight: 700;
  font-size: 1.02rem;
  color: #fff;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .7rem;
  border-radius: 10px;
  color: #C6C2E8;
  font-size: .87rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar .nav-link i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar .nav-link:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.sidebar .nav-link.active {
  background: rgba(255,255,255,.14);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand-3);
}

.sidebar-section {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: #8F8AB8;
  padding: 0 .5rem .5rem;
}

.sidebar-section-title a {
  color: #C6C2E8;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.08);
  text-decoration: none;
}

.sidebar-section-title a:hover { background: rgba(255,255,255,.18); color: #fff; }

.team-dot {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--brand-gradient);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
}

.storage-widget {
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  padding: .7rem .8rem;
  font-size: .78rem;
  color: #C6C2E8;
  margin-bottom: .7rem;
}

.progress-track {
  height: 6px;
  border-radius: 6px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--brand-3), var(--brand-2));
  transition: width .4s ease;
}

.progress-fill.is-danger {
  background: linear-gradient(90deg, #ff7676, #ff4757);
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.user-chip-btn {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  background: rgba(255,255,255,.06);
  border: none;
  border-radius: 12px;
  padding: .4rem .5rem;
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
}

.user-chip-btn:hover { background: rgba(255,255,255,.13); }

.user-chip-btn .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,.06);
  color: #C6C2E8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease;
}

.icon-btn:hover { background: rgba(255,255,255,.16); color: #fff; }

/* Mobile topbar */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: .6rem;
  padding: .6rem .8rem;
  background: linear-gradient(90deg, #241F3D, #1B1830);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.mobile-brand {
  font-weight: 700;
  font-size: .95rem;
  flex-grow: 1;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1040;
}

.sidebar-backdrop.show { display: block; }

@media (max-width: 991.98px) {
  .mobile-topbar { display: flex; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-col { width: 100%; }
}

.main-col {
  flex-grow: 1;
  min-width: 0;
}

.app-body {
  min-height: calc(100vh - 0px);
}

/* ===========================================================
   Cards, buttons, generic surfaces
   =========================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-primary {
  background: var(--brand-gradient);
  border: none;
  box-shadow: 0 4px 14px rgba(108,92,231,.28);
}

.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #5f4fe0, #3f6ce8);
  box-shadow: 0 6px 18px rgba(108,92,231,.4);
}

.btn, .form-control, .form-select, .dropdown-menu, .modal-content, .card, .alert, .list-group-item {
  border-radius: var(--radius-sm) !important;
}

.form-control, .form-select {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 .2rem rgba(79,124,255,.15);
  background: var(--surface);
  color: var(--text);
}

.dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: .4rem;
}

.dropdown-item {
  border-radius: 8px;
  color: var(--text);
  font-size: .87rem;
}

.dropdown-item:hover, .dropdown-item:focus {
  background: var(--surface-2);
  color: var(--text);
}

.modal-content {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.modal-header, .modal-footer { border-color: var(--border); }

.list-group-item {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* ===========================================================
   Toolbar / breadcrumb
   =========================================================== */
.toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.breadcrumb {
  background: transparent;
  padding-left: 0;
}

.breadcrumb-item a { color: var(--text-muted); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--brand-2); }
.breadcrumb-item.active { color: var(--text); }

/* ===========================================================
   Stat cards (dashboard summary)
   =========================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .85rem;
  margin-bottom: 1.1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: .8rem;
  animation: fadeInUp .35s ease both;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  color: #fff;
}

.stat-icon.bg-1 { background: var(--brand-gradient); }
.stat-icon.bg-2 { background: linear-gradient(135deg, #00C2A8, #00A8E8); }
.stat-icon.bg-3 { background: linear-gradient(135deg, #FFA751, #FF6B6B); }
.stat-icon.bg-4 { background: linear-gradient(135deg, #A78BFA, #7C3AED); }

.stat-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.15rem; font-weight: 700; color: var(--text); line-height: 1.3; }

/* ===========================================================
   File table
   =========================================================== */
#fileTable {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

#fileTable thead th {
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--text-muted);
  background: var(--surface-2);
}

#fileTable td { border-color: var(--border); vertical-align: middle; }

.item-row {
  transition: background .12s ease;
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: .35;
  margin-right: .4rem;
  font-size: .95rem;
  line-height: 1;
  touch-action: none;
}
.item-row:hover .drag-handle { opacity: .8; }
.drag-handle:active { cursor: grabbing; }
.item-row.dragging { opacity: .4; background: var(--surface-2); }
.item-row.drag-over-top { box-shadow: inset 0 2px 0 0 var(--brand-2); }
.item-row.drag-over-bottom { box-shadow: inset 0 -2px 0 0 var(--brand-2); }

.item-row:hover { background: var(--surface-2); }

.selected-row { background: rgba(79,124,255,.08) !important; }

.icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: .55rem;
  font-size: 1rem;
}

.fw-medium { font-weight: 500; }

.text-purple { color: #7b2ff7; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 1rem;
  color: var(--text-muted);
}

/* ===========================================================
   Drag & drop
   =========================================================== */
#dropZone { position: relative; min-height: 200px; }

.dropzone-overlay {
  position: fixed;
  inset: 0;
  background: rgba(79,124,255,.14);
  backdrop-filter: blur(3px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.dropzone-message {
  background: var(--surface);
  border: 3px dashed var(--brand-2);
  border-radius: var(--radius-lg);
  padding: 2.5rem 3.5rem;
  text-align: center;
  color: var(--brand-1);
  box-shadow: var(--shadow-lg);
}

.dropzone-message i { font-size: 3rem; }
.dropzone-message p { margin: .75rem 0 0; font-weight: 700; }

/* ===========================================================
   Bulk action bar
   =========================================================== */
.bulk-bar {
  background: rgba(79,124,255,.08);
  border: 1px solid rgba(79,124,255,.25);
  border-radius: var(--radius);
  padding: .55rem .85rem;
  animation: fadeInUp .2s ease both;
}

/* ===========================================================
   Activity log
   =========================================================== */
.activity-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .5rem 1rem;
}

.activity-item {
  padding: .8rem 0;
  border-bottom: 1px solid var(--border);
  animation: fadeIn .3s ease both;
}

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

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===========================================================
   Team workspace banner
   =========================================================== */
.team-banner {
  background: linear-gradient(135deg, rgba(108,92,231,.1), rgba(79,124,255,.1));
  border: 1px solid rgba(108,92,231,.25);
  border-radius: var(--radius);
  padding: .7rem 1.1rem;
}

/* ===========================================================
   Misc surfaces reused across pages (teams/admin/shares)
   =========================================================== */
.table { color: var(--text); }
.table > :not(caption) > * > * { border-color: var(--border); background: transparent; color: var(--text); }
.alert-success { background: rgba(0,194,168,.12); color: #04886f; border-color: rgba(0,194,168,.3); }
[data-theme="dark"] .alert-success { color: #4be5cd; }
.alert-danger { background: rgba(255,71,87,.1); color: #d92438; border-color: rgba(255,71,87,.3); }
[data-theme="dark"] .alert-danger { color: #ff8a95; }

/* ===========================================================
   Animations
   =========================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
