/* =====================================================================
   RHEOMNI / TMSLOG  -  Theme components (central UI classes)
   ---------------------------------------------------------------------
   Loaded LAST (after Bootstrap, Tailwind and glass.css) via
   app/Views/partials/theme_components.php.

   Every coloured building block of the UI is defined here once, using
   only theme tokens (rgb(var(--c-*))). Views use these class names
   instead of repeating colour utilities inline:

     Buttons ........ tms-btn-primary | tms-btn-soft | tms-btn-outline
                      tms-btn-danger  | tms-btn-success
     Icon buttons ... tms-icon-btn  (+ --primary | --danger)
     Icon chips ..... tms-chip (filled)  | tms-chip-soft (tinted)
     Tones .......... tms-tone-{primary|success|warning|danger|info|caution|neutral}
                      (badges, alerts, status pills: bg + text + border colour)
     Links / tabs ... tms-link | tms-tab-active
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Bootstrap bridge
   Bootstrap 5 ships `.text-primary{color:#0d6efd!important}` etc. Those
   collided with the theme's Tailwind classes and painted icons/buttons
   Bootstrap-blue in every theme. The :root prefix out-ranks them.
   --------------------------------------------------------------------- */
:root .text-primary   { color: rgb(var(--c-primary)) !important; }
:root .bg-primary     { background-color: rgb(var(--c-primary)) !important; }
:root .border-primary { border-color: rgb(var(--c-primary)) !important; }
:root .text-secondary   { color: rgb(var(--c-secondary-500)) !important; }
:root .bg-secondary     { background-color: rgb(var(--c-secondary-500)) !important; }
:root .border-secondary { border-color: rgb(var(--c-secondary-500)) !important; }
:root .text-success { color: rgb(var(--c-success-600)) !important; }
:root .bg-success   { background-color: rgb(var(--c-success-600)) !important; }
:root .text-danger  { color: rgb(var(--c-danger-600)) !important; }
:root .bg-danger    { background-color: rgb(var(--c-danger-600)) !important; }
:root .text-warning { color: rgb(var(--c-warning-500)) !important; }
:root .bg-warning   { background-color: rgb(var(--c-warning-500)) !important; }
:root .text-info    { color: rgb(var(--c-info-500)) !important; }
:root .bg-info      { background-color: rgb(var(--c-info-500)) !important; }
/* keep Tailwind opacity variants working (bg-primary/10 etc. are separate classes) */

:root a:not([class]) { color: rgb(var(--c-primary-strong)); }
:root a:not([class]):hover { color: rgb(var(--c-primary-800)); }

:root .btn-primary {
  color: #fff;
  background: linear-gradient(135deg, rgb(var(--c-primary-soft)), rgb(var(--c-primary)) 55%, rgb(var(--c-primary-strong)));
  border-color: rgb(var(--c-primary));
}
:root .btn-primary:hover, :root .btn-primary:focus { background: rgb(var(--c-primary-strong)); border-color: rgb(var(--c-primary-strong)); color: #fff; }
:root .btn-outline-primary { color: rgb(var(--c-primary-strong)); border-color: rgb(var(--c-primary-300)); }
:root .btn-outline-primary:hover { color: #fff; background: rgb(var(--c-primary)); border-color: rgb(var(--c-primary)); }
:root .btn-secondary { color: #fff; background: rgb(var(--c-secondary-500)); border-color: rgb(var(--c-secondary-500)); }
:root .badge.bg-primary, :root .progress-bar { background-color: rgb(var(--c-primary)) !important; }
:root .page-link { color: rgb(var(--c-primary-strong)); }
:root .page-item.active .page-link { background: rgb(var(--c-primary)); border-color: rgb(var(--c-primary)); color: #fff; }
:root .nav-pills .nav-link.active, :root .list-group-item.active, :root .dropdown-item.active, :root .dropdown-item:active {
  background-color: rgb(var(--c-primary)); border-color: rgb(var(--c-primary)); color: #fff;
}
:root .form-check-input:checked { background-color: rgb(var(--c-primary)); border-color: rgb(var(--c-primary)); }
:root .form-control:focus, :root .form-select:focus {
  border-color: rgb(var(--c-primary-300));
  box-shadow: 0 0 0 .2rem rgb(var(--c-primary) / .18);
}

/* ---------------------------------------------------------------------
   2. Buttons  (size / padding stay as layout utilities on the element)
   --------------------------------------------------------------------- */
.tms-btn-primary,
.tms-btn-soft,
.tms-btn-outline,
.tms-btn-danger,
.tms-btn-success {
  transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .15s ease, opacity .2s ease;
}
:root .tms-btn-primary {
  color: #fff !important;
  background: linear-gradient(135deg, rgb(var(--c-primary-soft)), rgb(var(--c-primary)) 55%, rgb(var(--c-primary-strong))) !important;
  border-color: transparent;
  box-shadow: 0 6px 16px -8px rgb(var(--c-primary-strong) / .55), inset 0 1px 0 rgba(255, 255, 255, .25);
}
:root .tms-btn-primary:not(:disabled):hover {
  background: linear-gradient(135deg, rgb(var(--c-primary)), rgb(var(--c-primary-strong))) !important;
  box-shadow: 0 10px 22px -10px rgb(var(--c-primary-strong) / .7), inset 0 1px 0 rgba(255, 255, 255, .25);
}
:root .tms-btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.tms-btn-soft { color: rgb(var(--c-primary-strong)); background: rgb(var(--c-primary-50)); border: 1px solid rgb(var(--c-primary-100)); }
.tms-btn-soft:not(:disabled):hover { background: rgb(var(--c-primary-100)); }

.tms-btn-outline { color: rgb(var(--c-ink-700)); background: #fff; border: 1px solid rgb(var(--c-tint-200)); }
.tms-btn-outline:not(:disabled):hover { color: rgb(var(--c-primary-strong)); background: rgb(var(--c-tint-50)); border-color: rgb(var(--c-primary-200)); }

.tms-btn-danger { color: #fff; background: rgb(var(--c-danger-600)); border-color: transparent; }
.tms-btn-danger:not(:disabled):hover { background: rgb(var(--c-danger-700)); }
.tms-btn-success { color: #fff; background: rgb(var(--c-success-600)); border-color: transparent; }
.tms-btn-success:not(:disabled):hover { background: rgb(var(--c-success-700)); }

/* ---------------------------------------------------------------------
   3. Square icon buttons (list toolbars, row actions)
   --------------------------------------------------------------------- */
/* layout defaults in :where() (zero specificity) so w-8 / h-8 / rounded-* utilities can resize */
:where(.tms-icon-btn) { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: .5rem; }
.tms-icon-btn {
  color: rgb(var(--c-primary-600));
  background: radial-gradient(circle at 30% 25%, #fff, rgb(var(--c-primary-50)) 75%);
  border: 1px solid rgb(var(--c-primary-600) / .2);
  box-shadow: inset 0 1px 0 #fff, 0 3px 8px rgb(var(--c-primary-700) / .1);
  transition: all .2s ease;
}
.tms-icon-btn:not(:disabled):hover {
  color: #fff;
  background: radial-gradient(circle at 30% 25%, rgb(var(--c-primary-300)), rgb(var(--c-primary-500)) 55%, rgb(var(--c-primary-700)));
  border-color: rgba(255, 255, 255, .8);
}
:root .tms-icon-btn--primary {
  color: #fff;
  background: radial-gradient(circle at 30% 25%, rgb(var(--c-primary-300)), rgb(var(--c-primary-500)) 55%, rgb(var(--c-primary-700)));
  border-color: rgba(255, 255, 255, .8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 14px rgb(var(--c-primary-700) / .35);
}
:root .tms-icon-btn--primary:not(:disabled):hover { filter: brightness(1.08); }
.tms-icon-btn--danger { color: rgb(var(--c-danger-600)); background: #fff; border-color: rgb(var(--c-danger-200)); box-shadow: none; }
.tms-icon-btn--danger:not(:disabled):hover { color: #fff; background: rgb(var(--c-danger-600)); border-color: rgb(var(--c-danger-600)); }
.tms-icon-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   4. Icon chips (page / card header icons, empty-state icons)
   --------------------------------------------------------------------- */
:where(.tms-chip, .tms-chip-soft) { display: inline-flex; align-items: center; justify-content: center; }
:root .tms-chip {
  color: #fff !important;
  background: radial-gradient(circle at 30% 25%, rgb(var(--c-primary-300)), rgb(var(--c-primary-500)) 55%, rgb(var(--c-primary-700))) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 6px 14px -4px rgb(var(--c-primary-700) / .45);
}
:root .tms-chip-soft {
  color: rgb(var(--c-primary-600)) !important;
  background: radial-gradient(circle at 30% 25%, #fff, rgb(var(--c-primary-100)) 75%) !important;
  border: 1px solid rgb(var(--c-primary-600) / .18);
}

/* ---------------------------------------------------------------------
   5. Tones: status pills, badges, alerts, coloured panels.
   bg + text + border colour in one class (border shows only if the
   element also has a border width, e.g. "border").
   --------------------------------------------------------------------- */
.tms-tone-primary { background-color: rgb(var(--c-primary-50));  color: rgb(var(--c-primary-strong)); border-color: rgb(var(--c-primary-200)); }
.tms-tone-success { background-color: rgb(var(--c-green-100));   color: rgb(var(--c-green-700));      border-color: rgb(var(--c-green-200)); }
.tms-tone-warning { background-color: rgb(var(--c-amber-50));    color: rgb(var(--c-amber-800));      border-color: rgb(var(--c-amber-200)); }
.tms-tone-danger  { background-color: rgb(var(--c-red-50));      color: rgb(var(--c-red-700));        border-color: rgb(var(--c-red-200)); }
.tms-tone-info    { background-color: rgb(var(--c-blue-100));    color: rgb(var(--c-blue-700));       border-color: rgb(var(--c-blue-200)); }
.tms-tone-caution { background-color: rgb(var(--c-orange-50));   color: rgb(var(--c-orange-600));     border-color: rgb(var(--c-orange-200)); }
.tms-tone-neutral { background-color: rgb(var(--c-gray-100));    color: rgb(var(--c-gray-600));       border-color: rgb(var(--c-gray-200)); }
a.tms-tone-danger:hover, button.tms-tone-danger:hover { background-color: rgb(var(--c-red-100)); }

/* ---------------------------------------------------------------------
   6. Links, tabs, form errors
   --------------------------------------------------------------------- */
.tms-link { color: rgb(var(--c-primary-strong)); }
.tms-link:hover { color: rgb(var(--c-primary-800)); text-decoration: underline; }
:root .tms-tab-active { color: rgb(var(--c-primary-strong)) !important; border-color: rgb(var(--c-primary)) !important; }
:root .tms-seg-active { color: #fff !important; background: rgb(var(--c-primary)) !important; border-color: rgb(var(--c-primary)) !important; }
.tms-error { color: rgb(var(--c-danger-600)); }

/* ---------------------------------------------------------------------
   7. Row / inline action icons (edit, add, remove ...)
   --------------------------------------------------------------------- */
.tms-act { color: rgb(var(--c-ink-400)); border-color: rgb(var(--c-tint-200)); transition: color .2s ease, background-color .2s ease, border-color .2s ease; }
.tms-act:not(:disabled):hover { color: rgb(var(--c-primary-600)); background-color: rgb(var(--c-primary-50)); }
.tms-act--success { color: rgb(var(--c-emerald-500)); }
.tms-act--success:not(:disabled):hover { color: rgb(var(--c-emerald-600)); background-color: rgb(var(--c-emerald-50)); }
.tms-act--danger:not(:disabled):hover { color: rgb(var(--c-rose-600)); background-color: rgb(var(--c-rose-50)); }
.tms-act--success.tms-act--filled { color: rgb(var(--c-emerald-600)); background-color: rgb(var(--c-emerald-50)); border-color: rgb(var(--c-emerald-100)); }
.tms-act--success.tms-act--filled:not(:disabled):hover { background-color: rgb(var(--c-emerald-100)); }
.tms-act--danger.tms-act--filled { color: rgb(var(--c-rose-600)); background-color: rgb(var(--c-rose-50)); border-color: rgb(var(--c-rose-200)); }
.tms-act--danger.tms-act--filled:not(:disabled):hover { color: #fff; background-color: rgb(var(--c-rose-500)); }

/* ---------------------------------------------------------------------
   8. Theme-tinted logo for public pages (PNG used as a mask)
   --------------------------------------------------------------------- */
.tms-logo-public {
  display: inline-block;
  aspect-ratio: 1084 / 175;
  mask: url('/assets/icons/rheomni-logo.png') left center / contain no-repeat;
}
.tms-act--brand { color: rgb(var(--c-primary-500)); }
