/* =========================================================
   Linkthera — style.css
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

:root{
  --text:#eaf2ff;
  --muted:#b9c7e4;
  --card: rgba(10,18,36,.66);
  --border: rgba(255,255,255,.08);
  --brand-1:#5b6cff;
  --brand-3:#38a3ff;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --bg-size: cover;
  --bg-zoom: 1;
  --bg-x: 50%;
  --bg-y: 50%;
  --logo-badge-bg: rgba(255,255,255,.92);
  --logo-badge-border: rgba(255,255,255,.70);
}

html, body { height: 100%; }
body{
  margin:0; color:var(--text);
  font-family: Inter, ui-sans-serif, system-ui, Segoe UI, Roboto, Arial, sans-serif;
  line-height:1.6; background:#0a1224;
}

/* Background */
body::before{
  content:""; position:fixed; inset:0; z-index:-2;
  background:url('../assets/websitebackground.png') var(--bg-x) var(--bg-y) / var(--bg-size) no-repeat fixed;
  transform:scale(var(--bg-zoom)); transform-origin:center;
}
body::after{
  content:""; position:fixed; inset:0; z-index:-1;
  background:
    radial-gradient(1000px 600px at 50% -10%, rgba(91,108,255,.24), transparent 60%),
    linear-gradient(180deg, rgba(8,15,30,.75), rgba(8,15,30,.85) 22%, rgba(8,15,30,.92));
}

/* Header */
.site-header{ position:sticky; top:0; z-index:10; backdrop-filter:saturate(1.2) blur(10px); }
.nav{ max-width:1160px; margin-inline:auto; display:flex; align-items:center; gap:18px; padding:12px 16px; }
.brand{ display:flex; align-items:center; gap:12px; color:inherit; text-decoration:none }
.brand-badge{
  width:44px; height:44px; border-radius:12px; display:grid; place-items:center; flex-shrink:0;
  background:var(--logo-badge-bg); border:1px solid var(--logo-badge-border);
  box-shadow:0 6px 18px rgba(0,0,0,.25)
}
.brand-logo{ width:32px; height:32px; object-fit:contain; filter:drop-shadow(0 1px 2px rgba(0,0,0,.35)) }
.brand-text{ display:flex; flex-direction:column }
.brand-text strong{ font-weight:800 }
.brand-text span{ color:var(--muted); font-size:12px; margin-top:-2px }

.links{ margin-left:auto; display:flex; align-items:center; gap:12px; flex-wrap:wrap }
.links a{ color:#cfe0ff; text-decoration:none; opacity:.92 }
.links a:hover{ opacity:1 }

/* Buttons & badge */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:12px 16px; border-radius:14px; border:1px solid var(--border);
  color:var(--text); background:rgba(10,18,36,.5); cursor:pointer;
  transition:filter .15s ease, transform .08s ease, box-shadow .15s ease;
}
.btn:hover{ filter:brightness(1.08) }
.btn:active{ transform:translateY(1px) }
.btn.primary{
  background:linear-gradient(135deg,var(--brand-1),var(--brand-3));
  border:0; color:#fff; box-shadow:0 18px 40px rgba(56,163,255,.35);
}
.btn.ghost{ background:transparent }
.btn.small{ padding:8px 12px; border-radius:12px; font-size:14px }
.badge{
  display:inline-grid; place-items:center; margin-left:8px;
  width:18px; height:18px; border-radius:999px; font-size:12px; font-weight:800;
  background:#ff6b6b; color:#fff; box-shadow:0 0 10px rgba(255,107,107,.6);
}

/* HERO */
.hero{ min-height:76vh; display:grid; place-items:center; text-align:center; padding:56px 16px 40px; }
.hero-inner{ max-width:1160px; margin-inline:auto; width:100% }
.hero-lockup{ display:flex; align-items:center; justify-content:center; gap: clamp(14px, 3vw, 28px); flex-wrap:wrap; margin:8px auto 10px; }
.hero-logo-big{ width: clamp(140px, 20vw, 240px); height:auto; display:block; filter: drop-shadow(0 12px 30px rgba(0,0,0,.35)) }
.hero-title{ font-weight:900; letter-spacing:.6px; font-size: clamp(34px, 6.8vw, 72px); margin:0; line-height:1.05; }
.hero-sub{ font-size: clamp(16px, 1.2vw + 12px, 22px); margin:12px 0 14px; color:#e7efff }
.hero-ctas{ display:flex; gap:12px; justify-content:center; flex-wrap:wrap; margin:10px 0 6px }
.hero-bullets{ display:flex; gap:16px; flex-wrap:wrap; justify-content:center; list-style:none; padding:0; margin:10px 0 0; color:#e7efff; font-weight:600 }

/* Sections & footer */
.section{ padding: 0 0 80px }
.container{ max-width:1160px; width:100%; margin-inline:auto; padding-inline:16px }
.card{ background:var(--card); border:1px solid var(--border); border-radius:20px; padding:22px; box-shadow:var(--shadow); }
.footer{ padding:40px 0 28px; opacity:.9; text-align:center }
.muted{ color:var(--muted) }
.small{ font-size:12px }
.eyebrow{ text-transform:uppercase; letter-spacing:.14em; font-size:12px; color:var(--muted); }

/* === Auth gates === */
body[data-auth="in"]  .signed-out-only { display: none !important; }
body[data-auth="out"] .signed-in-only  { display: none !important; }
body[data-auth="in"] #how-it-works,
body[data-auth="in"] .how-it-works { display: none !important; }

/* Toasts */
#toastBox{ position:fixed; right:16px; bottom:16px; display:flex; flex-direction:column; gap:8px; z-index:9990 }
.toast{ transform:translateY(8px); opacity:0; background:rgba(20,32,60,.96); color:#eaf2ff;
  border:1px solid rgba(255,255,255,.16); border-radius:12px; padding:10px 12px; box-shadow:0 14px 40px rgba(0,0,0,.4);
  transition: all .25s ease; }
.toast.show{ transform:none; opacity:1 }

/* =========================================================
   How it works — modern stepper card
   ========================================================= */
.how-card{
  position:relative;
  padding:26px;
  background:
    radial-gradient(600px 300px at 20% -30%, rgba(91,108,255,.20), transparent 60%),
    radial-gradient(700px 400px at 120% 20%, rgba(56,163,255,.20), transparent 65%),
    var(--card);
  border:1px solid var(--border);
  border-radius:20px;
  box-shadow:var(--shadow);
}
.how-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:16px; }
.how-title{ margin:4px 0 0; font-size:26px }
.how-cta{ display:flex; gap:8px; flex-wrap:wrap }

.how-grid{ display:grid; gap:16px; grid-template-columns:repeat(3, minmax(0,1fr)); }
@media (max-width: 980px){ .how-grid{ grid-template-columns:1fr; } }

.how-step{
  position:relative; padding:18px; border-radius:16px;
  background:rgba(255,255,255,.03); border:1px solid var(--border);
  transition:transform .12s ease, box-shadow .2s ease, border-color .2s ease;
  display:flex; flex-direction:column; gap:8px; text-align:left;
}
.how-step:hover{ transform:translateY(-2px); border-color:rgba(91,108,255,.35); box-shadow:0 18px 40px rgba(0,0,0,.35); }
.step-badge{
  position:absolute; inset:auto 12px 12px auto;
  width:26px; height:26px; border-radius:999px; display:grid; place-items:center;
  background:linear-gradient(135deg,var(--brand-1),var(--brand-3)); color:#fff; font-weight:800; font-size:12px;
  box-shadow:0 8px 20px rgba(56,163,255,.35);
}
.step-icon{
  width:34px; height:34px; border-radius:10px; display:grid; place-items:center;
  background:rgba(255,255,255,.06); border:1px solid var(--border); font-size:18px;
}
.how-step h3{ margin:2px 0 2px; font-size:18px }
.how-step p{ margin:0; color:var(--muted) }
.step-actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:6px }

/* =========================================================
   Chat single-box layout
   ========================================================= */
.chat-shell{
  display:flex; flex-direction:column; gap:0; padding:0;
  max-width: 960px;
  min-height: 58vh;
  margin:0 auto;
}
.chat-bar{
  display:flex; align-items:center; gap:10px; padding:10px 12px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  border-top-left-radius:inherit; border-top-right-radius:inherit;
}
#toggleSideBtn{ display:none; }
.chat-shell > .chat-body{
  display:grid !important;
  grid-template-columns: 300px minmax(0,1fr) !important;
  align-items: stretch;
  min-height:0;
}
.chat-side{
  width:300px;
  border-right:1px solid var(--border);
  padding:12px;
  display:flex; flex-direction:column; min-height:0;
}
.side-head{ display:flex; flex-direction:column; gap:6px; margin-bottom:8px }
.side-actions{ display:flex; gap:8px }
#roomsList{ flex:1; min-height:0; display:flex; flex-direction:column; gap:8px; overflow:auto }
.room{
  text-align:left; border:1px solid var(--border); background:rgba(255,255,255,.03);
  padding:10px 12px; border-radius:12px; cursor:pointer; transition:filter .15s ease, transform .08s ease;
}
.room:hover{ filter:brightness(1.05) }
.room.active{ outline:2px solid rgba(56,163,255,.6) }
.room-title{ font-weight:700 }
.room-sub{ color:var(--muted); font-size:12px; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.chat-main{ display:flex; flex-direction:column; padding:12px; min-height:0 }
.main-head{ padding:0 2px 8px 2px }
.chat-title{ margin:0; font-size:18px }
.messages{
  flex:1; min-height: 220px;
  overflow:auto; display:flex; flex-direction:column; gap:10px;
  padding:10px; border:1px solid var(--border); border-radius:14px;
  background:rgba(255,255,255,.03);
}
.messages.empty-state{ display:flex; align-items:center; justify-content:center }
.msg{ display:flex; }
.msg.me{ justify-content:flex-end }
.msg .bubble{
  max-width:min(560px, 90%); padding:10px 12px; border-radius:14px;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.12);
  box-shadow:0 6px 20px rgba(0,0,0,.25);
}
.msg.me .bubble{
  background:linear-gradient(135deg,var(--brand-1),var(--brand-3)); border:0; color:#fff;
}
.msg .text{ white-space:pre-wrap; word-break:break-word; }
.msg .meta{ opacity:.8; font-size:12px; margin-top:6px }
.composer{ display:flex; gap:10px; margin-top:10px; border-top:1px solid var(--border); padding-top:10px }
.composer input{
  flex:1; height:46px; border-radius:12px; border:1px solid rgba(255,255,255,.18);
  background:rgba(20, 32, 60, .96); color:var(--text); padding:0 12px; outline:none;
}
.composer input[disabled]{ opacity:.6 }
.composer input::placeholder{ color:#9bb0d1; opacity:.95 }
@media (max-width: 980px){
  #toggleSideBtn{ display:inline-flex; }
  .chat-shell > .chat-body{ grid-template-columns: 1fr !important; }
  .chat-side{ display:none; }
  .chat-shell.side-open .chat-side{ display:flex; }
}

/* =========================================================
   Modal (Auth/Notifications/Account) — VISIBILITY BOOST
   ========================================================= */
.modal{
  border:0; padding:0; background:none;
  width:min(720px, calc(100% - 32px));
  z-index: 9999;
  color:#f3f7ff;
  isolation:isolate;
}
.modal::backdrop{
  background:rgba(6,10,20,.82);
  backdrop-filter: blur(6px) saturate(110%);
}
.modal-card{
  position:relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.00)),
    rgba(16,26,46,.98);
  border:1px solid rgba(255,255,255,.18);
  border-radius:16px; padding:20px 18px;
  box-shadow:0 30px 80px rgba(0,0,0,.65);
  opacity:1 !important;
}
.modal-x{
  position:absolute; right:12px; top:12px; width:34px; height:34px;
  display:grid; place-items:center; border-radius:10px; border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.06); color:#ffffff; cursor:pointer;
}
.modal-x:hover{ filter:brightness(1.08) }
.modal-card h3, .modal-card h4, .modal-card label { color:#ffffff; }
.modal-card .muted, .modal-card small, .modal-card p.muted { color:#cdd9f6; }
.modal-card input{
  width:100%; height:46px; border-radius:12px; border:1px solid rgba(255,255,255,.22);
  background:rgba(20,32,60,.98); color:#eef4ff; padding:0 12px; outline:none;
}
.modal-card input::placeholder{ color:#aab8dd; }
.modal-card input:focus{ border-color:#6ca9ff; box-shadow:0 0 0 3px rgba(108,169,255,.28); }
.seg{ display:flex; gap:6px; background:rgba(255,255,255,.07); padding:4px; border-radius:10px; width:max-content }
.seg-btn{ padding:8px 12px; border-radius:8px; border:1px solid transparent; color:#eaf2ff; background:transparent; cursor:pointer; }
.seg-btn.active{ background:rgba(255,255,255,.12); border-color:rgba(255,255,255,.18) }
.modal-card .row{ display:flex; gap:8px; margin-top:12px; flex-wrap:wrap }
.grid2{ display:grid; gap:12px; grid-template-columns:1fr; }
@media (min-width: 760px){ .grid2{ grid-template-columns:1fr 1fr; } }
.reqList{ display:flex; flex-direction:column; gap:8px }
.reqList .cardish{ background:rgba(255,255,255,.05); border:1px solid var(--border); border-radius:12px; padding:10px 12px; }

/* =========================================================
   DESIGN MODE
   ========================================================= */
.dm-panel{
  position:fixed; right:12px; bottom:12px; z-index:9999;
  display:flex; gap:8px; align-items:center;
  background:rgba(12,20,36,.92); border:1px solid rgba(255,255,255,.14);
  padding:8px 10px; border-radius:12px; box-shadow:var(--shadow);
}
.dm-panel .btn{ padding:6px 10px; border-radius:10px; font-size:13px }
.dm-wrap{
  position:fixed; z-index:9998;
  border:1px dashed rgba(255,255,255,.35);
  border-radius:14px; box-shadow:none;
  background:transparent;
  padding:0; margin:0;
  overflow:visible;
  cursor: move; user-select:none;
}
.dm-wrap .dm-grab{
  position:absolute; left:6px; top:6px;
  background:rgba(56,163,255,.8); color:#fff; font-size:11px;
  padding:2px 6px; border-radius:999px;
}
.dm-wrap .dm-handle{
  position:absolute; right:-6px; bottom:-6px;
  width:14px; height:14px; border-radius:3px;
  background:rgba(56,163,255,.9); cursor:nwse-resize;
  box-shadow:0 0 0 2px rgba(12,20,36,.9);
}
.dm-active { outline:2px solid rgba(56,163,255,.6); }
.dm-wrap.inner { position:absolute; }
.dm-scope { position:relative !important; }
.dm-wrap.dm-live{ border:0; pointer-events:none; }
.dm-wrap.dm-live .dm-grab,
.dm-wrap.dm-live .dm-handle{ display:none; }
.dm-wrap.dm-live > *{ pointer-events:auto; }
#chatCard.dm2-custom .chat-body { display:block; position:relative; }

/* =========================================================
   NEW: App grid + Calendar styling
   ========================================================= */
.app-grid{ display:grid; gap:16px; }
@media (min-width:1024px){ .app-grid{ grid-template-columns:1fr 1fr; } }

.calendar-shell{ min-height:640px; display:flex; flex-direction:column; gap:10px; }
.cal-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.cal-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

#calendar{
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  border-radius:14px; padding:10px;
}

/* FullCalendar theme tokens (dark) */
.fc{
  --fc-border-color: rgba(255,255,255,.14);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: rgba(255,255,255,.04);
  --fc-list-event-hover-bg-color: rgba(255,255,255,.06);
  --fc-today-bg-color: rgba(91,108,255,.18);
  --fc-event-bg-color: #5b6cff;
  --fc-event-border-color: #5b6cff;
  --fc-event-text-color: #fff;
  color: var(--text);
}
.fc .fc-toolbar-title{ font-size:18px; }
.fc .fc-button{ border-radius:10px; }
