/* ==========================================================================
   RIH Auth & Modern Card Design System (rih-auth.css)
   ========================================================================== */

:root {
  --rih-brand-color: var(--primary, #660033);
  --rih-brand-hover: var(--secondary, #800040);
  --rih-brand-light: rgba(var(--bs-primary-rgb, 102, 0, 51), 0.1);
  --rih-brand-gradient: var(--rih-primary-gradient, linear-gradient(135deg, var(--primary, #660033) 0%, var(--secondary, #800040) 100%));
  --rih-card-bg: #ffffff;
  --rih-card-border: rgba(0, 0, 0, 0.08);
  --rih-card-shadow: 0 15px 35px rgba(0, 0, 0, 0.06), 0 5px 15px rgba(0, 0, 0, 0.03);
  --rih-text-primary: #1e293b;
  --rih-text-secondary: #64748b;
  --rih-input-border: #cbd5e1;
  --rih-radius-card: 1.5rem;
  --rih-radius-input: 0.85rem;
  --rih-radius-btn: 0.85rem;
  --rih-link-color: var(--primary, #660033);
}

[data-theme="dark"],
html[data-bs-theme="dark"] {
  --rih-card-bg: linear-gradient(145deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.99) 100%);
  --rih-card-border: rgba(255, 255, 255, 0.1);
  --rih-card-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --rih-text-primary: #f8fafc;
  --rih-text-secondary: #94a3b8;
  --rih-input-border: rgba(255, 255, 255, 0.15);
  --rih-link-color: #f472b6;
}

/* Background & Wrapper */
.rih-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: #f8fafc;
  transition: background 0.3s ease;
}

[data-theme="dark"] .rih-auth-page,
html[data-bs-theme="dark"] .rih-auth-page,
html[data-bs-theme="dark"] body {
  background: radial-gradient(circle at top, #1e293b 0%, #0b1120 100%) !important;
}

/* Back Button */
.login-back-button {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
}
[dir="ltr"] .login-back-button,
html[dir="ltr"] .login-back-button {
  right: auto;
  left: 18px;
}
.login-back-button a {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rih-text-primary);
  font-size: 1.1rem;
  transition: all 0.25s ease;
  text-decoration: none;
}
.login-back-button a:hover {
  transform: scale(1.08);
  background: var(--rih-brand-color);
  color: #ffffff;
}
[data-theme="dark"] .login-back-button a,
html[data-bs-theme="dark"] .login-back-button a {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Auth Card */
.rih-auth-card {
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--rih-card-border);
  border-radius: var(--rih-radius-card);
  box-shadow: var(--rih-card-shadow);
  background: var(--rih-card-bg);
  overflow: hidden;
  margin: 0 auto;
  transition: all 0.3s ease;
}

.rih-auth-card.card-wide {
  max-width: 520px;
}

/* Accent Top Stripe */
.rih-accent-bar {
  height: 5px;
  background: var(--rih-brand-gradient);
  width: 100%;
}

/* Brand Tabs (Segmented Control) */
.rih-nav-pills {
  background-color: rgba(128, 128, 128, 0.08);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(128, 128, 128, 0.1);
  display: flex;
  gap: 4px;
}

[data-theme="dark"] .rih-nav-pills,
html[data-bs-theme="dark"] .rih-nav-pills {
  background-color: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.08);
}

.rih-nav-pills .nav-item {
  flex: 1 1 auto;
  text-align: center;
}

.rih-nav-pills .nav-link {
  color: var(--rih-text-secondary);
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  transition: all 0.25s ease-in-out;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.rih-nav-pills .nav-link.active {
  background: var(--rih-brand-gradient) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb, 102, 0, 51), 0.35);
}

/* Form Controls */
.rih-form-group {
  margin-bottom: 1.2rem;
}

.rih-form-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--rih-text-secondary);
  margin-bottom: 0.45rem;
  display: block;
}

[data-theme="dark"] .rih-form-label,
html[data-bs-theme="dark"] .rih-form-label {
  color: #94a3b8;
}

.rih-input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.rih-form-group .form-control,
.rih-form-group .form-select,
.rih-input-group .form-control,
.rih-input-group .form-select {
  border-radius: var(--rih-radius-input);
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--rih-input-border);
  background-color: #ffffff;
  color: var(--rih-text-primary);
  transition: all 0.2s ease;
  width: 100%;
}

[data-theme="dark"] .rih-form-group .form-control,
[data-theme="dark"] .rih-form-group .form-select,
[data-theme="dark"] .rih-input-group .form-control,
[data-theme="dark"] .rih-input-group .form-select,
html[data-bs-theme="dark"] .rih-form-group .form-control,
html[data-bs-theme="dark"] .rih-form-group .form-select,
html[data-bs-theme="dark"] .rih-input-group .form-control,
html[data-bs-theme="dark"] .rih-input-group .form-select {
  background-color: rgba(0, 0, 0, 0.28) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.rih-input-group .form-control:focus,
.rih-input-group .form-select:focus,
.rih-form-group .form-control:focus,
.rih-form-group .form-select:focus {
  border-color: var(--rih-brand-color);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb, 102, 0, 51), 0.2);
  outline: none;
}

/* RTL / LTR Input Icons */
[dir="rtl"] .rih-input-group .form-control.has-icon,
html[dir="rtl"] .rih-input-group .form-control.has-icon,
[view-mode="rtl"] .rih-input-group .form-control.has-icon {
  padding-right: 2.5rem !important;
  padding-left: 0.9rem !important;
}

[dir="ltr"] .rih-input-group .form-control.has-icon,
html[dir="ltr"] .rih-input-group .form-control.has-icon {
  padding-left: 2.5rem !important;
  padding-right: 0.9rem !important;
}

.rih-input-group .input-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 1rem;
  pointer-events: none;
  z-index: 4;
}

[dir="rtl"] .rih-input-group .input-icon,
html[dir="rtl"] .rih-input-group .input-icon,
[view-mode="rtl"] .rih-input-group .input-icon {
  right: 0.9rem;
}

[dir="ltr"] .rih-input-group .input-icon,
html[dir="ltr"] .rih-input-group .input-icon {
  left: 0.9rem;
}

/* Password Toggle Button */
.rih-password-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  z-index: 5;
  transition: color 0.2s;
}

[dir="rtl"] .rih-password-toggle,
html[dir="rtl"] .rih-password-toggle,
[view-mode="rtl"] .rih-password-toggle {
  left: 0.75rem;
}

[dir="ltr"] .rih-password-toggle,
html[dir="ltr"] .rih-password-toggle {
  right: 0.75rem;
}

.rih-password-toggle:hover {
  color: #f8fafc;
}

/* Buttons */
.btn-rih-brand {
  background: var(--rih-brand-gradient);
  color: #ffffff !important;
  font-weight: 700;
  border-radius: var(--rih-radius-btn);
  padding: 0.8rem 1.25rem;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s ease-in-out;
  box-shadow: 0 4px 14px rgba(var(--bs-primary-rgb, 102, 0, 51), 0.35);
}

.btn-rih-brand:hover,
.btn-rih-brand:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(var(--bs-primary-rgb, 102, 0, 51), 0.45);
  color: #ffffff !important;
}

.btn-rih-dark {
  background-color: rgba(128, 128, 128, 0.08);
  border: 1px solid rgba(128, 128, 128, 0.15);
  color: var(--rih-text-primary) !important;
  font-weight: 700;
  border-radius: var(--rih-radius-btn);
  padding: 0.8rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s ease-in-out;
}

[data-theme="dark"] .btn-rih-dark,
html[data-bs-theme="dark"] .btn-rih-dark {
  background-color: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f8fafc !important;
}

.btn-rih-dark:hover {
  background-color: rgba(128, 128, 128, 0.16);
  transform: translateY(-1px);
}

/* Dynamic Links */
.rih-auth-link {
  color: var(--rih-link-color);
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.rih-auth-link:hover {
  opacity: 0.85;
}

/* Validation Feedback & Alerts */
.field-validation-error {
  color: #ef4444;
  font-size: 0.82rem;
  margin-top: 0.35rem;
  display: block;
  font-weight: 600;
}

.input-validation-error {
  border-color: #ef4444 !important;
}

.input-validation-error:focus {
  box-shadow: 0 0 0 0.25rem rgba(239, 68, 68, 0.2) !important;
}

/* OTP 6-Digit Inputs */
.rih-otp-inputs {
  display: flex;
  justify-content: center;
  gap: 8px;
  direction: ltr !important;
  margin: 1.5rem 0;
}

.rih-otp-box {
  width: 46px;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
  transition: all 0.2s ease;
}

[data-theme="dark"] .rih-otp-box,
html[data-bs-theme="dark"] .rih-otp-box {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f8fafc;
}

.rih-otp-box:focus {
  border-color: var(--rih-brand-color);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb, 102, 0, 51), 0.2);
  outline: none;
}

.rih-otp-box:disabled {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #94a3b8;
}

/* Directional Arrow helpers */
[dir="rtl"] .rih-dir-arrow,
html[dir="rtl"] .rih-dir-arrow,
[view-mode="rtl"] .rih-dir-arrow {
  transform: scaleX(1);
}

[dir="ltr"] .rih-dir-arrow,
html[dir="ltr"] .rih-dir-arrow {
  transform: scaleX(-1);
}

