* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --dealify-blue: #00c4e9;
  --dealify-blue-dark: #08a8cb;
  --text-dark: #222222;
  --label: #555555;
  --muted: #888888;
  --placeholder: #bbbbbb;
  --input-bg: #f7f8fa;
  --input-border: #e5e7eb;
  --error: #f44336;
  --success: #1e9f55;
  --ios-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--dealify-blue);
  color: #ffffff;
  font-family: var(--ios-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body,
input,
button,
select,
p,
h1,
h2,
h3,
label,
a,
span,
strong {
  font-family: var(--ios-font);
}

body {
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.signup-screen {
  position: relative;
  width: 100%;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 54px) 18px max(40px, calc(env(safe-area-inset-bottom, 0px) + 34px));
  background: var(--dealify-blue);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.back-button,
.language-button {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  z-index: 90;
  height: 38px;
  border: 0;
  background: transparent;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: 0;
  box-shadow: none;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.back-button {
  left: max(18px, calc((100vw - 620px) / 2 + 18px));
  width: 38px;
  border-radius: 19px;
}

.back-button i {
  font-size: 23px;
  line-height: 1;
}

.language-button {
  right: max(18px, calc((100vw - 620px) / 2 + 18px));
  min-width: 42px;
  padding: 0 2px;
  border-radius: 19px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.back-button:active,
.language-button:active {
  transform: scale(0.94);
  opacity: 0.78;
}

.hero-section {
  width: min(100%, 620px);
  text-align: center;
  padding: 44px 8px 26px;
}

.hero-section h1 {
  margin: 0 0 6px;
  color: #ffffff;
  font-size: 24px;
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: -0.2px;
  text-align: center;
}

.hero-section p {
  max-width: 430px;
  margin: 0 auto;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14.5px;
  line-height: 21px;
  font-weight: 600;
  text-align: center;
}

.hero-perks {
  display: none !important;
}

.signup-card {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 22px;
  border-radius: 22px;
  background: #ffffff;
  color: var(--text-dark);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.flash-message,
.error-banner {
  width: 100%;
  min-height: 46px;
  margin: 0 0 16px;
  padding: 11px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 700;
}

.flash-message.success {
  background: #e7f8ee;
  color: var(--success);
  border: 1px solid rgba(30, 159, 85, 0.30);
}

.flash-message.error,
.flash-message.danger,
.error-banner {
  background: #fff0f0;
  color: #e53935;
  border: 1px solid rgba(229, 57, 53, 0.34);
}

.error-banner[hidden] {
  display: none;
}

.input-group {
  margin-bottom: 15px;
}

.input-group label {
  display: block;
  margin: 0 0 7px 4px;
  color: var(--label);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 700;
}

.input-wrapper {
  width: 100%;
  height: 52px;
  min-height: 52px;
  border-radius: 12px;
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 14px;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.input-wrapper:focus-within {
  border-color: rgba(0, 196, 233, 0.58);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 196, 233, 0.10);
}

.input-wrapper.input-error {
  border-color: var(--error);
  background: #fffafa;
  box-shadow: 0 0 0 4px rgba(244, 67, 54, 0.08);
}

.input-icon {
  width: 18px;
  min-width: 18px;
  margin-right: 10px;
  color: #aaaaaa;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.input-wrapper input,
.input-wrapper select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: #222222;
  font-size: 15px;
  line-height: 20px;
  font-weight: 400;
  padding: 0;
  margin: 0;
  text-align: left;
}

.input-wrapper input::placeholder {
  color: var(--placeholder);
  opacity: 1;
  font-weight: 400;
}

.input-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-weight: 400;
}

.select-wrapper {
  position: relative;
}

.select-chevron {
  color: var(--dealify-blue);
  font-size: 13px;
  line-height: 1;
  margin-left: 8px;
  pointer-events: none;
  flex-shrink: 0;
}

.toggle-password {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  margin-right: -6px;
  margin-left: 0;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: #aaaaaa;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.toggle-password i {
  font-size: 18px;
  line-height: 1;
}

.field-error {
  display: block;
  min-height: 17px;
  margin-top: 5px;
  color: var(--error);
  font-size: 12.5px;
  line-height: 1.28;
  font-weight: 600;
}

.signup-button {
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: var(--dealify-blue);
  color: #ffffff;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 196, 233, 0.35);
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.signup-button:active {
  transform: scale(0.985);
}

.signup-button:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.mini-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.login-row {
  margin: 18px 0 23px;
  color: #888888;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  text-align: center;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
}

.login-row a {
  color: var(--dealify-blue);
  font-weight: 700;
  text-decoration: none;
}

.divider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.divider-row span {
  height: 1px;
  flex: 1;
  background: #e5e7eb;
}

.divider-row strong {
  color: #999999;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 600;
}

.social-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Google renders inside its own iframe. This only centers it like the app screen. */
.google-signin-wrapper {
  width: 100%;
  min-height: 44px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.g_id_signin {
  width: 280px !important;
  min-height: 44px !important;
}

.apple-button {
  width: 280px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: #000000;
  color: #ffffff;
  padding: 0 16px;
  font-family: Roboto, var(--ios-font);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.apple-button i {
  flex: 0 0 auto;
  font-size: 20px;
}

.apple-button span {
  flex: 1;
  text-align: center;
}

.footer-note {
  width: min(100%, 620px);
  margin: 18px auto 0;
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 400;
  text-align: center;
}

input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  -webkit-text-fill-color: #222222 !important;
  caret-color: #222222;
}

/* Arabic / RTL */
html[dir="rtl"] body,
body.is-ar {
  direction: rtl;
}

html[dir="rtl"] .back-button,
body.is-ar .back-button {
  left: auto;
  right: max(18px, calc((100vw - 620px) / 2 + 18px));
}

html[dir="rtl"] .language-button,
body.is-ar .language-button {
  right: auto;
  left: max(18px, calc((100vw - 620px) / 2 + 18px));
}

html[dir="rtl"] .back-button i,
body.is-ar .back-button i {
  transform: scaleX(-1);
}

html[dir="rtl"] .input-group label,
body.is-ar .input-group label {
  margin-left: 0;
  margin-right: 4px;
  text-align: right;
}

html[dir="rtl"] .input-wrapper,
body.is-ar .input-wrapper {
  flex-direction: row-reverse;
  direction: rtl;
}

html[dir="rtl"] .input-icon,
body.is-ar .input-icon {
  margin-right: 0;
  margin-left: 10px;
}

html[dir="rtl"] .input-wrapper input,
html[dir="rtl"] .input-wrapper select,
body.is-ar .input-wrapper input,
body.is-ar .input-wrapper select {
  text-align: right;
  writing-direction: rtl;
}

html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="tel"],
body.is-ar input[type="email"],
body.is-ar input[type="tel"] {
  direction: ltr;
  text-align: right;
  writing-direction: ltr;
}

html[dir="rtl"] .toggle-password,
body.is-ar .toggle-password {
  margin-right: 0;
  margin-left: -6px;
}

html[dir="rtl"] .select-chevron,
body.is-ar .select-chevron {
  margin-left: 0;
  margin-right: 8px;
}

html[dir="rtl"] .field-error,
body.is-ar .field-error {
  text-align: right;
  margin-left: 0;
  margin-right: 2px;
}

html[dir="rtl"] .flash-message,
html[dir="rtl"] .error-banner,
body.is-ar .flash-message,
body.is-ar .error-banner {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .login-row,
body.is-ar .login-row {
  flex-direction: row;
  direction: rtl;
}

html[dir="rtl"] .footer-note,
body.is-ar .footer-note {
  direction: rtl;
}

/* Tablet/laptop: still app look, not a marketing website split layout */
@media (min-width: 700px) {
  .signup-screen {
    justify-content: flex-start;
    padding-top: calc(env(safe-area-inset-top, 0px) + 64px);
  }

  .hero-section {
    width: min(calc(100vw - 36px), 560px);
    padding-top: 56px;
    padding-bottom: 32px;
  }

  .signup-card {
    width: min(calc(100vw - 36px), 560px);
    padding: 24px;
    border-radius: 22px;
  }

  .footer-note {
    width: min(calc(100vw - 36px), 560px);
  }
}

@media (min-width: 900px) and (orientation: landscape) {
  .hero-section,
  .signup-card,
  .footer-note {
    width: min(calc(100vw - 36px), 620px);
  }
}

@media (max-width: 390px) {
  .signup-screen {
    padding-left: 16px;
    padding-right: 16px;
  }

  .signup-card {
    padding: 20px;
  }

  .hero-section {
    padding-top: 38px;
    padding-bottom: 22px;
  }

  .g_id_signin,
  .apple-button {
    width: 100% !important;
    max-width: 280px;
  }
}

@media (max-height: 760px) {
  .hero-section {
    padding-top: 30px;
    padding-bottom: 18px;
  }

  .input-group {
    margin-bottom: 13px;
  }

  .login-row {
    margin-bottom: 18px;
  }

  .divider-row {
    margin-bottom: 14px;
  }
}
