/* ============================================================
   Riverside Marina — Web App Shared CSS
   Auth screens: splash, login, otp
   Inner app screens: fleet, captain, dock
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Cormorant+Garamond:wght@400;500;600;700&display=swap');

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; height: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: #1a1f3a;
  color: #ffffff;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-deep:          #13172e;
  --bg-base:          #1a1f3a;
  --bg-mid:           #222847;
  --bg-card:          rgba(255,255,255,0.06);
  --bg-input:         rgba(255,255,255,0.08);
  --bg-input-focus:   rgba(255,255,255,0.12);

  --text-primary:     #ffffff;
  --text-secondary:   rgba(255,255,255,0.5);
  --text-muted:       rgba(255,255,255,0.28);

  --accent:           #c8a96e;
  --accent-light:     #e2c07e;
  --accent-dim:       rgba(200,169,110,0.12);
  --accent-border:    rgba(200,169,110,0.3);

  --border:           rgba(255,255,255,0.09);
  --border-input:     rgba(255,255,255,0.12);
  --border-focus:     rgba(200,169,110,0.45);

  --btn-bg:           #ffffff;
  --btn-text:         #1a1f3a;

  --error:            #e87a7a;

  --radius-pill:      50px;
  --radius-lg:        20px;
  --radius-md:        14px;
  --radius-sm:        10px;

  --gradient-bg: url('/assets/images/bg_image.jpg') center/cover no-repeat fixed;

  /* App-specific accent — overridden per folder */
  --role-accent:      #c8a96e;    /* fleet = gold */
}

/* Captain override */
body.captain-app { --role-accent: #6eb5c8; }
/* Dock override */
body.dock-app    { --role-accent: #6ec88a; }

/* ── App screen shell ──────────────────────────────────────── */
.app-screen {
  min-height: 100dvh;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Glow blobs */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 380px; height: 380px;
  background: rgba(90,110,200,0.14);
  top: -100px; right: -80px;
  animation: blobFloat 8s ease-in-out infinite alternate;
}
.blob-2 {
  width: 280px; height: 280px;
  background: rgba(200,169,110,0.07);
  bottom: 60px; left: -80px;
  animation: blobFloat 10s ease-in-out infinite alternate-reverse;
}
@keyframes blobFloat {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(20px,30px) scale(1.08); }
}

.app-screen > * { position: relative; z-index: 1; }

/* ── SPLASH ─────────────────────────────────────────────────── */
.splash-screen {
  justify-content: center;
  align-items: center;
  gap: 0;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.splash-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  opacity: 0;
  transform: translateY(24px) scale(0.92);
  animation: authReveal 0.9s cubic-bezier(0.16,1,0.3,1) 0.1s forwards;
  margin-bottom: 32px;
}

.splash-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #fff;
  opacity: 0;
  animation: authReveal 0.9s cubic-bezier(0.16,1,0.3,1) 0.28s forwards;
  margin-bottom: 8px;
}

.splash-tagline {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  opacity: 0;
  animation: authReveal 0.9s cubic-bezier(0.16,1,0.3,1) 0.42s forwards;
}

.splash-dots {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  opacity: 0;
  animation: authReveal 0.6s ease 0.6s forwards;
}
.splash-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  animation: dotPulse 1.3s ease-in-out infinite;
}
.splash-dot:nth-child(2) { animation-delay: 0.22s; }
.splash-dot:nth-child(3) { animation-delay: 0.44s; }
@keyframes dotPulse {
  0%,100% { background: rgba(255,255,255,0.18); transform: scale(1); }
  50%      { background: rgba(255,255,255,0.65); transform: scale(1.35); }
}

/* ── AUTH SCREENS (login / otp) ─────────────────────────────── */
.auth-screen {
  justify-content: space-between;
  min-height: 100dvh;
}

.auth-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 64px 32px 24px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.auth-back {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 44px;
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  line-height: 1;
}
.auth-back:hover { background: rgba(255,255,255,0.07); }

.auth-heading {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(2rem, 8.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.12;
  color: #fff;
  margin-bottom: 14px;
  opacity: 0;
  animation: authReveal 0.7s cubic-bezier(0.16,1,0.3,1) 0.05s forwards;
}

.auth-sub {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 44px;
  opacity: 0;
  animation: authReveal 0.7s cubic-bezier(0.16,1,0.3,1) 0.12s forwards;
}

.auth-identifier {
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
  opacity: 0;
  animation: authReveal 0.7s cubic-bezier(0.16,1,0.3,1) 0.12s forwards;
}

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

/* ── Input ─────────────────────────────────────────────────── */
.rm-input-wrap {
  opacity: 0;
  animation: authReveal 0.7s cubic-bezier(0.16,1,0.3,1) 0.2s forwards;
}

.rm-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-pill);
  padding: 19px 26px;
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.25s, background 0.25s;
  -webkit-appearance: none;
  appearance: none;
}
.rm-input::placeholder { color: var(--text-muted); }
.rm-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
}

/* ── OTP boxes ─────────────────────────────────────────────── */
.otp-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 32px;
  opacity: 0;
  animation: authReveal 0.7s cubic-bezier(0.16,1,0.3,1) 0.18s forwards;
}

.otp-box {
  width: 50px;
  height: 60px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  -webkit-appearance: none;
  appearance: none;
  caret-color: var(--accent);
}
.otp-box:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  transform: scale(1.05);
}
.otp-box.filled { border-color: rgba(200,169,110,0.35); }
.otp-box.error  { border-color: var(--error) !important; }

/* ── Resend ─────────────────────────────────────────────────── */
.resend-wrap {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.65;
  opacity: 0;
  animation: authReveal 0.7s cubic-bezier(0.16,1,0.3,1) 0.28s forwards;
}
.resend-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
  display: inline;
}
.resend-btn:hover  { color: var(--accent-light); }
.resend-btn:disabled { color: var(--text-muted); text-decoration: none; cursor: default; }
.countdown-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ── Error ─────────────────────────────────────────────────── */
.err-msg {
  color: var(--error);
  font-size: 0.82rem;
  margin-top: 12px;
  display: none;
  padding-left: 4px;
  animation: authReveal 0.3s ease;
}

/* ── Bottom CTA ─────────────────────────────────────────────── */
.auth-footer {
  padding: 20px 32px max(28px, env(safe-area-inset-bottom));
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.btn-primary {
  width: 100%;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: var(--radius-pill);
  padding: 19px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  opacity: 0;
  animation: authReveal 0.7s cubic-bezier(0.16,1,0.3,1) 0.35s forwards;
}
.btn-primary:hover  { opacity: 0.93; transform: translateY(-1px); box-shadow: 0 6px 28px rgba(0,0,0,0.3); }
.btn-primary:active { opacity: 0.88; transform: translateY(0); }
.btn-primary:disabled { opacity: 0.38; cursor: default; transform: none; box-shadow: none; }

/* ── Spinner inside button ─────────────────────────────────── */
.btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(26,31,58,0.25);
  border-top-color: var(--btn-text);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ─────────────────────────────────────────────────── */
.rm-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(255,255,255,0.11);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-pill);
  padding: 12px 26px;
  font-size: 0.84rem;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  pointer-events: none;
}
.rm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (min-width: 520px) {
  .auth-body,
  .auth-footer { max-width: 440px; }
  .otp-box { width: 56px; height: 66px; }
}

@media (min-width: 900px) {
  /* On desktop, center the auth card */
  .auth-screen {
    align-items: center;
    justify-content: center;
    padding: 40px 0;
  }
  .auth-body {
    flex: unset;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 56px 48px 40px;
    backdrop-filter: blur(10px);
  }
  .auth-footer {
    max-width: 440px;
    padding: 0 48px 48px;
    /* pull up to join the card */
    margin-top: -20px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 28px 28px;
    backdrop-filter: blur(10px);
  }
  .auth-back { margin-bottom: 36px; }
}


/* ── Desktop back arrow — aligned to top-left of card ──────── */
@media (min-width: 900px) {
  .otp-back {
    position: absolute;
    top: -56px;
    left: 0;
  }

  /* Card needs relative positioning for the arrow */
  .otp-screen {
    position: relative;
  }

  /* Wrap card content so arrow can anchor to it */
  .otp-card-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

/* ── Mobile: full screen centered layout ───────────────────── */
@media (max-width: 899px) {

  /* Login screen — single flex column, content centered */
  .login-screen {
    justify-content: center;
    align-items: stretch;
    gap: 0;
  }

  .login-top {
    flex: unset;
    justify-content: flex-start;
    padding: 40px 28px 20px;
  }

  /* Override base justify-content:flex-end on the screen itself */
  .login-screen {
    justify-content: flex-start;
  }

  .login-footer {
    padding: 16px 28px max(32px, env(safe-area-inset-bottom));
  }

  /* OTP screen — same approach */
  .otp-screen {
    justify-content: center;
    align-items: stretch;
  }

  .otp-top {
    flex: unset;
    justify-content: flex-start;
    padding: 24px 28px 20px;
  }

  .otp-footer {
    padding: 16px 28px max(32px, env(safe-area-inset-bottom));
  }

  /* Back arrow — inline above the heading, not fixed/absolute */
  .otp-back {
    position: static;
    margin-bottom: 20px;
    align-self: flex-start;
  }
}

/* ── Desktop back arrow — sits above card top-left ─────────── */
@media (min-width: 900px) {
  .otp-card-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .otp-back {
    position: absolute;
    top: -56px;
    left: 0;
  }
}
