/* ============================================================================
   WorkForce — shared primitives (employee app + auth screens)
   ========================================================================= */

body {
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* On a wide screen the employee app is presented as a phone: the page gets a
   soft coral wash and the shell floats in the middle as a device. */
@media (min-width: 900px) {
  body:not(.ac-body) {
    background: var(--grad-page);
    background-attachment: fixed;
    min-height: 100dvh;
    padding: 28px 0;
  }
}

.app-shell {
  max-width: var(--max-content-width);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--color-bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Every employee-facing screen — signed-in hub pages (dashboard, profile, …),
   full-screen flows (capture, shift, field-work), and the pre-auth gate
   screens (welcome/language, login, onboarding) alike — renders as one
   phone-shaped device on a wide viewport, so no screen looks "unframed"
   next to the rest of the module. Centralized here (loaded by every
   employee page) rather than per-page CSS so the whole module stays in
   sync; employee-nav.js's bottom bar math depends on these exact numbers
   for the shell classes that also render that nav. */
@media (min-width: 900px) {
  .emp-shell, .cap-shell, .sh-shell, .fw-shell, .shift-shell, .lang-shell, .auth-shell {
    min-height: auto;
    height: calc(100dvh - 56px);
    max-height: 900px;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 38px;
    box-shadow:
      0 0 0 10px #1d1420,
      0 0 0 12px #33232c,
      0 40px 80px rgba(90, 30, 45, 0.28);
    scrollbar-width: none;
  }
  .emp-shell::-webkit-scrollbar,
  .cap-shell::-webkit-scrollbar,
  .sh-shell::-webkit-scrollbar,
  .fw-shell::-webkit-scrollbar,
  .shift-shell::-webkit-scrollbar,
  .lang-shell::-webkit-scrollbar,
  .auth-shell::-webkit-scrollbar { display: none; }
}

.page-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

.page-header h1 {
  font-size: var(--font-size-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-content {
  flex: 1;
  padding: var(--space-4);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-5));
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: 14px var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }

.btn-danger {
  background: linear-gradient(135deg, #f0566a 0%, #c31e37 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(195, 30, 55, 0.28);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) { background: var(--color-primary-pale); }

/* ── Fields ───────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.field label {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text-muted);
}

.field-row { display: flex; gap: var(--space-2); }
.field-row input { flex: 1 1 auto; min-width: 0; }
.field-row select { flex: 0 0 auto; }

.password-input-wrap { position: relative; }
.password-input-wrap input { width: 100%; padding-right: 56px; }

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: var(--font-size-xs);
  font-weight: 800;
  cursor: pointer;
  padding: 8px 10px;
}

.field input,
.field select,
.field textarea {
  padding: 13px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-md);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea { resize: vertical; min-height: 80px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.16);
}

.field-error {
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  min-height: 16px;
}

/* ── Bottom sheet (shared by admin + employee forms) ──────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 20, 28, 0.46);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: var(--z-modal);
  animation: sheet-fade 0.2s ease;
}

.sheet-box {
  width: 100%;
  max-width: var(--max-content-width);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-5) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-lg);
  animation: sheet-rise 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheet-fade { from { opacity: 0; } }
@keyframes sheet-rise { from { transform: translateY(22px); opacity: 0; } }

@media (min-width: 480px) {
  .sheet-overlay { align-items: center; }
  .sheet-box { border-radius: var(--radius-xl); }
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.sheet-header h2 { font-size: var(--font-size-lg); font-weight: 800; letter-spacing: -0.02em; }

.sheet-close {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-primary-pale);
  color: var(--color-primary);
  font-size: 16px;
}

.sheet-actions { display: flex; gap: var(--space-2); margin-top: var(--space-4); }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 5px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info); }
.badge-neutral { background: #f1e9ea;                 color: var(--color-text-muted); }

/* ── Utilities ────────────────────────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Accessibility floor */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
