/* ============================================================
   بوابة الدخول — لوحة أحادية فاخرة: عاجي دافئ + فحمي + شامبانيا
   ============================================================ */

:root {
  --ivory: #F4F1EA;
  --ink: #111112;
  --champagne: #C6A664;
  --champagne-soft: #E8D6A8;
  --field-bg: #1A1A1C;
  --field-border: #2A2A2C;
  --text-warm: #F6F1E7;
  --muted: #9A9A9A;
  --muted-2: #6E6E70;
  --error: #E8847C;
  --radius: 10px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ivory);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 44px);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* حبيبات ورقية خفيفة */
.noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* هالة شامبانيا رقيقة فوق العاجي */
.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 44% at 50% 44%, rgba(198, 166, 100, .16), rgba(198, 166, 100, 0) 72%),
    radial-gradient(80% 60% at 50% 110%, rgba(17, 17, 18, .07), rgba(17, 17, 18, 0) 70%);
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
}

/* ============================ البطاقة ============================ */
.card {
  position: relative;
  width: 100%;
  padding: clamp(26px, 6.5vw, 40px) clamp(20px, 5.4vw, 36px) clamp(24px, 5.4vw, 34px);
  border: 1px solid rgba(198, 166, 100, .42);
  border-radius: 18px;
  background: linear-gradient(180deg, #141416 0%, #111112 58%, #0E0E0F 100%);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, .35),
    0 4px 14px rgba(17, 17, 18, .12),
    inset 0 1px 0 rgba(255, 255, 255, .045);
  overflow: hidden;
  transition: height .42s var(--ease);
}

/* هيرلاين شامبانيا معدني أعلى البطاقة */
.card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg,
    rgba(198, 166, 100, 0) 0%,
    #C6A664 18%,
    #E8D6A8 50%,
    #C6A664 82%,
    rgba(198, 166, 100, 0) 100%);
}

.card-sheen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 130px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(198, 166, 100, .11), rgba(198, 166, 100, .025) 46%, rgba(198, 166, 100, 0) 100%);
}

/* ============================ الترويسة ============================ */
.card-head {
  position: relative;
  text-align: center;
  margin-bottom: clamp(20px, 5vw, 28px);
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ornament span {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, rgba(198, 166, 100, 0), rgba(198, 166, 100, .75));
}

.ornament span:last-child {
  background: linear-gradient(90deg, rgba(198, 166, 100, .75), rgba(198, 166, 100, 0));
}

.ornament i {
  font-style: normal;
  font-size: 10px;
  line-height: 1;
  color: var(--champagne);
}

.card-title {
  margin: 0 0 8px;
  font-family: 'Amiri', 'IBM Plex Sans Arabic', serif;
  font-weight: 700;
  font-size: clamp(28px, 7.4vw, 34px);
  line-height: 1.35;
  letter-spacing: normal;
  color: var(--text-warm);
}

.card-sub {
  margin: 0;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.7;
  color: #8B8B8D;
}

/* ============================ الحقول ============================ */
.field {
  margin-bottom: 18px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  color: var(--muted);
}

.field-label::before {
  content: "✦";
  font-size: 9px;
  line-height: 1;
  color: var(--champagne);
  transform: translateY(-1px);
}

.input-wrap {
  position: relative;
}

.field-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: #F2EFE8;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  text-align: left;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field-input::placeholder {
  color: #5C5C5E;
  font-weight: 300;
}

.field-input:hover {
  border-color: #363638;
}

.field-input:focus {
  outline: none;
  border-color: var(--champagne);
  background: #1D1D1F;
  box-shadow: 0 0 0 3px rgba(198, 166, 100, .18);
}

#password {
  padding-right: 54px;
}

/* زر العين */
.pass-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #86868A;
  cursor: pointer;
  transition: color .16s ease, background .16s ease;
  -webkit-user-select: none;
  user-select: none;
}

.pass-toggle:hover {
  color: var(--champagne-soft);
  background: rgba(198, 166, 100, .09);
}

.pass-toggle:active {
  background: rgba(198, 166, 100, .16);
}

.pass-toggle:focus-visible {
  outline: 2px solid var(--champagne);
  outline-offset: 2px;
  color: var(--champagne-soft);
}

/* رسائل الخطأ */
.field-error {
  margin: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--error);
  transition: max-height .22s ease, opacity .22s ease, margin .22s ease;
}

.field.is-invalid .field-error {
  max-height: 64px;
  margin-top: 8px;
  opacity: 1;
}

.field.is-invalid .field-input {
  border-color: rgba(232, 132, 124, .62);
  background: #1E1A1B;
  box-shadow: 0 0 0 3px rgba(232, 132, 124, .1);
}

.field.is-invalid .field-input:focus {
  border-color: rgba(232, 132, 124, .85);
  box-shadow: 0 0 0 3px rgba(232, 132, 124, .16);
}

.shake {
  animation: shake .4s cubic-bezier(.36, .07, .19, .97);
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ============================ زر الإرسال ============================ */
.btn-submit {
  position: relative;
  width: 100%;
  height: 54px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid rgba(232, 214, 168, .5);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #E8D6A8 0%, #C6A664 56%, #AE8E4F 100%);
  color: #1B1610;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: normal;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 10px 24px rgba(198, 166, 100, .18),
    inset 0 1px 0 rgba(255, 255, 255, .48);
  transition: filter .2s ease, box-shadow .24s ease, transform .12s ease;
  -webkit-user-select: none;
  user-select: none;
}

/* لمعة الشامبانيا عند التحويم */
.btn-submit::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -70%;
  width: 45%;
  opacity: 0;
  transform: skewX(-18deg);
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .62), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.btn-submit:active {
  transform: translateY(1px);
  box-shadow:
    0 6px 16px rgba(198, 166, 100, .2),
    inset 0 1px 0 rgba(255, 255, 255, .35);
}

.btn-submit:focus-visible {
  outline: 2px solid var(--champagne-soft);
  outline-offset: 3px;
}

.btn-submit.is-loading {
  cursor: progress;
  filter: saturate(.94) brightness(.98);
}

.btn-spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid rgba(27, 22, 16, .25);
  border-top-color: #1B1610;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (hover: hover) and (pointer: fine) {
  .btn-submit:not(.is-loading):hover {
    filter: brightness(1.06);
    box-shadow:
      0 14px 32px rgba(198, 166, 100, .3),
      inset 0 1px 0 rgba(255, 255, 255, .55);
  }
  .btn-submit:not(.is-loading):hover::after {
    animation: sheen .85s var(--ease);
  }
}

@keyframes sheen {
  0%   { left: -70%; opacity: 1; }
  100% { left: 130%; opacity: 0; }
}

/* ============================ الملاحظة ============================ */
.note {
  margin: 14px 0 0;
  font-size: 11.5px;
  font-weight: 300;
  line-height: 1.9;
  text-align: center;
  color: var(--muted-2);
}

/* ============================ حالة التأكيد ============================ */
#successView {
  position: relative;
  text-align: center;
  animation: fadeUp .45s var(--ease) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mark {
  width: 92px;
  height: 92px;
  margin: 4px auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(198, 166, 100, .45);
  background: radial-gradient(circle at 50% 28%, rgba(198, 166, 100, .16), rgba(198, 166, 100, 0) 72%);
  box-shadow: 0 0 0 7px rgba(198, 166, 100, .055), 0 14px 30px rgba(0, 0, 0, .28);
  animation: pop .5s var(--ease) both;
}

@keyframes pop {
  0%   { opacity: 0; transform: scale(.82); }
  60%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

.mark svg {
  width: 66px;
  height: 66px;
}

.mark-circle {
  fill: none;
  stroke: rgba(198, 166, 100, .6);
  stroke-width: 1.5;
  stroke-dasharray: 184;
  stroke-dashoffset: 184;
  animation: draw .75s ease forwards;
}

.mark-check {
  fill: none;
  stroke: var(--champagne-soft);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 46;
  stroke-dashoffset: 46;
  animation: draw .45s .38s ease forwards;
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

.success-title {
  margin: 0 0 8px;
  font-family: 'Amiri', 'IBM Plex Sans Arabic', serif;
  font-weight: 700;
  font-size: clamp(23px, 6vw, 27px);
  line-height: 1.45;
  color: var(--text-warm);
}

.success-sub {
  margin: 0 0 22px;
  font-size: 12.5px;
  font-weight: 300;
  line-height: 1.8;
  color: #8B8B8D;
}

.echo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--field-bg);
  text-align: start;
}

.echo-key {
  flex: none;
  font-size: 12px;
  color: var(--muted);
}

.echo-val {
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: #EDE8DC;
  text-align: end;
}

.btn-ghost {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(198, 166, 100, .42);
  border-radius: var(--radius);
  background: transparent;
  color: var(--champagne-soft);
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
  -webkit-user-select: none;
  user-select: none;
}

.btn-ghost:hover {
  background: rgba(198, 166, 100, .1);
  border-color: var(--champagne);
  color: #F3E7C8;
}

.btn-ghost:active {
  transform: translateY(1px);
}

.btn-ghost:focus-visible {
  outline: 2px solid var(--champagne);
  outline-offset: 3px;
}

/* ============================ أدوات ============================ */
.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .mark-check,
  .mark-circle {
    stroke-dashoffset: 0;
  }
}

/* شاشات قصيرة جدًا */
@media (max-height: 620px) {
  .ornament { margin-bottom: 8px; }
  .card-head { margin-bottom: 16px; }
  .field { margin-bottom: 14px; }
  .field-input { height: 48px; }
  .btn-submit { height: 50px; }
}