/* =================================================================
   Bond Associates Portal — main stylesheet
   ================================================================= */

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

:root {
  --brand:           #8B3CAD;
  --brand-hover:     #9d4cc0;
  --brand-soft:      rgba(139, 60, 173, 0.15);
  --brand-glow:      transparent;

  --bg:              #0a0a0a;
  --bg-elevated:     #111111;
  --surface:         rgba(255, 255, 255, 0.04);
  --surface-hover:   rgba(255, 255, 255, 0.07);

  --border:          rgba(255, 255, 255, 0.08);
  --border-strong:   rgba(255, 255, 255, 0.18);

  --text:            #DCDBD9;
  --text-muted:      rgba(220, 219, 217, 0.65);
  --text-faint:      rgba(220, 219, 217, 0.45);

  --danger:          #e85a5a;
  --danger-soft:     rgba(232, 90, 90, 0.12);
  --success:         #5acca0;

  --radius-sm:       6px;
  --radius:          10px;
  --radius-lg:       14px;
  --radius-pill:     999px;

  --shadow-soft:     0 10px 40px rgba(0, 0, 0, 0.35);
}


:root[data-theme="light"] {
  --brand:           #7f329f;
  --brand-hover:     #6d258a;
  --brand-soft:      rgba(139, 60, 173, 0.12);
  --brand-glow:      transparent;

  --bg:              #f7f5f1;
  --bg-elevated:     #ffffff;
  --surface:         rgba(35, 31, 32, 0.045);
  --surface-hover:   rgba(35, 31, 32, 0.075);

  --border:          rgba(35, 31, 32, 0.11);
  --border-strong:   rgba(35, 31, 32, 0.22);

  --text:            #231f20;
  --text-muted:      rgba(35, 31, 32, 0.68);
  --text-faint:      rgba(35, 31, 32, 0.46);

  --danger-soft:     rgba(232, 90, 90, 0.10);
  --shadow-soft:     0 18px 50px rgba(35, 31, 32, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--brand-hover); }

/* =================================================================
   Landing page (index.php)
   ================================================================= */

.landing {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 48px 24px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}

.landing__video-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  z-index: -3;
  pointer-events: none;
}

.landing::before {
  content: '';
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: -2;
}

.landing::after {
  content: none;
}

.landing__logo-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

.landing__logo {
  width: min(360px, 70vw);
  height: auto;
  display: block;
}

.landing__cta {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.landing__cta-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

/* =================================================================
   Auth pages (staff.php / client.php)
   ================================================================= */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 48px;
  position: relative;
  overflow: hidden;
}

/*
.auth::before {
  content: '';
  position: absolute;
  top: -300px;
  right: -200px;
  width: 700px;
  height: 700px;
  background: transparent;
  pointer-events: none;
  z-index: 0;
}
*/

.auth__top {
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  z-index: 1;
}

.auth__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 6px 0;
  font-family: inherit;
}
.auth__back:hover { color: var(--text); }
.auth__back svg { width: 14px; height: 14px; }

.auth__brand-mark { height: 22px; opacity: 0.85; }

.auth__card {
  width: 100%;
  max-width: 560px;
  z-index: 1;
}

.auth__eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 500;
  margin-bottom: 10px;
}

.auth__title {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.auth__subtitle {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 14px;
}

.auth__footer {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.auth__footer button {
  background: none;
  border: 0;
  font: inherit;
  color: var(--brand);
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.auth__footer button:hover { color: var(--brand-hover); }


/* =================================================================
   Theme toggle
   ================================================================= */

.auth__actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 82px;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--brand);
  color: var(--text);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.theme-toggle__track {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 34px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.theme-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  transition: transform .18s ease;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__thumb { transform: translateX(14px); }
.theme-toggle__light { display: none; }
.theme-toggle[aria-pressed="true"] .theme-toggle__dark { display: none; }
.theme-toggle[aria-pressed="true"] .theme-toggle__light { display: inline; }

:root[data-theme="light"] .auth::before { opacity: 0.75; }
:root[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator,
:root[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: none; opacity: 0.65; }
:root[data-theme="light"] select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23231f20' opacity='0.55' d='M6 8 0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
:root[data-theme="light"] .alert--error { color: #8f2525; }
:root[data-theme="light"] .alert--success { color: #176345; }



/* =================================================================
   Pending approval page
   ================================================================= */

.auth--approval .auth__card {
  margin-top: auto;
  margin-bottom: auto;
}

.approval-card {
  padding: 34px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.approval-card__icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--border);
}

.approval-card__icon svg {
  width: 28px;
  height: 28px;
}

.approval-card__copy {
  margin-bottom: 14px;
}

.approval-card__note {
  margin: 0 0 26px;
  color: var(--text-faint);
  font-size: 13px;
}

.approval-card__button {
  max-width: 240px;
  margin: 0 auto;
}

.approval-logo {
  max-width: 350px;
  text-align: center;
  margin: 0 auto 15px;
}

.approval-logo img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

/* =================================================================
   Form elements
   ================================================================= */

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

.form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form__grid .full { grid-column: 1 / -1; }

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

/* Ensure hidden form sections stay hidden even when they also use layout classes. */
[hidden] { display: none !important; }

.field__label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.field__label .hint {
  font-weight: 400;
  color: var(--text-faint);
  margin-left: 4px;
  font-size: 11px;
}

.field__error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 2px;
  min-height: 0;
  display: none;
}
.field.has-error .field__error { display: block; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  font-size: 14px;
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }

input:hover, select:hover, textarea:hover { background-color: var(--surface-hover); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  background-color: var(--surface-hover);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

textarea { resize: vertical; min-height: 90px; font-family: inherit; }

/* Date input — make calendar icon visible on dark bg in WebKit */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.5);
  cursor: pointer;
}

/* Select chevron */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23DCDBD9' opacity='0.6' d='M6 8 0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* Password input wrapper (for show/hide toggle) */
.password-input { position: relative; }
.password-input input { padding-right: 56px; }
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  font-family: inherit;
}
.password-toggle:hover { color: var(--text); }

/* Password strength meter */
.pw-strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.pw-strength__bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background .2s ease;
}
.pw-strength__bar.is-on { background: var(--brand); }
.pw-strength__label {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
}

/* Segmented control (Yes/No) */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: block;
  text-align: center;
  padding: 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: all .15s ease;
  user-select: none;
}
.segmented label:hover { background: var(--surface-hover); color: var(--text); }
.segmented input:checked + label {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--text);
}

/* Custom checkbox */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.checkbox input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox__box {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.checkbox__box svg {
  width: 10px;
  height: 10px;
  opacity: 0;
  transition: opacity .15s ease;
}
.checkbox input:checked + .checkbox__box {
  background: var(--brand);
  border-color: var(--brand);
}
.checkbox input:checked + .checkbox__box svg { opacity: 1; }
.checkbox input:focus-visible + .checkbox__box {
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* =================================================================
   Buttons
   ================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s ease;
  text-decoration: none;
  width: 100%;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #fff;
}
.btn--primary:active { transform: translateY(1px); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover {
  background: var(--surface);
  border-color: var(--text-faint);
  color: var(--text);
}

.btn--block-square { border-radius: var(--radius); }

.btn[disabled],
.btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Spinner inside button when loading */
.btn .spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Row helpers */
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* =================================================================
   Alerts (success/error banners on form responses)
   ================================================================= */

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid var(--border);
  margin-bottom: 4px;
  display: none;
}
.alert.is-shown { display: block; }
.alert--error {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: #f6c4c4;
}
.alert--success {
  background: rgba(90, 204, 160, 0.10);
  border-color: var(--success);
  color: #c1eed8;
}

/* =================================================================
   Form view toggle (sign-in <-> register)
   ================================================================= */

.view { display: none; animation: fadeIn .25s ease; }
.view.is-active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =================================================================
   Responsive
   ================================================================= */

@media (max-width: 600px) {
  .approval-card { padding: 26px 22px; }
  .landing { padding: 40px 20px; }
  .auth { padding: 24px 20px 40px; }

  .auth__title { font-size: 24px; }

  .form__grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .auth__top { margin-bottom: 24px; }
  .auth__actions { gap: 10px; }
  .theme-toggle { min-width: 74px; }
}

@media (max-width: 380px) {
  .landing__cta { max-width: 100%; }
  .auth__card { padding: 0; }
}

/* =================================================================
   Reduced motion
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Desktop auth layout: keep the top controls fixed, then center the form in the remaining space. */
@media (min-width: 1025px) {
  .auth__card {
    margin-top: auto;
    margin-bottom: auto;
  }
}
