/* ============================================================
   ErpBridge Admin — modern minimalist theme
   ============================================================ */

:root {
  --bg:           #fafafa;
  --surface:      #ffffff;
  --border:       #e6e6e9;
  --text:         #1a1a1f;
  --text-muted:   #6b6b75;
  --primary:      #4f46e5;
  --primary-hover:#4338ca;
  --primary-soft: #eef2ff;
  --danger:       #dc2626;
  --danger-soft:  #fef2f2;
  --success:      #059669;
  --success-soft: #ecfdf5;
  --warning:      #d97706;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --radius:       10px;
  --radius-sm:    6px;
  --sidebar-w:    240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

/* ---------- layout: sidebar + main ---------- */
.page {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .top-row {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar .navbar-brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main .top-row {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 5;
}

.content {
  padding: 2rem 2.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- nav menu ---------- */
.nav-menu {
  list-style: none;
  margin: 0;
  padding: 1rem .75rem;
}

.nav-menu li { margin: 2px 0; }

.nav-menu a, .nav-menu .nav-link {
  display: flex;
  align-items: center;  gap: .6rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: .9rem;
  transition: background .12s, color .12s;
  cursor: pointer;
}

.nav-menu a:hover, .nav-menu .nav-link:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
 }

.nav-menu a.active, .nav-menu .nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- forms ---------- */
.form-label {
  display: block;
  font-weight: 500;
  font-size: .85rem;
  margin-bottom: .35rem;
  color: var(--text);
}

.form-control, input[type="text"], input[type="email"],
input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  padding: .5rem .75rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
  outline: none;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.25;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .04s;
  user-select: none;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  text-decoration: none;
}

.btn-secondary, .btn-outline-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled), .btn-outline-secondary:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; color: #fff; text-decoration: none; }

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 .25rem;
}

.card-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ---------- tables ---------- */
.table, table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.table th, table th {
  text-align: left;
  font-weight: 500;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.table td, table td {
  padding: .7rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:hover td, table tbody tr:hover td {
  background: var(--bg);
}

/* ---------- alerts ---------- */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  border: 1px solid transparent;
  margin-bottom: 1rem;
}

.alert-danger { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert-info { background: var(--primary-soft); color: #3730a3; border-color: #c7d2fe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ---------- validation ---------- */
.validation-message, .field-validation-error, .text-danger {
  color: var(--danger);
  font-size: .8rem;
  margin-top: .25rem;
}

input.input-validation-error, .form-control.input-validation-error {
  border-color: var(--danger);
}
input.input-validation-error:focus, .form-control.input-validation-error:focus {
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

/* ---------- login page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.25rem;
}

.login-card h1 {
  font-size: 1.4rem;
  margin-bottom: .25rem;
  text-align: center;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 1.5rem;
}

.login-card .btn { width: 100%; padding: .6rem 1rem; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  font-size: .72rem;
  font-weight: 500;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.badge-danger  { background: var(--danger-soft);  color: #991b1b; border-color: #fecaca; }
.badge-warning { background: #fffbeb;             color: #92400e; border-color: #fde68a; }
.badge-info    { background: var(--primary-soft); color: #3730a3; border-color: #c7d2fe; }

/* ---------- blazor error UI (keep minimal) ---------- */
#blazor-error-ui {
    background: #fef3c7;
    color: #92400e;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.08);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: .875rem;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: #92400e;
    font-size: 1.1rem;
}

.blazor-error-boundary {
    background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvc3ZnQg==") no-repeat 1rem/1.6rem, var(--danger-soft);
    padding: 1rem 1rem 1rem 3.2rem;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ---------- scrollbar (subtle) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }

/* ---------- utility ---------- */
.muted { color: var(--text-muted); }
.text-end { text-align: right; }
.text-center { text-align: center; }
.d-flex { display: flex; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.w-100 { width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
