/* --- Global Styles (style.css) --- */
/* Updated for a modern, logo-inspired login form */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../Vazir.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --comlinx-primary: #2bc0fb; /* Default accent */
  --comlinx-primary-dark: #1599cb;
  --comlinx-accent: #18d7df;
  --comlinx-gradient: linear-gradient(135deg, rgba(43, 192, 251, 0.92), rgba(21, 153, 203, 0.86));
  --bg-dark: #040a14;
  --bg-light: rgba(15, 28, 42, 0.9);
  --text-primary: #f2fbff;
  --text-secondary: #9fc2d9;
  --border-color: rgba(255, 255, 255, 0.14);
  --glass-bg: rgba(16, 31, 46, 0.65);
  --glass-strong: rgba(11, 23, 35, 0.78);
  --shadow: 0 16px 40px rgba(7, 18, 30, 0.45);
  --success-color: #31e07a;
  --error-color: #ef5b6b;
  --warning-color: #f6b33f;
  --glass-border: 1px solid rgba(255, 255, 255, 0.12);
}

:root[data-theme='light'] {
  --bg-dark: #045363;
  --bg-light: rgba(8, 11, 161, 0.9);
  --text-primary: #e7fcff;
  --text-secondary: rgba(197, 238, 250, 0.84);
  --border-color: rgba(129, 224, 247, 0.26);
  --glass-bg: rgba(8, 59, 78, 0.86);
  --glass-strong: rgba(7, 50, 67, 0.92);
  --shadow: 0 18px 48px rgba(2, 18, 22, 0.32);
  --glass-border: 1px solid rgba(129, 224, 247, 0.24);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Vazirmatn', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top left, rgba(43, 192, 251, 0.28), transparent 55%),
    radial-gradient(circle at bottom right, rgba(24, 215, 223, 0.15), transparent 50%),
    radial-gradient(circle at 20px 20px, rgba(218, 248, 255, 0.13) 1px, transparent 1.5px),
    radial-gradient(circle at 5px 5px, rgba(43, 192, 251, 0.08) 1px, transparent 1.4px),
    var(--bg-dark);
  background-size: auto, auto, 34px 34px, 18px 18px, auto;
  background-repeat: no-repeat, no-repeat, repeat, repeat, no-repeat;
  background-position: top left, bottom right, top left, top left, center;
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100dvh;
}

/* Workaround: mobile WebKit can render `backdrop-filter` as a black layer after app/tab resume.
   `js/theme.js` toggles this class briefly to force a clean repaint. */
html.comlinx-resume-fix,
html.comlinx-resume-fix * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}

html.comlinx-resume-fix body::before,
html.comlinx-resume-fix body::after {
  filter: none !important;
  mix-blend-mode: normal !important;
  opacity: 0 !important;
}

/* --- Background Particle Animation --- */
#particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 0;
  background-color: var(--bg-dark);
}

/* --- Main Content Wrapper --- */
.content-wrapper {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

/* --- Form Card (Modernized) --- */
.auth-card {
  background: linear-gradient(135deg, rgba(16, 31, 46, 0.78), rgba(10, 24, 36, 0.72));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: clamp(2rem, 4vw, 2.75rem);
  border-radius: 1.75rem;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 450px;
  border: var(--glass-border);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 48px rgba(43, 192, 251, 0.18);
  border-color: rgba(43, 192, 251, 0.25);
}

html.glass-disabled .auth-card {
  background: rgba(10, 24, 36, 0.92);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

html[data-theme='light'].glass-disabled .auth-card {
  background: rgba(7, 56, 60, 0.96);
  border-color: rgba(112, 226, 210, 0.18);
}

html.glass-disabled .auth-card:hover {
  transform: none;
  box-shadow: none;
}

/* --- Page Title --- */
.page-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  background: var(--comlinx-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Accessibility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Login Page Layout --- */
.auth-card form {
  margin-top: 1.1rem;
}

.login-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.login-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}

.login-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.logo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--comlinx-primary);
}

.login-copy {
  flex: 1;
  min-width: 0;
}

.login-appname {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(159, 194, 217, 0.95);
  margin: 0;
}

.auth-subtitle {
  margin-top: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.badge--cyan {
  border-color: rgba(43, 192, 251, 0.3);
  background: rgba(43, 192, 251, 0.14);
  color: rgba(187, 244, 255, 0.95);
}

.badge--green {
  border-color: rgba(49, 224, 122, 0.28);
  background: rgba(49, 224, 122, 0.14);
  color: rgba(195, 255, 220, 0.95);
}

.badge--muted {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(242, 251, 255, 0.9);
}

.loading-text {
  margin-top: 0.75rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-align: center;
}

.otp-status {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: rgba(43, 192, 251, 0.12);
  border: 1px solid rgba(43, 192, 251, 0.18);
  color: rgba(187, 244, 255, 0.95);
  font-size: 0.875rem;
  text-align: center;
}

/* --- Loading Overlay --- */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 22, 34, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.4s ease;
  border-radius: 1.5rem;
}

/* --- Logo --- */
.logo-container {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo-container img {
  height: clamp(5.5rem, 12vw, 7.5rem);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(43, 192, 251, 0.3));
  transition: transform 0.3s ease;
}

.logo-container img:hover {
  transform: scale(1.05);
}

/* --- Profile Image Upload --- */
.profile-image-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}

.image-preview-container {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
}

.image-preview-container:hover {
  border-color: var(--comlinx-primary);
  background: rgba(43, 192, 251, 0.14);
  transform: scale(1.05);
}

.image-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-icon {
  font-size: 2rem;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.image-preview-container:hover .upload-icon {
  color: var(--comlinx-primary);
}

#image-upload {
  display: none;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.form-section {
  padding: 1.25rem 1.25rem;
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 1rem;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.form-section .form-group + .form-group {
  margin-top: 0.9rem;
}

.verified-phone-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.verified-phone-container .input-field {
  flex: 1;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(12, 167, 209, 0.15);
  color: var(--comlinx-primary);
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid rgba(12, 167, 209, 0.25);
}

.input-field {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 0.75rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--comlinx-primary);
  box-shadow: 0 0 12px rgba(43, 192, 251, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

.input-field:read-only {
  background: rgba(42, 58, 80, 0.5);
  color: var(--text-secondary);
  cursor: not-allowed;
}

/* --- Textarea --- */
textarea.input-field {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.5;
}

/* --- Phone Input Container --- */
.phone-input-container {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.phone-entry-row .form-group {
  margin-bottom: 0;
}

.phone-entry-row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-end;
}

.phone-number-group {
  flex: 1 1 auto;
  min-width: 0;
}

.phone-inline-field {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 54px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.9rem;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.phone-inline-field::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 18% 50%, rgba(43, 192, 251, 0.18), transparent 58%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.phone-inline-field:focus-within {
  border-color: var(--comlinx-primary);
  box-shadow: 0 0 0 3px rgba(43, 192, 251, 0.2), 0 10px 26px rgba(5, 14, 26, 0.28);
}

.phone-inline-field:focus-within::before {
  opacity: 1;
}

.phone-country-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  height: 100%;
  padding: 0 0.58rem;
  color: #0f172a;
  background: linear-gradient(
    to bottom,
    #239f40 0 33.333%,
    #ffffff 33.333% 66.666%,
    #da0000 66.666% 100%
  );
  border-left: 1px solid rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  font-size: 0.8rem;
  flex: 0 0 auto;
  border-top-right-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
}

.phone-country-chip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 45%);
  pointer-events: none;
}

.phone-country-chip > * {
  position: relative;
  z-index: 1;
}

.phone-country-flag {
  font-size: 0.9rem;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5));
}

.phone-country-text {
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.phone-country-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #0b1728;
  font-weight: 800;
  line-height: 1.1;
}

body.rtl .phone-country-chip {
  border-left: 1px solid rgba(0, 0, 0, 0.22);
  border-right: none;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-top-left-radius: 0.75rem;
  border-bottom-left-radius: 0.75rem;
}

.phone-inline-field .input-field {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  height: 54px;
}

.phone-inline-field .input-field:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}

.phone-entry-row #btn-get-code {
  margin: 0;
  width: auto;
  min-width: 96px;
  height: 54px;
  padding: 0 0.9rem;
  white-space: nowrap;
  flex: 0 0 auto;
  align-self: flex-end;
  font-size: 0.84rem;
  line-height: 1;
  border-radius: 0.82rem;
}

/* --- Username Check --- */
.username-check {
  position: relative;
  display: flex;
  align-items: stretch;
}

.username-check .input-field {
  padding-right: 3rem;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.username-status {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.username-status.available {
  color: var(--success-color);
}

.username-status.taken {
  color: var(--error-color);
}

.username-status.checking {
  color: var(--warning-color);
  animation: spin 1s linear infinite;
}

/* RTL Support for Username Check */
body.rtl .username-check .input-field {
  padding-right: 1rem;
  padding-left: 3rem;
  border-radius: 0.75rem;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

body.rtl .username-status {
  right: auto;
  left: 1rem;
}

/* --- Relationship Status --- */
.relationship-status {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.status-option {
  padding: 1rem 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--glass-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.status-option:hover {
  border-color: var(--comlinx-primary);
  transform: translateY(-2px);
}

.status-option.selected {
  border-color: var(--comlinx-primary);
  background: rgba(43, 192, 251, 0.14);
  box-shadow: 0 6px 18px rgba(43, 192, 251, 0.22);
}

.status-option i {
  font-size: 1.25rem;
  color: var(--comlinx-primary);
}

.status-option span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* --- Hint Text --- */
.hint-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  height: 1em;
  text-align: left;
}

body.rtl .hint-text {
  text-align: right;
}

.hint-text.error {
  color: var(--error-color);
}

.hint-text.success {
  color: var(--success-color);
}

/* --- Buttons --- */
.btn {
  width: 100%;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--comlinx-gradient);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: linear-gradient(135deg, var(--comlinx-primary-dark), var(--comlinx-primary));
  box-shadow: 0 8px 24px rgba(43, 192, 251, 0.35);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  background: #374151;
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.btn:disabled::before {
  display: none;
}

/* --- Specific Button Styles --- */
#btn-get-code {
  background: linear-gradient(135deg, #08d3ff, #2f7bff);
  box-shadow: 0 10px 22px rgba(13, 143, 255, 0.34);
  width: auto;
  min-width: 110px;
  margin: 0;
}

#btn-get-code:hover {
  background: linear-gradient(135deg, #00c3ff, #246ef2);
  box-shadow: 0 12px 24px rgba(11, 129, 244, 0.38);
}

#submit-btn {
  margin-top: 1rem;
}

/* --- Secondary Button --- */
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-weight: 500;
  margin-top: 0.75rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--comlinx-primary);
  border-color: var(--comlinx-primary);
}

/* --- Language Toggle --- */
.lang-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  z-index: 10;
  transition: all 0.3s ease;
  font-family: inherit;
}

.lang-toggle:hover {
  color: var(--text-primary);
  border-color: var(--comlinx-primary);
  background: rgba(43, 192, 251, 0.16);
  transform: translateY(-1px);
}

html.high-contrast {
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.86);
  --border-color: rgba(255, 255, 255, 0.32);
  --glass-border: 1px solid rgba(255, 255, 255, 0.28);
}

html.accessible-fonts body {
  font-family: 'Inter', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 0.01em;
}

html.motion-reduced *,
html.motion-reduced *::before,
html.motion-reduced *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* RTL Support for Language Toggle */
body.rtl .lang-toggle {
  right: auto;
  left: 1rem;
}

/* --- Spinner Animation --- */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* --- OTP Input Field --- */
.otp-input {
  letter-spacing: 0.5em;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 600;
  background: var(--glass-bg);
  padding: 1rem 0.5rem;
}

.otp-input::placeholder {
  letter-spacing: 0.3em;
  color: var(--text-secondary);
}

/* --- Error Message --- */
.error-message {
  color: var(--error-color);
  font-size: 0.875rem;
  text-align: center;
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 0.75rem;
  animation: slideDown 0.3s ease;
}

/* --- Success Message --- */
.success-message {
  color: var(--success-color);
  font-size: 0.875rem;
  text-align: center;
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 0.75rem;
  animation: slideDown 0.3s ease;
}

/* --- Animations --- */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- Form Transitions --- */
.form-transition-enter {
  opacity: 0;
  transform: translateX(20px);
}

.form-transition-enter-active {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.form-transition-exit {
  opacity: 1;
  transform: translateX(0);
}

.form-transition-exit-active {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* --- Hidden Utility Class --- */
.hidden {
  display: none !important;
}

/* Mobile-only rules moved to css/style-mobile.css */

/* --- Print Styles --- */
@media print {
  .auth-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  #particles-js,
  .lang-toggle {
    display: none;
  }
}

/* --- High Contrast Mode Support --- */
@media (prefers-contrast: high) {
  :root {
    --border-color: #FFFFFF;
    --text-secondary: #FFFFFF;
  }

  .auth-card {
    border: 2px solid var(--border-color);
  }
}

/* --- Reduced Motion Support --- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .btn::before {
    display: none;
  }
}

/* --- Dark Mode Support (already dark) --- */
@media (prefers-color-scheme: dark) {
  /* Already optimized for dark mode */
}

/* --- Focus Visible for Accessibility --- */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--comlinx-primary);
  outline-offset: 2px;
}

/* --- Selection Color --- */
::selection {
  background: rgba(43, 192, 251, 0.35);
  color: var(--text-primary);
}

::-moz-selection {
  background: rgba(43, 192, 251, 0.35);
  color: var(--text-primary);
}

:root,
:root[data-theme='light'],
:root[data-theme='dark'] {
  --bg-primary: #0E1117;
  --bg-secondary: #161B22;
  --bg-hover: #1C2128;
  --border-subtle: #222831;
  --border-strong: #2E3440;
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted: #6E7681;
  --accent-primary: #4F8CFF;
  --accent-primary-soft: rgba(79, 140, 255, 0.15);
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --comlinx-primary: var(--accent-primary);
  --comlinx-primary-dark: #3F78DE;
  --comlinx-accent: var(--accent-primary);
  --comlinx-gradient: linear-gradient(180deg, #4F8CFF, #4A86F7);
  --bg-dark: var(--bg-primary);
  --bg-light: var(--bg-secondary);
  --border-color: var(--border-subtle);
  --glass-bg: var(--bg-secondary);
  --glass-strong: var(--bg-hover);
  --glass-border: 1px solid var(--border-subtle);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  --success-color: var(--success);
  --warning-color: var(--warning);
  --error-color: var(--danger);
}

body {
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(230, 237, 243, 0.04), transparent 42%),
    radial-gradient(120% 120% at 100% 100%, rgba(230, 237, 243, 0.03), transparent 46%),
    var(--bg-primary);
  background-size: auto, auto, auto;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: top left, bottom right, center;
  color: var(--text-primary);
}

#particles-js {
  background-color: var(--bg-primary);
}

.auth-card,
.form-section,
.input-field,
.otp-input,
.loading-overlay,
.lang-toggle,
.image-preview-container,
.status-option {
  background: var(--bg-secondary);
  border-color: var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.auth-card,
.loading-overlay,
.lang-toggle {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.auth-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.page-title {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--text-primary);
}

.logo-container img {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.badge--cyan,
.otp-status,
.verified-badge,
.status-option.selected {
  background: var(--accent-primary-soft);
  border-color: rgba(79, 140, 255, 0.34);
  color: var(--accent-primary);
  box-shadow: none;
}

.badge--green {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.14);
  color: #B7F7CF;
}

.badge--muted {
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.input-field:focus,
.lang-toggle:hover,
.image-preview-container:hover,
.status-option:hover,
.status-option.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
}

.image-preview-container:hover {
  background: var(--bg-hover);
}

.image-preview-container:hover .upload-icon {
  color: var(--accent-primary);
}

.btn,
#btn-get-code {
  background: var(--accent-primary);
  color: #F5F9FF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn::before {
  display: none;
}

.btn:hover,
#btn-get-code:hover {
  background: #3F78DE;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

#btn-get-code {
  background: linear-gradient(135deg, #08d3ff, #2f7bff);
  color: #f7fbff;
  box-shadow: 0 10px 22px rgba(13, 143, 255, 0.34);
  min-width: 96px;
}

#btn-get-code:hover {
  background: linear-gradient(135deg, #00c3ff, #246ef2);
  box-shadow: 0 12px 24px rgba(11, 129, 244, 0.38);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.input-field:read-only {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.error-message {
  color: #FFDADB;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
}

.success-message {
  color: #C6F6D5;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.4);
}

::selection,
::-moz-selection {
  background: var(--accent-primary-soft);
  color: var(--text-primary);
}
