/* ============================================================
   LMS Building & Constructions — Team Portal
   styles.css — single source of truth for all portal styling
   ------------------------------------------------------------
   © LMS Building & Constructions 2026 - present
   All rights reserved.
   Unauthorised copying or reproduction is strictly prohibited.
   ============================================================ */

/* --- Brand tokens -------------------------------------------- */
:root {
  --steel-blue: #002f44;
  --bright-blue: #26A1DA;
  --soft: #EFF6FB;
  --paper: #FBFCFD;
  --ink: #0A0A0A;
  --muted: #6B7280;
  --hairline: #E5EAED;
  --hairline-soft: rgba(0, 47, 68, 0.10);
  --danger: #C0392B;
  --danger-soft: #FDECEA;
  --success: #1E8449;
  --success-soft: #E9F7EF;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,47,68,0.06);
  --shadow-pop: 0 4px 8px rgba(0,0,0,0.06), 0 12px 28px rgba(0,47,68,0.12);

  --header-h: 64px;
  --max-width: 1200px;
}

/* --- Reset --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Archivo', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--steel-blue); text-decoration: none; }
a:hover { color: var(--bright-blue); }
button { font-family: inherit; cursor: pointer; }

/* --- Display type ------------------------------------------- */
h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--steel-blue);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.75rem, 2.4vw, 2.25rem); letter-spacing: -0.045em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
small { color: var(--muted); }

/* --- Buttons ------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--steel-blue);
  color: white;
}
.btn-primary:hover { background: #003e5a; color: white; }
.btn-primary:active { transform: translateY(1px); }
.btn-secondary {
  background: white;
  color: var(--steel-blue);
  border-color: var(--hairline);
}
.btn-secondary:hover { background: var(--soft); border-color: var(--bright-blue); }
.btn-danger {
  background: white;
  color: var(--danger);
  border-color: var(--hairline);
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--steel-blue); background: var(--soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Forms --------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--steel-blue);
}
.field input, .field select {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--bright-blue);
  box-shadow: 0 0 0 3px rgba(38, 161, 218, 0.15);
}

/* --- Auth pages (login, account) ---------------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: linear-gradient(180deg, var(--soft) 0%, var(--paper) 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 40px 32px;
}
.auth-card .logo {
  width: 96px;
  height: auto;
  margin: 0 auto 24px;
}
.auth-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 6px; }
.auth-card .auth-sub { text-align: center; color: var(--muted); margin-bottom: 28px; font-size: 0.95rem; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-card .auth-footer { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--muted); }

/* --- App header (matches the Vercel portal) ----------------- */
.app-header {
  background: white;
  border-bottom: 1px solid var(--hairline);
  height: var(--header-h);
}
.app-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--steel-blue);
}
.app-header .brand img { width: 32px; height: 32px; }
.app-header .brand-divider {
  width: 1px;
  height: 22px;
  background: var(--hairline);
}
.app-header .brand-label {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--steel-blue);
}
.app-header .user-block {
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-header .user-text {
  text-align: right;
  line-height: 1.2;
  text-decoration: none;
}
.app-header .user-text:hover .user-name { color: var(--bright-blue); }
.app-header .user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--steel-blue);
  transition: color 0.15s;
}
.app-header .user-role {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.btn-signout {
  background: transparent;
  border: none;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.btn-signout:hover { color: var(--steel-blue); background: var(--soft); }

@media (max-width: 600px) {
  .app-header .brand-divider, .app-header .brand-label, .app-header .user-text { display: none; }
  .app-header-inner { padding: 0 14px; }
}

/* --- Page shell --------------------------------------------- */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header h1 { margin-bottom: 4px; }
.page-header p { color: var(--muted); margin: 0; }

/* --- Tool grid (dashboard) ---------------------------------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
  min-height: 150px;
}
.tool-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--accent, var(--bright-blue));
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
  border-color: var(--accent, var(--bright-blue));
  color: var(--ink);
}
.tool-card .icon {
  font-size: 2rem;
  line-height: 1;
}
.tool-card .name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--steel-blue);
}
.tool-card .desc {
  font-size: 0.9rem;
  color: var(--muted);
  flex-grow: 1;
}
.tool-card .open {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bright-blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tool-card .ext-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.85em;
  color: var(--muted);
  font-weight: 500;
}

/* --- Generic card / panel ----------------------------------- */
.panel {
  background: white;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
}
.panel h2 { margin-top: 0; }

/* --- Tables (admin user list) ------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.table th, .table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}
.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table .actions .btn { padding: 6px 10px; font-size: 0.82rem; }

.role-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.role-pill.admin { background: var(--steel-blue); color: white; }
.role-pill.worker { background: var(--soft); color: var(--steel-blue); }

/* --- Alerts -------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(192, 57, 43, 0.25); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(30, 132, 73, 0.25); }
.alert-info { background: var(--soft); color: var(--steel-blue); border-color: var(--hairline-soft); }

/* --- Tool page (back link + body) --------------------------- */
.tool-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.tool-back:hover { background: var(--soft); color: var(--steel-blue); }

.tool-placeholder {
  text-align: center;
  padding: 60px 24px;
  background: white;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
}
.tool-placeholder .big-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

/* --- Footer -------------------------------------------------- */
.app-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--hairline);
  margin-top: 48px;
}
.app-footer a { color: var(--muted); }

/* --- Spinner ------------------------------------------------- */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--hairline);
  border-top-color: var(--bright-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Responsive --------------------------------------------- */
@media (max-width: 600px) {
  .auth-card { padding: 28px 22px; }
  .page { padding: 20px 14px 48px; }
  .panel { padding: 18px; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}
