/* =================================
   Token (acuan: docs/design/template.html)
================================= */

:root {
  --background: #ffffff;
  --foreground: #0a0a0a;

  --card: #ffffff;
  --card-foreground: #0a0a0a;

  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --text-secondary: #525252;
  --text-body: #262626;
  --surface-subtle: #fafafa;

  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #a3a3a3;

  --primary: #171717;
  --primary-hover: #262626;
  --primary-foreground: #fafafa;

  --accent: #f5f5f5;
  --accent-foreground: #171717;

  --success: #16a34a;
  --warning: #f59e0b;
  --destructive: #dc2626;
  --destructive-subtle: #fef2f2;
  --destructive-border: #fecaca;

  --overlay: rgba(0, 0, 0, 0.3);
  --header-background: rgba(255, 255, 255, 0.9);
  --shadow-drawer: 10px 0 30px rgba(0, 0, 0, 0.08);
  --shadow-dialog: 0 10px 30px rgba(0, 0, 0, 0.12);

  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-width: 240px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* =================================
   Dasar
================================= */

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

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
}

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

/* Judul yang difokuskan otomatis oleh FocusOnNavigate (tabindex=-1) bukan kontrol interaktif. */
[tabindex="-1"]:focus {
  outline: none;
}

.text-muted {
  color: var(--muted-foreground);
}

/* =================================
   Layout
================================= */

.app {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--background);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  z-index: 100;
  transition: transform 0.2s ease;
}

.main {
  width: 100%;
  margin-left: var(--sidebar-width);
  min-width: 0;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 90;
}

/* =================================
   Sidebar
================================= */

.sidebar-header {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  margin-bottom: 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
}

.logo-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 13px;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-label {
  padding: 0 10px;
  margin-bottom: 7px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.nav-item.active {
  background: var(--accent);
  color: var(--foreground);
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.profile-info {
  min-width: 0;
  flex: 1;
}

.profile-name {
  font-size: 13px;
  font-weight: 500;
}

.profile-email {
  margin-top: 2px;
  color: var(--muted-foreground);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =================================
   Header
================================= */

.header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--header-background);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-button {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--background);
  border-radius: var(--radius-sm);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-foreground);
  font-size: 13px;
}

.breadcrumb-current {
  color: var(--foreground);
}

/* =================================
   Tombol
================================= */

.button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

.button:hover {
  background: var(--accent);
}

.button-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.button-primary:hover {
  background: var(--primary-hover);
}

.button-block {
  width: 100%;
  height: 36px;
}

.icon-button {
  width: 34px;
  padding: 0;
}

/* =================================
   Konten dan kartu
================================= */

.content {
  display: block;
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px;
}

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

.page-header h1 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.page-header p {
  margin-top: 6px;
  color: var(--muted-foreground);
  font-size: 13px;
}

.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 0;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
}

.card-description {
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.card-content {
  padding: 18px;
}

.error-state {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  color: var(--destructive);
}

.error-state-text {
  flex: 1;
  color: var(--foreground);
}

/* =================================
   Form
================================= */

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.label {
  font-size: 13px;
  font-weight: 500;
}

.input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: var(--background);
  font-size: 14px;
}

.input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 0;
  border-color: var(--ring);
}

.input.invalid {
  border-color: var(--destructive);
}

.validation-message {
  color: var(--destructive);
  font-size: 12px;
}

.alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.alert-error {
  background: var(--destructive-subtle);
  border-color: var(--destructive-border);
  color: var(--destructive);
}

/* =================================
   Halaman akun (login, status, error)
================================= */

.akun-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--surface-subtle);
}

.akun-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
}

.akun-logo {
  margin-bottom: 24px;
}

.akun-judul {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.akun-deskripsi {
  margin: 6px 0 20px;
  color: var(--muted-foreground);
  font-size: 13px;
}

/* =================================
   Error tak tertangani dan reconnect Blazor
================================= */

#blazor-error-ui {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  padding: 12px 20px;
  background: var(--destructive-subtle);
  border-top: 1px solid var(--destructive-border);
  color: var(--destructive);
  font-size: 13px;
}

#blazor-error-ui .reload {
  margin-left: 8px;
  text-decoration: underline;
}

#blazor-error-ui .dismiss {
  position: absolute;
  right: 16px;
  top: 8px;
  border: 0;
  background: transparent;
  font-size: 18px;
}

.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation {
  display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
  display: block;
}

#components-reconnect-modal {
  width: 20rem;
  margin: 20vh auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-dialog);
}

#components-reconnect-modal::backdrop {
  background: var(--overlay);
}

.components-reconnect-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  font-size: 13px;
}

.components-rejoining-animation {
  position: relative;
  width: 48px;
  height: 48px;
}

.components-rejoining-animation div {
  position: absolute;
  border: 2px solid var(--primary);
  border-radius: 50%;
  animation: rejoining 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-rejoining-animation div:nth-child(2) {
  animation-delay: -0.5s;
}

@keyframes rejoining {
  0% {
    top: 24px;
    left: 24px;
    width: 0;
    height: 0;
    opacity: 1;
  }

  100% {
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    opacity: 0;
  }
}

/* =================================
   Responsif (breakpoint template)
================================= */

@media (max-width: 800px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-drawer);
  }

  .main {
    margin-left: 0;
  }

  .menu-button {
    display: inline-flex;
  }

  .overlay.show {
    display: block;
  }

  .header {
    padding: 0 18px;
  }

  .content {
    padding: 20px 18px;
  }
}

@media (max-width: 560px) {
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .breadcrumb {
    display: none;
  }
}
