/* public/css/auth.css - Landing Page & Auth Modal */

/* Prevent flash of unauthenticated content */
.app-container {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

body.authenticated .app-container {
  opacity: 1;
  visibility: visible;
}

/* Base Landing Portal Overlay with smooth fade dismissal */
.realm-landing-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  color: #e8ddc9;
  font-family: 'Quicksand', sans-serif;
  transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1), transform 0.65s cubic-bezier(0.4, 0, 0.2, 1), filter 0.65s ease;
  background-color: #050508;
}

/* Fade out transition when user logs in */
.realm-landing-overlay.fade-out {
  opacity: 0;
  transform: scale(1.03);
  filter: blur(4px);
  pointer-events: none;
}

/* =========================================================
   REAL-TIME SKY THEMES & BACKGROUNDS
   ========================================================= */

/* Default Midnight / Deep Night (Pure obsidian black with deep navy ceiling) */
.realm-landing-overlay.sky-midnight,
.realm-landing-overlay:not([class*="sky-"]) {
  background: radial-gradient(circle at 50% 25%, #0f1424 0%, #080a12 50%, #020306 100%);
}

/* Deep Night (1am - 4am) */
.realm-landing-overlay.sky-night {
  background: radial-gradient(circle at 50% 30%, #151a30 0%, #0b0f1d 55%, #030408 100%);
}

/* Dawn / Early Morning (5am - 7am) - faint golden amber horizon at the bottom */
.realm-landing-overlay.sky-dawn {
  background: linear-gradient(180deg, #0d1222 0%, #1b1e33 45%, #3d2a3a 75%, #6a3e35 92%, #a8623d 100%);
}

/* Morning (8am - 11am) - rich atmospheric sky with lower daylight */
.realm-landing-overlay.sky-morning {
  background: linear-gradient(180deg, #10192e 0%, #1d2b45 40%, #304764 70%, #526f84 90%, #8ca6b5 100%);
}

/* Midday / Afternoon (12pm - 4pm) - deep celestial overhead with daylight glow at the bottom */
.realm-landing-overlay.sky-midday {
  background: linear-gradient(180deg, #0e1526 0%, #182844 35%, #2a4163 65%, #466785 88%, #9bbcd4 100%);
}

/* Dusk / Golden Hour (5pm - 7pm) - dramatic twilight */
.realm-landing-overlay.sky-dusk {
  background: linear-gradient(180deg, #0b0e1a 0%, #1c172b 40%, #422038 70%, #753335 88%, #b85b37 100%);
}

/* Evening / Twilight (8pm - 11pm) - fading dusk into stars */
.realm-landing-overlay.sky-evening {
  background: radial-gradient(circle at 50% 20%, #181d33 0%, #0d1120 60%, #05070d 100%);
}

/* =========================================================
   STARS & CELESTIAL AMBIENCE
   ========================================================= */

.realm-sky-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: 
    radial-gradient(1.5px 1.5px at 15% 18%, rgba(255, 255, 255, 0.9) 100%, transparent),
    radial-gradient(1.2px 1.2px at 32% 42%, rgba(255, 255, 255, 0.8) 100%, transparent),
    radial-gradient(1.8px 1.8px at 68% 15%, rgba(255, 248, 220, 0.95) 100%, transparent),
    radial-gradient(1.4px 1.4px at 82% 38%, rgba(255, 255, 255, 0.75) 100%, transparent),
    radial-gradient(1.2px 1.2px at 48% 22%, rgba(255, 255, 255, 0.85) 100%, transparent),
    radial-gradient(1.6px 1.6px at 90% 70%, rgba(255, 250, 230, 0.65) 100%, transparent),
    radial-gradient(1.3px 1.3px at 25% 78%, rgba(255, 255, 255, 0.6) 100%, transparent),
    radial-gradient(1.5px 1.5px at 60% 82%, rgba(255, 255, 255, 0.5) 100%, transparent),
    radial-gradient(1px 1px at 7% 55%, rgba(255, 255, 255, 0.7) 100%, transparent),
    radial-gradient(1.5px 1.5px at 42% 65%, rgba(255, 240, 200, 0.75) 100%, transparent);
  background-size: 550px 550px;
  animation: celestialTwinkle 6s ease-in-out infinite alternate;
}

.realm-sky-stars-secondary {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: 
    radial-gradient(1.2px 1.2px at 12% 85%, rgba(255, 255, 255, 0.6) 100%, transparent),
    radial-gradient(1.6px 1.6px at 78% 52%, rgba(255, 230, 180, 0.8) 100%, transparent),
    radial-gradient(1.1px 1.1px at 55% 12%, rgba(255, 255, 255, 0.7) 100%, transparent),
    radial-gradient(1.3px 1.3px at 88% 8%, rgba(255, 255, 255, 0.85) 100%, transparent),
    radial-gradient(1.4px 1.4px at 22% 33%, rgba(255, 255, 255, 0.75) 100%, transparent),
    radial-gradient(1px 1px at 38% 88%, rgba(255, 255, 255, 0.6) 100%, transparent);
  background-size: 420px 420px;
  animation: celestialTwinkle 8s ease-in-out infinite alternate-reverse;
}

/* Hide or fade stars during high daylight */
.realm-landing-overlay.sky-midday .realm-sky-stars,
.realm-landing-overlay.sky-midday .realm-sky-stars-secondary {
  opacity: 0.18;
}

.realm-landing-overlay.sky-morning .realm-sky-stars,
.realm-landing-overlay.sky-morning .realm-sky-stars-secondary,
.realm-landing-overlay.sky-dawn .realm-sky-stars,
.realm-landing-overlay.sky-dusk .realm-sky-stars {
  opacity: 0.45;
}

@keyframes celestialTwinkle {
  0% { opacity: 0.65; transform: translateY(0); }
  50% { opacity: 0.95; }
  100% { opacity: 0.55; transform: translateY(-1px); }
}

/* =========================================================
   CONTAINER & MODAL CARD
   ========================================================= */

.realm-landing-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 500px;
  background: #241d17;
  border: 1px solid #4a3b2c;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(201, 162, 75, 0.1);
  border-radius: 14px;
  overflow: hidden;
  animation: portalFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes portalFadeIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.landing-hero-header {
  background: linear-gradient(180deg, #2e251d 0%, #241d17 100%);
  border-bottom: 1px solid #4a3b2c;
  padding: 28px 24px 22px 24px;
  text-align: center;
  position: relative;
}

.landing-realm-crest {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 12px rgba(201, 162, 75, 0.4));
  user-select: none;
}

.landing-title {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: #e8ddc9;
  background: linear-gradient(135deg, #f7f1e5 20%, #c9a24b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-subtitle {
  margin: 6px 0 0 0;
  font-size: 0.82rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #b3a189;
  font-weight: 600;
}

.landing-realm-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 4px 12px;
  background: rgba(107, 143, 90, 0.15);
  border: 1px solid rgba(107, 143, 90, 0.35);
  border-radius: 20px;
  font-size: 0.75rem;
  color: #8bb579;
  font-weight: 600;
}

.landing-status-dot {
  width: 7px;
  height: 7px;
  background: #6b8f5a;
  border-radius: 50%;
  box-shadow: 0 0 8px #6b8f5a;
}

.landing-status-dot.offline {
  background: #a44a3f;
  box-shadow: 0 0 8px #a44a3f;
}

.landing-realm-status.offline {
  background: rgba(164, 74, 63, 0.15);
  border-color: rgba(164, 74, 63, 0.35);
  color: #d17b70;
}

.landing-body {
  padding: 24px;
}

/* Nav Tabs within Landing */
.landing-tab-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #1a1512;
  border: 1px solid #3d3023;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
}

.landing-tab-btn {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #b3a189;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.landing-tab-btn.active {
  background: #362a1f;
  color: #f7f1e5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.landing-tab-btn:hover:not(.active) {
  color: #e8ddc9;
}

/* Auth Forms */
.auth-form-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form-card .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form-card .form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #b3a189;
  letter-spacing: 0.3px;
}

.auth-form-card input {
  background: #1a1512;
  border: 1px solid #4a3b2c;
  color: #e8ddc9;
  padding: 11px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form-card input:focus {
  border-color: #c9a24b;
  box-shadow: 0 0 0 2px rgba(201, 162, 75, 0.2);
}

.auth-form-card input::placeholder {
  color: #6b5a47;
}

.auth-error {
  background: rgba(164, 74, 63, 0.18);
  border: 1px solid #a44a3f;
  color: #f5a9a0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.84rem;
  line-height: 1.4;
}

.btn-auth-primary {
  background: linear-gradient(135deg, #8b6f47 0%, #7c9473 100%);
  color: #ffffff;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #9c7f55;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-auth-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

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

.btn-auth-secondary {
  background: #2e251d;
  border: 1px solid #4a3b2c;
  color: #e8ddc9;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-auth-secondary:hover {
  background: #362a1f;
  color: #fff;
}

.landing-footer-divider {
  margin: 20px 0 16px 0;
  border-top: 1px solid #3d3023;
  position: relative;
  text-align: center;
}

.landing-footer-divider span {
  position: relative;
  top: -10px;
  background: #241d17;
  padding: 0 12px;
  font-size: 0.74rem;
  text-transform: uppercase;
  color: #8a7a63;
  letter-spacing: 1px;
}

/* Quick access / invitation section */
.landing-access-box {
  background: #1a1512;
  border: 1px dashed #4a3b2c;
  border-radius: 8px;
  padding: 14px;
}

.landing-access-box label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #b3a189;
  margin-bottom: 8px;
}

.landing-access-row {
  display: flex;
  gap: 8px;
}

.landing-access-row input {
  flex: 1;
  background: #241d17;
  border: 1px solid #4a3b2c;
  color: #e8ddc9;
  padding: 9px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}

.landing-access-row input:focus {
  border-color: #c9a24b;
}

.landing-access-row button {
  background: #362a1f;
  border: 1px solid #4a3b2c;
  color: #e8ddc9;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  transition: background 0.15s;
}

.landing-access-row button:hover {
  background: #4a3b2c;
  color: #fff;
}

/* Modal styling for authenticated user profile overlay */
.custom-auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 13, 10, 0.85);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.custom-auth-modal-box {
  background: #241d17;
  border: 1px solid #4a3b2c;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(201, 162, 75, 0.15);
  border-radius: 12px;
  width: 440px;
  max-width: 90vw;
  overflow: hidden;
  color: #e8ddc9;
  font-family: 'Quicksand', sans-serif;
}

.custom-auth-modal-box .modal-header {
  background: #1e1712;
  border-bottom: 1px solid #3d3023;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-auth-modal-box .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-family: 'Cinzel', serif;
  color: #c9a24b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-auth-modal-box .modal-close-btn {
  background: transparent;
  border: none;
  color: #b3a189;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.custom-auth-modal-box .modal-close-btn:hover {
  color: #fff;
  background: #362a1f;
}

.custom-auth-modal-box .modal-body {
  padding: 20px;
  background: #241d17;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #1a1512;
  border: 1px solid #4a3b2c;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
}

.user-profile-badge .profile-avatar {
  font-size: 2.2rem;
  background: #241d17;
  border: 1px solid #4a3b2c;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.user-profile-badge .profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-profile-badge .profile-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.user-profile-badge .profile-role-pill {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.profile-role-pill.owner { background: #8b6f47; color: #fff; }
.profile-role-pill.admin { background: #7c9473; color: #fff; }
.profile-role-pill.member { background: #3d3023; color: #b3a189; }

.user-profile-badge .profile-id-sub {
  font-size: 0.78rem;
  color: #8a7a63;
}
