/* ============================================================
   css/portal.base.css
   Net Studio — Customer Portal (BASE)
   - Universal layout + components
   - NO theme baked in (themes override :root vars)
   - Uses native page scrolling (no inner scroll containers)
   ============================================================ */

/* ---------- BASE TOKENS (theme overrides these) ---------- */
:root{
  --bg0:#050507;
  --bg-gradient: radial-gradient(circle at top, #1b1b22 0%, #050507 60%, #000 100%);

  --card-bg: rgba(15, 15, 18, 0.85);
  --glass: rgba(255,255,255,0.05);

  --text-main:#ffffff;
  --text-muted: rgba(255,255,255,0.65);

  --accent:#ef4444;
  --error:#ef4444;
  --success:#10b981;

  --input-bg: rgba(0,0,0,0.40);
  --border-color: rgba(255,255,255,0.12);

  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;

  --shadow: 0 25px 50px -12px rgba(0,0,0,0.70);

  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---------- RESETS ---------- */
*{ box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
html{ background:#000; }
body{
  width:100%;
  min-height:100dvh;
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-body);

  display:flex;
  justify-content:center;
  align-items:flex-start;

  /* Native page scroll */
  padding:
    clamp(16px, 3vw, 28px)
    clamp(12px, 2.5vw, 28px)
    clamp(24px, 3vw, 32px);

  transition: background .3s ease;
}

/* Dashboard mode: still native scrolling */
body.mode-dashboard{
  background: var(--bg0);
  padding-top: 0;
}

/* ---------- LAYOUT ---------- */
.nsd-container{
  width:100%;
  max-width:1080px;
  margin:0 auto;
  position:relative;
}

.nsd-portal-card{
  width:100%;
  border-radius: var(--radius-xl);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  /* IMPORTANT: native page scrolling only */
  max-height: none;
  overflow: visible;

  padding: 0 24px 30px 24px;
  min-height: 420px;
  transition: all .35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* In dashboard mode we remove the big card shell */
body.mode-dashboard .nsd-portal-card{
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  padding: 0;
  min-height: auto;
}

/* Header: MUST be relative (no sticky/fixed) */
.nsd-sticky-header{
  position: relative;
  z-index: 1;
  margin: 0 -24px 24px -24px;
  padding: 24px 24px 16px 24px;
  background: rgba(15, 15, 18, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.nsd-back-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color: var(--text-muted);
  text-decoration:none;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing: .10em;
  font-weight:600;
  margin-bottom:16px;
  transition: color .2s ease;
}
.nsd-back-link:hover{ color:#fff; }
.nsd-back-link svg{ width:14px; height:14px; }

h1{
  font-size:18px;
  text-transform:uppercase;
  letter-spacing:.20em;
  text-align:center;
  margin:0 0 6px 0;
  font-weight:700;
  font-style: italic;
}
.sub{
  text-align:center;
  font-size:13px;
  opacity:.65;
  margin:0;
}

.nsd-powered{
  text-align:center;
  font-size:11px;
  opacity: .30;
  margin-top: 20px;
  letter-spacing: .05em;
}

/* ---------- LOADING OVERLAY ---------- */
#nsdLoadingOverlay{
  position: fixed;
  inset: 0;
  background: rgba(5,5,7,0.90);
  z-index: 9999;
  display:flex;
  align-items:center;
  justify-content:center;
  backdrop-filter: blur(4px);
  transition: opacity .25s ease;

  opacity:0;
  pointer-events:none;
}
.nsd-spinner{
  width:28px;
  height:28px;
  border: 3px solid rgba(255,255,255,0.10);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ns_spin .8s ease-in-out infinite;
}
@keyframes ns_spin{ to { transform: rotate(360deg); } }

/* ---------- TABS ---------- */
.nsd-tab-nav{
  display:flex;
  margin-bottom:24px;
  border-radius:14px;
  background: rgba(255,255,255,0.03);
  padding:4px;
  border: 1px solid var(--border-color);
}
.nsd-tab-nav button{
  flex:1;
  padding:10px;
  border:none;
  border-radius: 11px;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size:13px;
  font-weight:500;
  cursor:pointer;
  transition: all .2s ease;
}
.nsd-tab-nav button.active{
  background: var(--accent);
  color: #fff;
  font-weight:600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* ---------- FORMS ---------- */
.nsd-auth-content form{ display:none; }
.nsd-auth-content form.active{ display:block; animation: ns_fade .25s ease; }

label{
  display:block;
  font-size:11px;
  text-transform:uppercase;
  opacity:.65;
  margin-top:16px;
  margin-bottom:6px;
  letter-spacing:.05em;
  font-weight:600;
}

input:not([type="checkbox"]),
select{
  width:100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--input-bg);
  color:#fff;
  font-size:15px;
  outline:none;
  transition: border-color .2s ease, transform .08s ease;
  -webkit-appearance:none;
  appearance:none;
}
input:focus, select:focus{ border-color: var(--accent); }

select{
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat:no-repeat;
  background-position:right 14px center;
  background-size:16px;
  padding-right:40px;
}

.btn-submit{
  width:100%;
  margin-top:24px;
  padding:14px;
  border-radius: var(--radius-md);
  border:none;
  background: var(--accent);
  color:#fff;
  font-weight:700;
  font-size:13px;
  letter-spacing:.05em;
  text-transform:uppercase;
  cursor:pointer;
  transition: opacity .2s ease, filter .2s ease, transform .08s ease;
}
.btn-submit:disabled{ opacity:.6; cursor:not-allowed; }
.btn-submit:hover:not(:disabled){ filter: brightness(1.08); }
.btn-submit:active:not(:disabled){ transform: scale(.99); }

.nsd-status-auth{
  margin-top:16px;
  font-size:13px;
  min-height:20px;
  text-align:center;
  line-height:1.4;
  color: var(--error);
  padding: 0 10px;
}
.nsd-status-auth.success{ color: var(--success); }

.success-view{ display:none; text-align:center; padding: 20px 0; }

input[type="checkbox"]{
  width:20px;
  height:20px;
  accent-color: var(--accent);
  cursor:pointer;
  margin-right:10px;
}

/* ---------- APPOINTMENT CARDS ---------- */
.nsd-appt-card{
  background: rgba(255,255,255,0.05);
  padding:18px;
  border-radius: var(--radius-lg);
  margin-bottom:12px;
  border: 1px solid rgba(255,255,255,0.08);
}

.status{
  display:inline-block;
  padding:3px 8px;
  border-radius:6px;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  margin-right:8px;
}
.status.pending{ background: rgba(252,211,77,0.20); color:#fbbf24; }
.status.confirmed{ background: rgba(52,211,153,0.20); color:#34d399; }
.status.cancelled, .status.canceled, .status.cancelled{ background: rgba(239,68,68,0.20); color: var(--error); }

.btn-tertiary{
  padding:8px 16px;
  border-radius:99px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.75);
  font-size:11px;
  text-transform:uppercase;
  cursor:pointer;
  transition: all .2s ease;
}
.btn-tertiary:hover{ border-color:#fff; color:#fff; }

.btn-action-cancel{
  border-color: rgba(239,68,68,0.50);
  color: rgba(239,68,68,0.90);
}
.btn-action-cancel:hover{
  border-color: var(--error);
  color: var(--error);
  background: rgba(239,68,68,0.10);
}

/* Booking engine slots (portal-engine creates .ns-slot) */
.ns-slot{
  border: 1px solid rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.03);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform .08s ease, filter .2s ease, background .2s ease, border-color .2s ease;
}
.ns-slot:hover{ filter: brightness(1.05); }
.ns-slot:active{ transform: scale(.99); }
.ns-slot.is-selected{
  background: var(--accent);
  border-color: rgba(255,255,255,0.0);
  color:#fff;
}

/* Minor animation helpers */
@keyframes ns_fade{ from{opacity:0} to{opacity:1} }
.shake{ animation: ns_shake .5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes ns_shake{
  10%,90%{transform:translate3d(-1px,0,0)}
  20%,80%{transform:translate3d(2px,0,0)}
  30%,50%,70%{transform:translate3d(-4px,0,0)}
  40%,60%{transform:translate3d(4px,0,0)}
}

/* ---------- RESPONSIVE ---------- */
@media (min-width: 860px){
  .nsd-portal-card{ padding: 0 32px 36px 32px; }
  .nsd-sticky-header{ margin: 0 -32px 30px -32px; padding: 24px 32px 16px 32px; }

  #nsdAuthView .nsd-auth-content{ max-width: 520px; margin: 0 auto; }

  /* 2-column dashboard */
  #nsdAppointmentsView{
    display:grid !important;
    grid-template-columns: 360px 1fr;
    gap:24px;
    align-items:start;
  }
  #nsdAppointmentsView[style*="none"]{ display:none !important; }

  /* Left column prefs */
  #nsdPrefsCard{
    position: sticky;
    top: 16px;
  }

  #nsdAppointmentsList, #nsdNoAppts{ grid-column:2; }
  #nsdBookingsHeader{ grid-column:2; }
  #nsdSignOutFooter{ grid-column: 1 / -1; }
}

@media (min-width: 620px) and (max-width: 859px){
  .nsd-container{ max-width: 720px; }
  .nsd-portal-card{ padding: 0 28px 34px 28px; }
  .nsd-sticky-header{ margin: 0 -28px 26px -28px; padding: 24px 28px 16px 28px; }
  #nsdAuthView .nsd-auth-content{ max-width: 480px; margin: 0 auto; }
}