/* ============================================================================
   BorDoc — account-app UI refresh layer (Phase 2: scope A + B + C).
   Loaded LAST and ONLY by the SPA shell (frontend/index.html) — so every rule
   here applies app-wide inside the authenticated app but NEVER leaks to the
   out-of-scope public / legal pages (they don't load this file). Uses the
   design tokens from colors_and_type.css; no token files are edited, so the
   public site is untouched. Visual-only: no markup/logic assumptions.
   ========================================================================== */

/* ---- A1: app-wide keyboard focus ring -------------------------------------
   The system rule was `.ds-root :focus-visible`, but `.ds-root` is never put on
   any ancestor, so keyboard focus was invisible on most screens. Apply it for
   real, app-wide. Mouse clicks are unaffected (:focus-visible only). */
:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
  border-radius: var(--radius-sm);
}

/* ---- A2: dark-mode focus ring should be the brand green, not blue ----------
   SPA-only override of the token (the token file is shared with public pages,
   so we override here instead of editing it). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ring-focus: 0 0 0 3px rgba(105, 219, 124, 0.40); }
}
:root[data-theme="dark"] { --ring-focus: 0 0 0 3px rgba(105, 219, 124, 0.40); }

/* ---- C2: subtle interactive transitions ----------------------------------
   Screen/card/panel ENTRANCE motion now comes from the Motion library
   (motion/react): the screen-level cross-fade (ScreenTransition), the dropdown
   appearance, and the Dashboard action-card stagger. The CSS entrance keyframe
   was removed so the two don't stack. What stays here is the cheap interactive
   feedback Motion isn't driving — hover transitions — disabled under
   prefers-reduced-motion (A5 block). */
/* gentle hover feedback wherever it was missing (buttons + cards) */
.btn { transition: background var(--dur, 180ms) var(--ease), box-shadow var(--dur) var(--ease),
        border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.btn-primary:hover, .btn-danger-solid:hover { transform: translateY(-1px); }
.card, .acc-card, .pr-card, .vy-card, .hi-card {
  transition: box-shadow var(--dur, 180ms) var(--ease), border-color var(--dur) var(--ease);
}

/* ---- B6: consistent card elevation across the app -------------------------
   Several card classes had a border but no shadow, others had --shadow-sm.
   Give them all the same soft elevation so panels read as one family. */
.card, .adm-card, .vy-card, .rec-card { box-shadow: var(--shadow-sm); }

/* ---- A4: the Review loading icon must actually spin (looked frozen) --------
   The loading state renders an icon tagged `is-loading`; spin only that one
   (the done/error states reuse the same container with a static icon). */
@keyframes bd-spin { to { transform: rotate(360deg); } }
.rs-done-icon.is-loading .lic { display: inline-flex; animation: bd-spin 0.9s linear infinite; }

/* ---- B3: one consistent loading affordance ------------------------------
   Several screens showed a bare "Načítám…" text with no motion, so a slow
   network read looked indistinguishable from an empty result. `.bd-loading`
   turns any such line into a muted label with a small spinner. Applied via a
   class only (no logic touched); the spinner settles to a static ring under
   prefers-reduced-motion (A5 block). */
.bd-loading {
  display: flex; align-items: center; gap: 10px;
  color: var(--fg3); font-size: 14px;
}
.bd-loading::before {
  content: ""; flex: none; width: 16px; height: 16px;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: bd-spin 0.8s linear infinite;
}

/* ---- C3: touch targets — icon-only buttons & modal closes ≥ 44px on mobile -
   The token --control-h-touch (44px) existed but was barely used. */
@media (max-width: 760px) {
  .dk-act-btn, .rs-folder-btn, .dv-zoombar button, .cs-eye, .acc-copy, .tb-open,
  .hi-card-x, .acc-modal-x, .tr-x, .dk-ex-x, .tb-dialog-x, .cs-x, .od-pm-x, .ck-x,
  .th-more, .dk-cb {
    min-width: var(--control-h-touch, 44px);
    min-height: var(--control-h-touch, 44px);
  }
}

/* ---- A5: honor prefers-reduced-motion app-wide ----------------------------
   Vestibular safety + WCAG 2.3.3. Spinners settle to a static frame; entrance
   and transitions become instant. Last block so it wins. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
