/* ======================================================
   header.css - Sticky Header & Global UI
====================================================== */

/* --- Main Header Container --- */
.global-header-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9000;
  transition: transform 0.3s ease;
  will-change: transform;
}

.global-header-wrapper.header-hidden {
  transform: translateY(-100%);
}

.global-header {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  height: 60px;
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
}

/* --- Sub Header --- */
.global-subheader {
  background: #c9ea12;
  color: #000;
  font-size: 12px;
  text-align: center;
  padding: 6px 0;
  font-family: "poppins-medium", sans-serif;
  font-weight: 500;
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

/* --- Icons & Logo --- */
.header-icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #000;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo img {
  height: 30px;
  width: auto;
  display: block;
}

.sidenav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.sidenav-overlay.open {
  opacity: 1;
  visibility: visible;
}

.sidenav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 85%;
  max-width: 300px;
  background: #fff;
  z-index: 9999;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.sidenav-drawer.open {
  transform: translateX(0);
}

.sidenav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.sidenav-content {
  flex: 1;

  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidenav-link {
  font-family: "poppins-medium", sans-serif;
  font-size: 16px;
  color: #333;
  text-decoration: none;
  padding: 5px 0;
}

.sidenav-footer {
  padding: 20px;
  background: #f8f8f8;
  border-top: 1px solid #eee;
}

.auth-link {
  color: #7a4aa3;
  font-weight: 600;
  cursor: pointer;
}

/* ======================================================
   GLOBAL TOAST (Reusable across all pages)
====================================================== */
.global-toast {
  visibility: hidden;
  opacity: 0;
  background-color: #000000a8;
  color: #fff;
  text-align: center;
  border-radius: 50px;
  padding: 10px 15px;
  position: fixed;
  z-index: 10005;
  left: 50%;
  bottom: 200px;
  transform: translateX(-50%);
  font-size: 14px;
  font-family:
    "poppins-medium",
    system-ui,
    -apple-system,
    sans-serif;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition:
    opacity 0.3s,
    bottom 0.3s;
  pointer-events: none;
}

.global-toast.show {
  visibility: visible;
  opacity: 1;
  bottom: 50px;
}

/* ======================================================
   GLOBAL WHATSAPP FLOAT (Reusable across all pages)
====================================================== */
.global-whatsapp-icon {
  position: fixed;
  bottom: 10px;
  right: 20px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.global-whatsapp-icon img {
  height: 60px;
  width: 60px;
  display: block;
}

/* --- Auth Modal --- */
.header-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: none;
  justify-content: center;
  align-items: flex-end; /* Mobile Bottom Sheet Style */
}

@media (min-width: 600px) {
  .header-modal-overlay {
    align-items: center;
  }
}

.header-modal-overlay.show {
  display: flex;
}

.header-auth-card {
  background: linear-gradient(to bottom, #603089, #ffffff);
  width: 100%;
  max-width: 500px;
  border-radius: 15px;
  padding: 25px 10px 10px 10px;
  margin: 10px;
  position: relative;
  text-align: center;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease-out;
}

@media (min-width: 600px) {
  .header-auth-card {
    border-radius: 20px;
    animation: fadeIn 0.3s ease-out;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(120%);
  }
}

/* ✅ smooth open/close without changing layout */
.header-auth-card {
  will-change: transform, opacity;
}

/* ✅ when closing, play slideDown */
.header-auth-card.closing {
  animation: slideDown 0.28s ease-in forwards;
}

/* ✅ also fade overlay slightly while closing */
.header-modal-overlay.closing {
  opacity: 0;
  transition: opacity 0.28s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-close-btn {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background: white;
  color: #7a4aa3;
  border-radius: 50%;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-title {
  color: #fff;
  font-family: "poppins-semibold", sans-serif;
  font-size: 22px;
  margin: 5px 0;
}

.auth-desc {
  color: #fff;
  font-size: 20px;
  margin-bottom: 20px;
  opacity: 0.9;
}

.input-group {
  background: white;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.header-input {
  width: 100%;
  padding: 12px;
  background: #f4f4f4;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  outline: none;
}

.header-btn {
  width: 100%;
  padding: 14px;
  background: #7a4aa3;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.header-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.otp-timer {
  margin-top: 15px;
  font-size: 12px;
  color: #555;
}

.link-text {
  color: #7a4aa3;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.error-msg {
  color: #ff4b4b;
  background: rgba(255, 0, 0, 0.2);
  border: 1px solid rgba(255, 0, 0, 0.3);
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 10px;
  display: none;
}

/* ======================================================
   ✅ Splashbook-like OTP Card UI (Header Modal)
====================================================== */

.header-otp-card {
  background: #fff;
  border-radius: 16px;
  padding: 10px;
  margin-top: 10px;
  text-align: center;
}

.header-otp-title {
  margin: 0px;
  margin-bottom: 5px;
  font-family: poppins-semibold;
  text-align: center;
  color: #7a4aa3;
}

.header-otp-subtitle {
  font-size: 12px;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-otp-phone {
  padding-top: 2px;
  color: #7a4aa3;
}

.header-otp-edit-btn {
  color: #7a4aa3;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  border: 1px solid #7a4aa3;
  border-radius: 10px;
  padding: 2px 8px;
}

.header-otp-input {
  width: 100%;
  padding: 14px;
  border: 1px solid #e0e0e0;
  background: #f9f9f9;
  border-radius: 12px;
  font-size: 13px;
  outline: none;
  font-family: poppins-medium;
  color: #000;
  transition: border 0.2s;
}

.header-otp-verify-btn {
  width: 100%;
  background: #7a4aa3;
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(122, 74, 163, 0.3);
}

.header-otp-timer {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #603089;
}

#header-recaptcha-container {
  display: none;
}

/* ======================================================
   ✅ Prevent header overlap on all pages
   Because header is position: fixed
====================================================== */
body.has-global-header {
  padding-top: 100px; /* requested spacing so header doesn't cover page */
}

#headerOtp {
  margin-bottom: 10px;
}

/* ======================================================
   Fix for Mobile Keyboard Overlap (Hybrid Safe)
   - Keeps slideUp / slideDown animations safe
   - Prevents "Resend OTP" from getting hidden (incl. Instagram in-app overlays)
====================================================== */

/* Prevent modal card from becoming too tall */
.header-auth-card {
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* Push the bottom-sheet up when keyboard is active (safe method) */
.header-modal-overlay.is-keyboard-active {
  transition: padding-bottom 0.3s ease;
  padding-bottom: 30vh;
  align-items: flex-end;
}

/* Allow overlay scrolling on very small screens */
.header-modal-overlay {
  overflow-y: auto;
}

/* ======================================================
   ✅ Splashbook-style footer overlay inside bottom padding
   For HEADER Login Modal (NOT extra height)
====================================================== */

.header-auth-card {
  position: relative; /* required for absolute footer overlay */
}

/* This is the overlay container sitting inside the extra padding-bottom */
.header-login-empty-space {
  position: absolute;
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom);

  height: 80px; /* same idea as Splashbook */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;

  pointer-events: none; /* ✅ important: doesn't block input/button clicks */
}

.header-auth-footer-note {
  width: 100%;
  max-width: 360px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.92);
  opacity: 0.95;
}

.header-auth-footer-text {
  font-size: 11px;
  color: black;
}

.header-auth-footer-text a {
  color: #7a4aa3;
  text-decoration: underline;
  font-weight: 700;
  pointer-events: auto; /* ✅ allow clicking T&C links */
}
