/*
 * ROLLerUP HR Reviews — shared component layer (modernized, light-only).
 * Single source of truth for reusable UI. Loaded after ru-brand.css and
 * BEFORE any per-page {% block head %} styles, so pages can still override
 * during the incremental migration. Replaces the duplicated inline blocks.
 */

/* ----------------------------------------------------------------- *
 * Layout shell
 * ----------------------------------------------------------------- */
[x-cloak] { display: none !important; }

.ru-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ru-bg-page);
}

.ru-top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 56px;
  display: flex;
  align-items: center;
  padding: 0 var(--ru-space-5);
  gap: var(--ru-space-3);
  border-bottom: 1px solid var(--ru-border);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
}
.ru-top-bar img { height: 24px; display: block; }

.ru-main {
  flex: 1;
  display: flex;
  align-items: center;       /* centered card layout (auth pages) */
  justify-content: center;
  padding: var(--ru-space-7) var(--ru-space-4);
}

/* Page container for content surfaces — replaces the per-template
 * `.ru-main { align-items: flex-start }` hack as templates migrate. */
.ru-page {
  width: 100%;
  max-width: var(--ru-content-wide);
  margin: 0 auto;
}
.ru-page--narrow { max-width: var(--ru-content-narrow); }

/* ----------------------------------------------------------------- *
 * Card
 * ----------------------------------------------------------------- */
.ru-card {
  width: 100%;
  max-width: 420px;
  background: var(--ru-bg);
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius-lg);
  box-shadow: var(--ru-shadow-card);
  padding: var(--ru-space-6);
}
.ru-card h1 { font-size: var(--ru-font-h1); margin: 0 0 var(--ru-space-2); }

/* ----------------------------------------------------------------- *
 * Buttons
 * ----------------------------------------------------------------- */
.ru-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ru-space-2);
  min-height: 38px;
  background: var(--ru-brand);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--ru-radius);
  padding: var(--ru-space-2) var(--ru-space-4);
  font-family: var(--ru-font-sans);
  font-size: var(--ru-font-medium);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ru-dur-fast) var(--ru-ease),
              box-shadow var(--ru-dur-fast) var(--ru-ease),
              border-color var(--ru-dur-fast) var(--ru-ease),
              transform var(--ru-dur-fast) var(--ru-ease);
}
.ru-btn:hover { background: var(--ru-brand-hover); text-decoration: none; }
.ru-btn:active { background: var(--ru-brand-pressed); transform: translateY(0.5px); }
.ru-btn:focus-visible { outline: none; box-shadow: var(--ru-focus-ring); }
.ru-btn[aria-disabled="true"], .ru-btn:disabled { opacity: 0.5; cursor: default; pointer-events: none; }

.ru-btn-secondary {
  background: var(--ru-bg);
  color: var(--ru-text);
  border-color: var(--ru-border-strong);
}
.ru-btn-secondary:hover { background: var(--ru-bg-muted); }
.ru-btn-secondary:active { background: var(--ru-bg-muted); }

.ru-btn-ghost {
  background: transparent;
  color: var(--ru-text-secondary);
  border-color: transparent;
}
.ru-btn-ghost:hover { background: var(--ru-bg-muted); color: var(--ru-text); }

.ru-btn-danger { background: var(--ru-danger); }
.ru-btn-danger:hover { background: #B91C1C; }

.ru-btn-sm { min-height: 30px; padding: var(--ru-space-1) var(--ru-space-3); font-size: var(--ru-font-small); }
.ru-btn-lg { min-height: 46px; padding: var(--ru-space-3) var(--ru-space-6); font-size: var(--ru-font-large); }

/* ----------------------------------------------------------------- *
 * Primary navigation
 * ----------------------------------------------------------------- */
.ru-nav { display: flex; align-items: center; gap: 2px; margin-left: var(--ru-space-3); flex: 1; flex-wrap: wrap; }
.ru-nav a {
  color: var(--ru-text-secondary);
  text-decoration: none;
  font-size: var(--ru-font-medium);
  font-weight: 500;
  padding: 7px 11px;
  border-radius: var(--ru-radius);
  white-space: nowrap;
  transition: background var(--ru-dur-fast) var(--ru-ease), color var(--ru-dur-fast) var(--ru-ease);
}
.ru-nav a:hover { color: var(--ru-text); background: var(--ru-bg-muted); text-decoration: none; }
.ru-nav a:focus-visible { outline: none; box-shadow: var(--ru-focus-ring); }
.ru-nav a[aria-current="page"] { color: var(--ru-brand); background: var(--ru-brand-bg-tint); }
.ru-nav .ru-nav-spacer { margin-left: auto; }
.ru-nav form { margin: 0; }
.ru-nav-signout {
  background: transparent;
  border: 1px solid var(--ru-border-strong);
  color: var(--ru-text-secondary);
  border-radius: var(--ru-radius);
  padding: 7px 11px;
  font-size: var(--ru-font-medium);
  font-family: var(--ru-font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--ru-dur-fast) var(--ru-ease), color var(--ru-dur-fast) var(--ru-ease);
}
.ru-nav-signout:hover { background: var(--ru-bg-muted); color: var(--ru-text); }
.ru-nav-signout:focus-visible { outline: none; box-shadow: var(--ru-focus-ring); }

/* ----------------------------------------------------------------- *
 * Badges / status pills
 * ----------------------------------------------------------------- */
.ru-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--ru-radius-full);
  padding: 3px 10px;
  font-size: var(--ru-font-small);
  font-weight: 600;
  line-height: 1.4;
  background: var(--ru-brand-bg-tint);
  color: var(--ru-brand);
  border: 1px solid var(--ru-brand-border);
}
.ru-badge-muted { background: var(--ru-bg-muted); color: var(--ru-text-secondary); border-color: var(--ru-border); }
.ru-badge-success { background: var(--ru-success-tint); color: var(--ru-success); border-color: var(--ru-success-border); }
.ru-badge-warning { background: var(--ru-warning-tint); color: var(--ru-warning); border-color: var(--ru-warning-border); }
.ru-badge-danger { background: var(--ru-danger-tint); color: var(--ru-danger); border-color: var(--ru-danger-border); }

/* ----------------------------------------------------------------- *
 * Alerts / banners
 * ----------------------------------------------------------------- */
.ru-alert {
  border: 1px solid var(--ru-danger-border);
  color: var(--ru-danger);
  background: var(--ru-danger-tint);
  border-radius: var(--ru-radius);
  padding: var(--ru-space-2-5) var(--ru-space-3);
  font-size: var(--ru-font-medium);
  margin: 0 0 var(--ru-space-3);
}
.ru-alert-success { border-color: var(--ru-success-border); color: var(--ru-success); background: var(--ru-success-tint); }
.ru-alert-warning { border-color: var(--ru-warning-border); color: var(--ru-warning); background: var(--ru-warning-tint); }
.ru-alert-info { border-color: var(--ru-info-border); color: var(--ru-brand); background: var(--ru-info-tint); }

/* ----------------------------------------------------------------- *
 * Tables (modern — comfortable, hairline rows, hover, rounded shell)
 * ----------------------------------------------------------------- */
.ru-table { width: 100%; border-collapse: collapse; font-size: var(--ru-font-medium); }
.ru-table th {
  text-align: left;
  font-weight: 600;
  font-size: var(--ru-font-small);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ru-text-tertiary);
  background: var(--ru-bg-muted);
  padding: var(--ru-space-2-5) var(--ru-space-3);
  border-bottom: 1px solid var(--ru-border);
}
.ru-table td {
  padding: var(--ru-space-2-5) var(--ru-space-3);
  border-bottom: 1px solid var(--ru-border);
  color: var(--ru-text);
}
.ru-table tbody tr { transition: background var(--ru-dur-fast) var(--ru-ease); }
.ru-table tbody tr:hover { background: var(--ru-bg-muted); }
.ru-table tbody tr:last-child td { border-bottom: 0; }
/* Rounded, scrollable container for any table. */
.ru-table-wrap {
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius-lg);
  overflow: hidden;
  overflow-x: auto;
  background: var(--ru-bg);
}

/* ----------------------------------------------------------------- *
 * Form fields (modern inputs + restrained global native styling)
 * ----------------------------------------------------------------- */
.ru-field { display: flex; flex-direction: column; gap: 6px; }
.ru-label { font-size: var(--ru-font-medium); font-weight: 600; color: var(--ru-text); }
.ru-hint { font-size: var(--ru-font-small); color: var(--ru-text-tertiary); }

.ru-input, .ru-select, .ru-textarea,
input[type="text"], input[type="email"], input[type="date"],
input[type="number"], input[type="search"], input[type="password"],
select, textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  background: var(--ru-bg);
  color: var(--ru-text);
  border: 1px solid var(--ru-border-strong);
  border-radius: var(--ru-radius);
  padding: var(--ru-space-2) var(--ru-space-3);
  font-family: var(--ru-font-sans);
  font-size: var(--ru-font-medium);
  line-height: var(--ru-line-normal);
  transition: border-color var(--ru-dur-fast) var(--ru-ease), box-shadow var(--ru-dur-fast) var(--ru-ease);
}
.ru-textarea, textarea { min-height: 96px; resize: vertical; }
.ru-input:focus, .ru-select:focus, .ru-textarea:focus,
input[type="text"]:focus, input[type="email"]:focus, input[type="date"]:focus,
input[type="number"]:focus, input[type="search"]:focus, input[type="password"]:focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--ru-brand);
  box-shadow: var(--ru-focus-ring);
}
::placeholder { color: var(--ru-text-tertiary); }

/* Keep native radio/checkbox accent on-brand (used by the 1-5 rating form). */
input[type="radio"], input[type="checkbox"] { accent-color: var(--ru-brand); }

/* ----------------------------------------------------------------- *
 * Empty + loading states
 * ----------------------------------------------------------------- */
.ru-empty {
  text-align: center;
  padding: var(--ru-space-7) var(--ru-space-4);
  border: 1px dashed var(--ru-border-strong);
  border-radius: var(--ru-radius-lg);
  color: var(--ru-text-tertiary);
  background: var(--ru-bg);
}
.ru-empty h3 { color: var(--ru-text-secondary); margin: 0 0 var(--ru-space-1); font-size: var(--ru-font-large); }

.ru-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--ru-bg-muted);
  border-radius: var(--ru-radius);
}
.ru-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: ru-shimmer 1.4s infinite;
}
@keyframes ru-shimmer { 100% { transform: translateX(100%); } }

/* ----------------------------------------------------------------- *
 * Helpers
 * ----------------------------------------------------------------- */
.ru-muted { color: var(--ru-text-secondary); font-size: var(--ru-font-medium); }
.ru-tertiary { color: var(--ru-text-tertiary); font-size: var(--ru-font-small); }
.ru-stack > * + * { margin-top: var(--ru-space-3); }

/* ----------------------------------------------------------------- *
 * Icons + tinted icon chips ("life")
 * ----------------------------------------------------------------- */
.ru-icon { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }

/* Soft tinted rounded square behind an icon (Zoho-People style). */
.ru-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--ru-radius-lg);
  background: var(--ru-brand-bg-tint);
  color: var(--ru-brand);
  flex-shrink: 0;
}
.ru-icon-badge.sm { width: 34px; height: 34px; border-radius: var(--ru-radius); }
.ru-icon-badge.lg { width: 56px; height: 56px; }
/* Accent variants for variety across tiles. */
.ru-icon-badge.blue   { background: #EAF2FE; color: #2A81F9; }
.ru-icon-badge.green  { background: #E6F6EF; color: #0E9F6E; }
.ru-icon-badge.purple { background: #F0ECFE; color: #7C5CFC; }
.ru-icon-badge.amber  { background: #FDF3E7; color: #C77700; }
.ru-icon-badge.teal   { background: #E1F5F4; color: #0E9F9A; }
.ru-icon-badge.rose   { background: #FDECF1; color: #E0457B; }
.ru-icon-badge.slate  { background: #EEF1F4; color: #51607A; }

/* Nav links carry an icon + label. */
.ru-nav a { display: inline-flex; align-items: center; gap: 7px; }
.ru-nav a .ru-icon { color: var(--ru-text-tertiary); transition: color var(--ru-dur-fast) var(--ru-ease); }
.ru-nav a:hover .ru-icon, .ru-nav a[aria-current="page"] .ru-icon { color: var(--ru-brand); }

/* User chip (avatar + name + sign out) on the right of the nav. */
.ru-user { display: inline-flex; align-items: center; gap: var(--ru-space-2); }
.ru-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--ru-radius-full);
  background: var(--ru-brand);
  color: #fff;
  font-size: var(--ru-font-small);
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.ru-user-name { font-size: var(--ru-font-medium); font-weight: 600; color: var(--ru-text); }
.ru-nav-signout { display: inline-flex; align-items: center; gap: 6px; }

/* ----------------------------------------------------------------- *
 * Auth (login / no-record / 403) flourish
 * ----------------------------------------------------------------- */
.ru-auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--ru-radius-xl);
  background: var(--ru-brand-bg-tint);
  color: var(--ru-brand);
  margin-bottom: var(--ru-space-3);
}
.ru-auth-icon.warn { background: var(--ru-warning-tint); color: var(--ru-warning); }
.ru-auth-icon.danger { background: var(--ru-danger-tint); color: var(--ru-danger); }
.ru-card.ru-auth { max-width: 400px; box-shadow: var(--ru-shadow-raised); padding: var(--ru-space-7) var(--ru-space-6); }

/* ----------------------------------------------------------------- *
 * Launchpad tiles (home) with icon chips
 * ----------------------------------------------------------------- */
.ru-tilegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--ru-space-3);
  margin-top: var(--ru-space-3);
}
.ru-tile {
  display: flex;
  gap: var(--ru-space-3);
  background: var(--ru-bg);
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius-lg);
  box-shadow: var(--ru-shadow-card);
  padding: var(--ru-space-4);
  text-decoration: none;
  color: var(--ru-text);
  transition: box-shadow var(--ru-dur) var(--ru-ease), transform var(--ru-dur) var(--ru-ease), border-color var(--ru-dur) var(--ru-ease);
}
.ru-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--ru-shadow-raised); border-color: var(--ru-brand-border); }
.ru-tile:focus-visible { outline: none; box-shadow: var(--ru-focus-ring); }
.ru-tile-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ru-tile-title { display: inline-flex; align-items: center; gap: 6px; font-size: var(--ru-font-large); font-weight: 600; color: var(--ru-text); }
.ru-tile-title .ru-icon { color: var(--ru-text-tertiary); transition: transform var(--ru-dur) var(--ru-ease); }
.ru-tile:hover .ru-tile-title .ru-icon { transform: translateX(3px); color: var(--ru-brand); }
.ru-tile-desc { color: var(--ru-text-secondary); font-size: var(--ru-font-medium); line-height: var(--ru-line-normal); }
.ru-section-label { color: var(--ru-text-tertiary); font-size: var(--ru-font-small); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin: var(--ru-space-5) 0 0; }

/* ----------------------------------------------------------------- *
 * Responsive
 * ----------------------------------------------------------------- */
@media (max-width: 720px) {
  .ru-top-bar { padding: 0 var(--ru-space-3); flex-wrap: wrap; min-height: auto; }
  .ru-nav { gap: 0; margin-left: 0; width: 100%; padding-bottom: var(--ru-space-2); }
  .ru-nav a span, .ru-user-name { display: none; }      /* icon-only nav on phones */
  .ru-nav a { padding: 8px; }
  .ru-main { padding: var(--ru-space-4) var(--ru-space-3); }
  .ru-tilegrid { grid-template-columns: 1fr; }
}
