/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Theme bridge for legacy/light-first templates.
   This keeps existing Tailwind utility usage dark-mode compatible and
   reduces repeated per-template dark classes for future updates. */

html.dark .bg-white {
  background-color: rgb(17 24 39) !important;
}

html.dark .bg-gray-50 {
  background-color: rgb(31 41 55) !important;
}

html.dark .bg-gray-100 {
  background-color: rgb(55 65 81) !important;
}

html.dark .border-gray-200,
html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-gray-300 > :not([hidden]) ~ :not([hidden]) {
  border-color: rgb(55 65 81) !important;
}

html.dark .text-gray-900 {
  color: rgb(243 244 246) !important;
}

html.dark .text-gray-800 {
  color: rgb(229 231 235) !important;
}

html.dark .text-gray-700,
html.dark .text-gray-600,
html.dark .text-gray-500 {
  color: rgb(156 163 175) !important;
}

html.dark input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
  background-color: rgb(31 41 55);
  border-color: rgb(75 85 99);
  color: rgb(243 244 246);
}

html.dark input[type="number"],
html.dark input[type="date"],
html.dark input[type="datetime-local"] {
  color-scheme: dark;
}

input[type="number"],
input[type="date"],
input[type="datetime-local"] {
  color-scheme: light;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: rgb(156 163 175);
}

html.dark .hover\:bg-gray-50:hover {
  background-color: rgb(31 41 55) !important;
}

html.dark .hover\:text-gray-900:hover {
  color: rgb(243 244 246) !important;
}

/* Shared model-view surfaces (use across current/future CRUD views). */
.resource-surface {
  border: 1px solid rgb(229 231 235);
  border-radius: 0.5rem;
  background-color: rgb(255 255 255);
}

html.dark .resource-surface {
  border-color: rgb(55 65 81);
  background-color: rgb(17 24 39);
}

/* GenP import progress — always available (not dependent on Tailwind content scan). */
@keyframes genp-import-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Full 360° rotation (applied to the whole SVG, not a partial border arc). */
.genp-import-spin-icon {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  transform-origin: 50% 50%;
  animation: genp-import-spin 1s linear infinite;
}

.genp-import-step-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  transform-origin: 50% 50%;
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: genp-import-spin 1s linear infinite;
}

html.dark .genp-import-step-spinner {
  border-color: #1e3a8a;
  border-top-color: #60a5fa;
}

/* Onboarding security setup — plain CSS (not tailwind build) so dev serves current rules even when public/assets manifest is stale. */
.security-setup-form [data-mfa-panel] {
  pointer-events: none;
  opacity: 0.5;
}

.security-setup-form:has([data-mfa-method="mfa_auth_app"]:checked) [data-mfa-panel="mfa_auth_app"],
.security-setup-form:has([data-mfa-method="mfa_email"]:checked) [data-mfa-panel="mfa_email"],
.security-setup-form:has([data-mfa-method="mfa_sms"]:checked) [data-mfa-panel="mfa_sms"] {
  pointer-events: auto;
  opacity: 1;
}

.security-setup-form [data-preferred-for] {
  display: none;
}

.security-setup-form:has([data-mfa-method="mfa_auth_app"]:checked) [data-preferred-for="mfa_auth_app"],
.security-setup-form:has([data-mfa-method="mfa_email"]:checked) [data-preferred-for="mfa_email"],
.security-setup-form:has([data-mfa-method="mfa_sms"]:checked) [data-preferred-for="mfa_sms"] {
  display: flex;
}

.security-setup-form:has([data-mfa-method="mfa_auth_app"]:checked, [data-mfa-method="mfa_email"]:checked, [data-mfa-method="mfa_sms"]:checked) [data-preferred-hint] {
  display: none;
}

/* MFA QR codes must stay white in dark mode for camera scanning (plain CSS; not Tailwind-dependent). */
.mfa-qr-code-card {
  background-color: #ffffff !important;
  color-scheme: light;
}

.mfa-qr-code-card svg {
  background-color: #ffffff;
}
