/* Recreates the MUI look of the original Next.js dashboard. */
:root {
  --primary: #0072C6;
  --primary-dark: #005a9e;
  --primary-soft: rgba(0, 114, 198, 0.08);
  --text: rgba(0, 0, 0, 0.87);
  --muted: rgba(0, 0, 0, 0.6);
  --border: rgba(0, 0, 0, 0.23);
  --divider: rgba(0, 0, 0, 0.12);
  --bg: #f5f5f5;
  --paper: #fff;
  --error: #d32f2f;
  --drawer: 280px;
  --appbar: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

[hidden] { display: none !important; }

.icon { width: 24px; height: 24px; fill: currentColor; flex-shrink: 0; }

.paper {
  background: var(--paper);
  border-radius: 4px;
  box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
  padding: 32px;
  margin-top: 16px;
}
.paper h2 { font-size: 1.25rem; font-weight: 500; margin: 0 0 12px; }
.paper h2.primary { color: var(--primary); }
.muted { color: var(--muted); font-size: 0.875rem; margin: 0 0 24px; }

/* ---- Fields ---------------------------------------------------------- */
.field { display: block; margin: 16px 0 8px; }
.field > span { display: block; font-size: 0.875rem; color: var(--muted); margin-bottom: 4px; }
.field input, .field select {
  width: 100%;
  font: inherit;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
}
.field input:hover, .field select:hover { border-color: var(--text); }
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.field:focus-within > span { color: var(--primary); }
.field small { display: block; margin: 4px 14px 0; font-size: 0.75rem; color: var(--muted); }

/* ---- Buttons --------------------------------------------------------- */
.btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  min-width: 64px;
  min-height: 36.5px;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin: 24px 8px 16px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary { background: var(--primary); color: #fff; border: 0; box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outlined { background: transparent; color: var(--primary); border: 1px solid rgba(0, 114, 198, 0.5); }
.btn-outlined:hover { background: var(--primary-soft); border-color: var(--primary); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-block { width: 100%; }

.spinner {
  width: 20px; height: 20px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Alerts ---------------------------------------------------------- */
.alert { padding: 6px 16px; line-height: 1.43; font-size: 0.875rem; border-radius: 4px; margin: 0 0 16px; padding-top: 12px; padding-bottom: 12px; }
.alert-error   { background: #fdeded; color: #5f2120; }
.alert-success { background: #edf7ed; color: #1e4620; }
.alert-warning { background: #fff4e5; color: #663c00; }
.alert-info    { background: #e5f6fd; color: #014361; }

/* ---- Login ----------------------------------------------------------- */
.login-body { background: #fff; }
.login-wrap { max-width: 444px; margin: 64px auto 0; padding: 0 16px; }
.login-card { display: flex; flex-direction: column; align-items: center; margin-top: 24px; }
.login-card form, .login-card .alert { width: 100%; }
.login-card .logo { object-fit: contain; margin-bottom: 16px; }
.login-title { font-size: 1.25rem; font-weight: 500; margin: 0 0 0.35em; }
.login-subtitle { font-size: 0.875rem; font-weight: 500; color: var(--muted); margin: 0 0 24px; }

/* ---- Dashboard layout ------------------------------------------------ */
.appbar {
  position: fixed;
  top: 0; right: 0; left: var(--drawer);
  height: var(--appbar);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 10;
  box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14);
}
.appbar-title { flex: 1; font-size: 1.25rem; font-weight: 500; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-meta { font-size: 0.875rem; }
.icon-btn { background: none; border: 0; color: inherit; padding: 8px; margin-left: -12px; border-radius: 50%; cursor: pointer; display: none; }

.drawer {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--drawer);
  background: #fff;
  border-right: 1px solid var(--divider);
  overflow-y: auto;
  z-index: 20;
}
.drawer hr { border: 0; border-top: 1px solid var(--divider); margin: 0; }
.drawer-logo { display: flex; justify-content: center; align-items: center; min-height: 64px; padding: 16px; }
.drawer-logo img { object-fit: contain; }

.menu { list-style: none; margin: 0; padding: 8px 0; }
.menu a, .menu-logout {
  display: flex;
  align-items: center;
  gap: 32px;
  width: 100%;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.menu a .icon { color: var(--muted); }
.menu a:hover, .menu-logout:hover { background: rgba(0,0,0,0.04); }
.menu a.selected { background: var(--primary-soft); }
.menu a.selected .icon { color: var(--primary); }
.menu-logout { color: var(--error); }

.content { margin-left: var(--drawer); padding: calc(var(--appbar) + 24px) 24px 24px; }
.container { max-width: 900px; margin: 0 auto; }

.scrim { display: none; }

@media (max-width: 599px) {
  .appbar { left: 0; padding: 0 16px; }
  .appbar-meta { display: none; }
  .icon-btn { display: inline-flex; }
  .content { margin-left: 0; padding: calc(var(--appbar) + 16px) 16px 16px; }
  .paper { padding: 24px 16px; }
  .drawer { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 8px 10px -5px rgba(0,0,0,.2); }
  .drawer-open .drawer { transform: none; }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 15; }
}
