/* =========================================================
   Drip Tea - Login / Register theme
   Matches assets_css/style.css: soft-gray background, white neumorphic
   card, black panel (like the sidebar) and caramel accent buttons.
   Loaded AFTER css.css and the inline <style> in login.php.
   ========================================================= */
:root {
  --orange: #C57C4D;
  --orange-deep: #B06A3D;
  --peach: #E5CEC2;
  --charcoal: #1b1b1b;
  --bg: #d4d4d4;
  --shadow-dark: #b1b1b1;
  --shadow-light: #f4f4f4;
  --ink: #1b1b1b;
  --ink-soft: #4f4f4f;
  --ink-faint: #7a7a7a;
  --border: #ead9cf;
  --btn-bg: linear-gradient(145deg, #d08556, #bb7142);
  --r-lg: 26px;
  --r-md: 18px;
  --r-pill: 999px;
}

* { font-family: 'Open Sans', sans-serif; }

body {
  background: var(--bg);
  color: var(--ink);
}

/* ---------- Card ---------- */
.container {
  background: #ffffff;
  border-radius: var(--r-lg);
  box-shadow: 9px 9px 20px var(--shadow-dark), -9px -9px 20px var(--shadow-light);
}

.form-box { background: #ffffff; color: var(--ink); }

.container h1 {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.container p { color: var(--ink-soft); }

/* ---------- Inputs (soft inset) ---------- */
.input-box input {
  background: #f3f3f3;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  box-shadow: inset 3px 3px 7px #d9d9d9, inset -3px -3px 7px #ffffff;
  color: var(--ink);
  font-weight: 600;
  transition: border-color .2s, box-shadow .2s;
}

.input-box input::placeholder { color: var(--ink-faint); font-weight: 500; }

.input-box input:focus {
  border-color: var(--orange);
  box-shadow: inset 3px 3px 7px #d9d9d9, inset -3px -3px 7px #ffffff, 0 0 0 3px rgba(197, 124, 77, .18);
}

.input-box i { color: var(--orange); }
.input-box .toggle-password { color: var(--ink-faint); }
.input-box .toggle-password:hover { color: var(--orange-deep); }

.forget-link a { color: var(--ink-soft); font-weight: 600; transition: color .2s; }
.forget-link a:hover { color: var(--orange-deep); }

/* ---------- Buttons ---------- */
.btn {
  background: var(--btn-bg);
  color: #ffffff;
  border-radius: var(--r-pill);
  box-shadow: 5px 5px 11px #cfcfcf, -5px -5px 11px #ffffff;
  font-weight: 700;
  letter-spacing: .3px;
  transition: transform .15s, box-shadow .2s, filter .2s;
}

.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: inset 3px 3px 7px rgba(0,0,0,.25); }

/* ---------- Google button + divider ---------- */
.btn-google {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: 5px 5px 11px #e2e2e2, -5px -5px 11px #ffffff;
  font-weight: 700;
}

.btn-google:hover { background: #fbf6f2; color: var(--orange-deep); }

.social-login-divider { color: var(--ink-faint); font-weight: 600; }
.social-login-divider::before,
.social-login-divider::after { border-bottom-color: var(--border); }

/* ---------- Black sliding panel (same black as the sidebar) ---------- */
.toggle-box::before {
  background: #000000;
  background-image: radial-gradient(circle at 30% 20%, #1c1c1c 0%, #000000 70%);
}

.toggle-panel { color: #ffffff; }
.toggle-panel h1 { color: #ffffff; }
.toggle-panel p { color: #dcdcdc; }

.toggle-panel .btn {
  background: transparent;
  border: 2px solid var(--orange);
  color: #ffffff;
  box-shadow: none;
}

.toggle-panel .btn:hover { background: var(--btn-bg); border-color: transparent; }

/* ---------- Messages ---------- */
.login-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-size: .85rem;
  font-weight: 600;
  text-align: center;
  background: #ffffff;
  box-shadow: 5px 5px 14px #b8b8b8, -4px -4px 12px #f4f4f4;
  animation: alertIn .3s ease;
}

.login-alert.error   { color: #b3261e; border-left: 5px solid #d9534f; }
.login-alert.success { color: #1e7b4a; border-left: 5px solid #198754; }

@keyframes alertIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Loading overlay ---------- */
#loading-overlay { background: rgba(0, 0, 0, .75) !important; }
#loading-overlay > div { border-top-color: var(--orange) !important; }

/* ---------- Phones: card fills the screen ---------- */
@media (max-width: 768px) {
  body { background: #ffffff; }
  .container { background: #ffffff; }
}

/* =========================================================
   PHONE FIX: the Login and Register forms used to slide past each
   other vertically (both visible at once = the glitch).
   Now they stay in place and swap with a quick fade while the black
   panel is sweeping over them, so nothing overlaps.
   ========================================================= */
@media (max-width: 650px) {
  /* forms never move; only fade */
  .form-box.login,
  .container.active .form-box.login {
    right: 0 !important;
    left: auto !important;
    bottom: 0 !important;
  }

  .form-box.register,
  .container.active .form-box.register {
    left: 0 !important;
    right: auto !important;
    bottom: 20px !important;
  }

  .form-box.login          { opacity: 1; visibility: visible; }
  .container.active .form-box.login    { opacity: 0; visibility: hidden; }
  .form-box.register       { opacity: 0; visibility: hidden; }
  .container.active .form-box.register { opacity: 1; visibility: visible; }

  /* swap happens at ~0.75s, when the black panel is covering the form area */
  .form-box.login,
  .form-box.register {
    transition: opacity .3s ease .75s, visibility 0s linear .75s !important;
  }

  /* no flash on first paint */
  .container.preload .form-box { transition: none !important; }
}

/* phones with a collapsing address bar: use the real visible height */
@supports (height: 100dvh) {
  @media (max-width: 768px) {
    .container { height: 100dvh !important; }
  }
}


/* =========================================================
   PHONE LAYOUT v3 - everything fits on ONE screen, no page scroll.
   - Container is pinned to the real visible screen (position: fixed),
     so the browser toolbar / 100vh bug can no longer cause scrolling.
   - Black panel height is a variable; the form takes the rest.
   - Sizes scale with screen height so small phones still show it all.
   - If the screen is very short (keyboard open / landscape), the panel
     shrinks to a slim bar and the form area itself can scroll as a
     last resort, so nothing is ever cut off.
   ========================================================= */
:root { --u: 1vh; }
@supports (height: 100dvh) { :root { --u: 1dvh; } }

@media (max-width: 650px) {
  :root { --panel-h: clamp(150px, calc(var(--u) * 28), 240px); }

  html, body {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none;
  }
  body { display: block !important; background: #ffffff; }

  .container {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    border-radius: 0 !important;
    display: block !important;
  }

  /* ----- black panel (top on Login, bottom on Register) ----- */
  .toggle-box::before {
    left: 0;
    width: 100%;
    height: 300%;
    top: calc(var(--panel-h) - 300%);
    border-radius: 20vw;
  }
  .container.active .toggle-box::before {
    left: 0;
    top: calc(100% - var(--panel-h));
  }

  .toggle-panel {
    width: 100% !important;
    height: var(--panel-h) !important;
    padding: 0 24px 10px;
  }
  .toggle-panel.toggle-left { top: 0; left: 0 !important; }
  .container.active .toggle-panel.toggle-left {
    top: calc(-1 * var(--panel-h));
    left: 0 !important;
  }
  .toggle-panel.toggle-right {
    top: auto;
    right: 0;
    left: auto !important;
    bottom: calc(-1 * var(--panel-h));
  }
  .container.active .toggle-panel.toggle-right { bottom: 0; }

  .toggle-panel img.logo {
    width: auto !important;
    max-width: 60% !important;
    height: clamp(38px, calc(var(--u) * 8.5), 66px) !important;
    margin: 0 0 4px !important;
  }
  .toggle-panel h1 {
    font-size: clamp(21px, calc(var(--u) * 3.8), 30px);
    line-height: 1.2;
    margin: 0 !important;
  }
  .toggle-panel p {
    font-size: 13px;
    line-height: 1.3;
    margin: 4px 0 10px !important;
  }
  .toggle-panel .btn {
    width: 140px;
    height: clamp(34px, calc(var(--u) * 5.4), 42px);
    font-size: 14px;
  }

  /* ----- forms: fill the space that the panel leaves ----- */
  .form-box.login,
  .container.active .form-box.login {
    top: var(--panel-h) !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }
  .form-box.register,
  .container.active .form-box.register {
    top: 0 !important;
    bottom: var(--panel-h) !important;
    left: 0 !important;
    right: 0 !important;
  }
  .form-box {
    width: 100% !important;
    height: auto !important;
    padding: 6px 24px !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    overflow-y: auto;            /* only kicks in if the screen is extremely short */
    overscroll-behavior: contain;
  }
  .form-box.login form,
  .form-box.register form {
    width: 100%;
    max-width: 340px;
    margin: auto !important;     /* centres when there is room, scrolls from the top when not */
  }

  .container .form-box h1 {
    font-size: clamp(24px, calc(var(--u) * 4.4), 32px);
    line-height: 1.2;
    margin: 0 0 2px !important;
  }
  .input-box { margin: clamp(7px, calc(var(--u) * 1.7), 14px) 0 !important; }
  .input-box input {
    height: clamp(40px, calc(var(--u) * 6.4), 48px);
    padding: 0 44px 0 18px !important;
    font-size: 16px;              /* 16px stops iPhones zooming in on focus */
  }
  .input-box i { font-size: 17px; }
  .forget-link { margin: -2px 0 clamp(8px, calc(var(--u) * 1.5), 12px) !important; }
  .forget-link a { font-size: 13px; }
  .form-box .btn,
  .btn-google {
    height: clamp(40px, calc(var(--u) * 6.4), 48px) !important;
    font-size: 15px;
  }
  .social-login-divider { margin: clamp(6px, calc(var(--u) * 1.4), 12px) 0 !important; font-size: 12px; }
}

/* very short screens: keyboard open, or phone held sideways */
@media (max-width: 650px) and (max-height: 500px) {
  :root { --panel-h: 58px; }
  .toggle-panel { padding: 0 24px; justify-content: center; }
  .toggle-panel img.logo,
  .toggle-panel h1,
  .toggle-panel p { display: none !important; }
  .toggle-panel .btn { height: 34px; width: 150px; }
  .input-box { margin: 6px 0 !important; }
  .input-box input,
  .form-box .btn,
  .btn-google { height: 38px !important; }
}
