/* =========================================================
   KAUZARIYYA - MODERN SPLIT-CARD AUTHENTICATION DESIGN SYSTEM
   Responsive Architecture & Phone Verification Modules
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --auth-bg: #12111a;
  --card-bg: #1b1926;
  --card-border: #2c283d;
  --input-bg: #242133;
  --input-border: #35304a;
  --input-focus: #facc15;
  --primary-accent: #facc15;
  --primary-accent-hover: #eab308;
  --primary-gradient: linear-gradient(135deg, #facc15 0%, #15803d 100%);
  --purple-gradient: linear-gradient(135deg, #6c5ce7 0%, #5b4bc4 100%);
  --text-main: #f8fafc;
  --text-muted: #948fa6;
  --text-dim: #656078;
  --error-bg: rgba(239, 68, 68, 0.12);
  --error-border: rgba(239, 68, 68, 0.25);
  --error-text: #fca5a5;
  --success-bg: rgba(250, 204, 21, 0.12);
  --success-border: rgba(250, 204, 21, 0.25);
  --success-text: #86efac;
  --radius-card: 24px;
  --radius-inner: 18px;
  --radius-input: 12px;
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Cairo', 'Inter', -apple-system, sans-serif;
  background-color: var(--auth-bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Base Layout Wrapper */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  background: radial-gradient(circle at 15% 20%, rgba(250, 204, 21, 0.08) 0%, transparent 45%),
              radial-gradient(circle at 85% 80%, rgba(108, 92, 231, 0.08) 0%, transparent 45%),
              var(--auth-bg);
}

/* Floating Dual-Panel Auth Card */
.auth-card {
  width: 100%;
  max-width: 980px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  position: relative;
}

/* =========================================================
   RESPONSIVE ARCHITECTURE BREAKPOINTS
   On small screen sizes (<768px), NO IMAGES NEEDED to optimize space & load time
   ========================================================= */
@media (max-width: 768px) {
  .auth-page {
    padding: 16px 12px;
  }

  .auth-card {
    grid-template-columns: 1fr;
    max-width: 440px;
    border-radius: 20px;
  }

  /* Completely remove background image poster on small screens */
  .auth-poster {
    display: none !important;
  }

  .auth-form-wrap {
    padding: 28px 20px;
  }

  .auth-form-header h1 {
    font-size: 26px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .auth-card {
    max-width: 840px;
  }

  .auth-form-wrap {
    padding: 36px 32px;
  }
}

/* =========================================================
   LEFT POSTER COLUMN (DESKTOP / TABLET ONLY)
   ========================================================= */
.auth-poster {
  position: relative;
  margin: 12px;
  border-radius: var(--radius-inner);
  overflow: hidden;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px;
  background-color: #161422;
}

.auth-poster-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.auth-card:hover .auth-poster-bg {
  transform: scale(1.04);
}

.auth-poster-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(18, 16, 26, 0.45) 0%,
    rgba(18, 16, 26, 0.75) 50%,
    rgba(18, 16, 26, 0.95) 100%
  );
}

.auth-poster-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-poster-logo {
  height: 38px;
  width: auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.4));
}

.auth-poster-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.auth-poster-back:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateX(-2px);
}

.auth-poster-content {
  position: relative;
  z-index: 2;
  margin-top: auto;
}

.auth-poster-kicker {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary-accent);
  margin-bottom: 8px;
}

.auth-poster-content h2 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.auth-poster-content p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 24px;
}

.auth-poster-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-poster-dots .dot {
  height: 4px;
  width: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.auth-poster-dots .dot.active {
  width: 32px;
  background: #ffffff;
}

/* =========================================================
   RIGHT FORM COLUMN
   ========================================================= */
.auth-form-wrap {
  padding: 44px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form-header {
  margin-bottom: 24px;
}

/* Small mobile logo banner if image poster is hidden */
.mobile-brand-logo {
  display: none;
  height: 36px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .mobile-brand-logo {
    display: block;
  }
}

.auth-form-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.auth-form-header p {
  font-size: 14px;
  color: var(--text-muted);
}

.auth-form-header p a {
  color: var(--primary-accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.auth-form-header p a:hover {
  text-decoration: underline;
}

/* Alert Messages */
.auth-alert {
  padding: 14px 18px;
  border-radius: var(--radius-input);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-alert-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

.auth-alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

.auth-alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

/* Form Groups & Inputs */
.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

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

.input-box i.field-icon {
  position: absolute;
  left: 16px;
  color: var(--text-dim);
  font-size: 16px;
  pointer-events: none;
  transition: color 0.2s ease;
}

.input-box input {
  width: 100%;
  height: 50px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  padding: 0 16px 0 46px;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  font-family: inherit;
  outline: none;
  transition: all 0.25s ease;
}

.input-box input.no-icon {
  padding-left: 16px;
}

.input-box input::placeholder {
  color: var(--text-dim);
}

.input-box input:focus {
  background: rgba(36, 33, 51, 0.9);
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.2);
}

.input-box:focus-within i.field-icon {
  color: var(--primary-accent);
}

/* Password eye toggle */
.toggle-pass {
  position: absolute;
  right: 14px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.toggle-pass:hover {
  color: #ffffff;
}

/* =========================================================
   PHONE VERIFICATION MODULE (FOR SIGN IN & SIGN UP)
   ========================================================= */
.phone-input-wrap {
  display: flex;
  gap: 8px;
}

.phone-input-wrap .input-box {
  flex: 1;
}

.btn-phone-verify {
  height: 50px;
  padding: 0 16px;
  border-radius: var(--radius-input);
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: var(--primary-accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.btn-phone-verify:hover {
  background: var(--primary-accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(250, 204, 21, 0.35);
}

.btn-phone-verify:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.otp-verification-box {
  margin-top: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  display: flex;
  gap: 8px;
  align-items: center;
}

.otp-verification-box input {
  flex: 1;
  height: 42px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 2px;
  text-align: center;
  outline: none;
}

.btn-otp-confirm {
  height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--primary-accent);
  border: none;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.btn-otp-confirm:hover {
  background: var(--primary-accent-hover);
}

/* Options row (Remember me / Forgot password) */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  margin-bottom: 6px;
  font-size: 13px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.form-checkbox input[type="checkbox"] {
  accent-color: var(--primary-accent);
  width: 16px;
  height: 16px;
  border-radius: 4px;
  cursor: pointer;
}

.forgot-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.forgot-link:hover {
  color: var(--primary-accent);
  text-decoration: underline;
}

/* Main Action Button */
.btn-submit {
  width: 100%;
  height: 52px;
  border-radius: var(--radius-input);
  background: var(--primary-gradient);
  border: none;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 8px 24px rgba(250, 204, 21, 0.35);
  margin-top: 4px;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(250, 204, 21, 0.45);
  background: linear-gradient(135deg, #16cca7 0%, #0f9f92 100%);
}

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

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--input-border);
}

.auth-divider span {
  padding: 0 12px;
}

/* Social Buttons Section */
.social-buttons {
  display: flex;
  gap: 12px;
  position: relative;
}

.btn-google-custom {
  flex: 1;
  height: 48px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-google-custom:hover {
  background: #2b283d;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-google-custom svg {
  width: 18px;
  height: 18px;
}

/* Invisible overlay for official Google GSI Iframe */
.gsi-overlay-wrap {
  position: relative;
  width: 100%;
}

.gsi-overlay-wrap .g_id_signin {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 48px;
  opacity: 0.01;
  z-index: 10;
  cursor: pointer;
}

.gsi-overlay-wrap .g_id_signin iframe {
  width: 100% !important;
  height: 48px !important;
  cursor: pointer !important;
}

/* Responsive hardening for compact phones, tablets, and short screens. */
html,
body,
.auth-page {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body {
  overflow-x: clip;
}

.auth-page {
  min-height: 100svh;
  padding:
    max(20px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.auth-card,
.auth-form-wrap,
.form-grid,
.form-field,
.phone-input-wrap,
.input-box,
.social-buttons {
  min-width: 0;
}

@media (max-width: 768px) {
  .auth-card {
    width: min(100%, 480px);
  }

  .auth-form-wrap {
    padding: clamp(24px, 7vw, 38px);
  }

  .input-box input,
  .otp-verification-box input {
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .auth-page {
    align-items: flex-start;
    padding-inline: 10px;
  }

  .auth-card {
    border-radius: 18px;
  }

  .auth-form-wrap {
    padding: 24px 18px;
  }

  .auth-form-header h1 {
    font-size: 25px;
  }

  .form-options {
    align-items: flex-start;
    gap: 12px;
  }

  .phone-input-wrap,
  .otp-verification-box {
    align-items: stretch;
    flex-direction: column;
  }

  .btn-phone-verify,
  .btn-otp-confirm {
    width: 100%;
    justify-content: center;
  }

  .gsi-overlay-wrap .btn-google-custom {
    width: 100%;
  }
}

@media (max-width: 350px) {
  .phone-input-wrap,
  .otp-verification-box,
  .form-options {
    align-items: stretch;
    flex-direction: column;
  }

  .btn-phone-verify,
  .btn-otp-confirm {
    width: 100%;
    justify-content: center;
  }
}

@media (max-height: 700px) and (min-width: 769px) {
  .auth-page {
    align-items: flex-start;
  }

  .auth-poster {
    min-height: 500px;
  }
}

/* Guest Login Button Style */
.btn-guest {
  width: 100%;
  height: 50px;
  border-radius: var(--radius-input);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-guest:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

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