/*
 * Admin-specific styles
 * This file loads ONLY for admin pages to avoid conflicts with legacy CSS
 * Admin UI uses DaisyUI 5.5.14 + Nexus theme patterns
 */

/* Table row hover effect */
.table tbody tr:hover {
  background-color: #f3f4f6 !important;
  transition: background-color 0.15s ease-in-out;
}

/* ==========================================================================
   P6 — appended to app/assets/stylesheets/admin.css (layout: admin_page)
   ========================================================================== */

/* ===== Login page (app/views/sessions/new.html.erb) =======================
   SessionsController uses `layout "admin_page"`, which links only
   shared/fonts + tailwind + admin + fontawesome + tiptap-editor.

   Audit S4: the page's chrome (`.login-container`, `.login-card`) and its
   controls (`.input-field`, `.submit-button`, `.link-button`) used to live in
   app/assets/stylesheets/application.css — a Sprockets manifest that
   admin_page never links — so the page rendered with no styling at all.

   Fixed by splitting the two concerns:
     * controls  -> DaisyUI (`input w-full`, `btn btn-primary`, `btn btn-link`
                    — `input w-full` is what AdminFormBuilder emits; DaisyUI 5
                    dropped v4's `input-bordered`), the documented house style
                    for the admin surface, already loaded via tailwind.css.
                    This also retires three dangerously generic global class
                    names (`.input-field` / `.submit-button` / `.link-button`).
     * page chrome -> the `login-*` rules below, i.e. the same home the
                    inline-style sweep already chose for the rest of this
                    page's CSS. DaisyUI has no "centred single-card auth page"
                    component, so the geometry stays hand-written.
   ========================================================================= */

/* Full-height tinted page the sign-in card sits on. The side padding keeps
   the card off the screen edges on a phone. */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 1rem;
  background-color: #ebf4ff;
}

/* Sizing/placement only — surface, radius and shadow come from DaisyUI's
   `card` + `bg-base-100 shadow-xl` on the same element. */
.login-card {
  width: 100%;
  max-width: 450px;
  margin: 2rem auto;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-subtitle {
  color: #4B5563;
  font-size: 1.125rem;
  font-weight: 400;
}

.login-error {
  color: #b91c1c;
  text-align: center;
  margin-bottom: 1.25rem;
}

/* Instruction line above the email / OTP form. */
.login-hint {
  text-align: center;
  color: #4B5563;
  margin-bottom: 1.5rem;
}

.login-label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

/* Label + input pair. Replaces the `margin-bottom` the old `.input-field`
   rule carried, so the gap survives the move to DaisyUI's `input`. */
.login-field {
  margin-bottom: 1.5rem;
}

/* "Resend code" + "Use a different email" row. */
.login-actions {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  margin-top: 1.25rem;
}

/* ===== Glossary term show (app/views/admin/glossary_terms/show.html.erb) ===
   Lifted from a page-level <style> block that used a bare `img` selector.
   Imported term bodies carry hard-coded height attributes, so the
   `!important` is retained (the competing declaration is an element-level
   attribute/utility, and the original was `!important` too).
   SCOPED CHANGE: the original bare `img` rule also hit the admin sidebar and
   topbar logos (`.h-8`), stretching them to natural height on this one page.
   Scoping to the page root restores the intended `h-8` there — see the P6
   report, item 6.
   ========================================================================= */
.admin-glossary-term-show img {
  height: auto !important;
}

/* ==========================================================================
   S14 — rules lifted out of Stimulus controllers that were writing inline
   styles through the CSSOM. Both only ever render under layouts/admin_page.
   ========================================================================== */

/* ===== Auto-dismissing flash alert =======================================
   app/javascript/controllers/auto_dismiss_controller.js, on the alert partial
   rendered with `dismissible: true` — whose only call site is the flash loop
   in layouts/admin_page.html.erb.

   The controller used to set `style.transition` and `style.opacity` in the
   same tick. Split in two on purpose: `.auto-dismiss-fade` is added on
   connect (so the transition is established), `.is-dismissing` five seconds
   later (so the opacity change is what transitions). Applying both at once
   from a single class would be the same one-tick race, only in CSS.
   ========================================================================= */
.auto-dismiss-fade { transition: opacity 1s ease-out; }
.auto-dismiss-fade.is-dismissing { opacity: 0; }

/* ===== CSV import "Processing your file..." overlay ======================
   app/javascript/controllers/import_form_controller.js.

   The overlay used to be built with Tailwind utility classes in a JS template
   string and needed `modalContent.style.position = 'relative'` to anchor it.
   It also looked for a `.bg-white` ancestor that neither call site has, and
   `bg-opacity-80` is Tailwind v3 syntax this app (v4) no longer emits — so it
   never actually rendered. Named rules here, anchored to the DaisyUI
   `.modal-box` or to the div-modal container.
   ========================================================================= */

/* Positioning context. Deliberately scoped to .modal-box: the other host is
   the div-modal container, which is already `position: fixed` — an unscoped
   `position: relative` here would win on source order and break it. */
.modal-box.import-loading-host { position: relative; }

.import-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.8);
}

.import-loading-inner { text-align: center; }

.import-loading-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.5rem;
  border-radius: 9999px;
  border-top: 2px solid #2563eb;
  border-bottom: 2px solid #2563eb;
  animation: import-loading-spin 1s linear infinite;
}

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

.import-loading-text {
  color: #2563eb;
  font-weight: 500;
}
