/* Casper Remote Support Portal — portal.css */

:root {
  --bg:        #0d1117;
  --card:      #161b22;
  --border:    #30363d;
  --accent:    #2563eb;
  --accent-h:  #1d4ed8;
  --green:     #22c55e;
  --text:      #e6edf3;
  --text-muted:#8b949e;
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:    12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.portal-wrap {
  width: 100%;
  max-width: 680px;
  padding: 0 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Header ── */
.portal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0 0;
}
.logo { height: 36px; }
.header-text { display: flex; flex-direction: column; flex: 1; }
.brand { font-size: 1.1rem; font-weight: 700; letter-spacing: -.02em; }
.tagline { font-size: .75rem; color: var(--text-muted); }
.powered-by { font-size: .7rem; color: var(--text-muted); white-space: nowrap; }
.powered-by strong { color: var(--accent); }

/* ── Progress bar ── */
.progress-bar { padding: .5rem 0; }
.progress-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: .7rem;
  color: var(--text-muted);
  transition: color .3s;
}
.progress-step.active, .progress-step.done { color: var(--accent); }
.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background .3s;
}
.progress-step.active .step-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.25); }
.progress-step.done .step-dot { background: var(--green); }
.progress-line { flex: 1; height: 2px; background: var(--border); margin: 0 4px; margin-bottom: 14px; }

/* ── Main card ── */
.portal-main {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  min-height: 360px;
}

/* ── Steps ── */
.step { display: none; }
.step.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; }
.step-sub { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; line-height: 1.5; }

/* ── Form ── */
.info-form { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; font-weight: 500; }
input, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: .95rem;
  padding: .65rem .9rem;
  outline: none;
  transition: border-color .2s;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }
.optional { color: var(--text-muted); font-weight: 400; font-size: .8rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.4rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, transform .1s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #3a404a; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: #555; }
.btn-mic {
  background: rgba(37,99,235,.12);
  border: 2px solid var(--accent);
  color: var(--text);
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 1rem;
}
.btn-mic.recording { background: rgba(239,68,68,.12); border-color: #ef4444; animation: pulse-btn .8s ease infinite; }
.btn-mic:hover { background: rgba(37,99,235,.2); }
.btn-download {
  background: var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .85rem;
  gap: .4rem;
}
.btn-download:hover { background: #3a404a; }
.btn-download-primary { background: #2563eb !important; color: #fff !important; font-size: 1rem !important; padding: .65rem 1.4rem !important; }  
.btn-download-primary:hover { background: #1d4ed8 !important; }
.btn-arrow { width: 18px; height: 18px; }

@keyframes pulse-btn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* ── Mic test ── */
.mic-test-area { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin: 1.5rem 0; }
.waveform { background: rgba(37,99,235,.07); border-radius: 8px; border: 1px solid var(--border); }
.mic-status { font-size: .9rem; color: var(--text-muted); min-height: 1.2rem; text-align: center; }
.mic-status.ok  { color: var(--green); }
.mic-status.err { color: #ef4444; }
.mic-actions { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.sms-form { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.sms-fallback { text-align: center; padding: 1rem; background: rgba(37,99,235,.05); border-radius: 8px; border: 1px solid var(--border); }
.sms-fallback p { font-size: .9rem; color: var(--text-muted); margin-bottom: .75rem; }

/* ── Avatar ── */
.avatar-stage {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 1.25rem;
}
.avatar-video, .avatar-photo {
  width: 200px; height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  position: relative;
  z-index: 2;
}
.avatar-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(37,99,235,.3);
  animation: spin-ring 8s linear infinite;
}
.avatar-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  animation: pulse-ring 2s ease infinite;
}
@keyframes spin-ring { to { transform: rotate(360deg); } }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,.4); }
  70%  { box-shadow: 0 0 0 12px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}

.tech-intro { text-align: center; margin-bottom: .75rem; }
.tech-name { font-size: 1.2rem; font-weight: 700; }
.tech-title { font-size: .85rem; color: var(--text-muted); }

.speech-bubble {
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.25);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  min-height: 60px;
  font-size: .95rem;
  line-height: 1.6;
  color: var(--text);
}
.speech-bubble p { white-space: pre-wrap; }

/* ── Step 4 layout ── */
.step4-layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.avatar-small-wrap { position: relative; flex-shrink: 0; width: 80px; }
.avatar-video-small, .avatar-photo-small {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}
.tech-badge {
  display: flex; align-items: center; gap: .3rem;
  font-size: .7rem; color: var(--text-muted);
  margin-top: .3rem; justify-content: center;
}
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse-dot 2s ease infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }

.rustdesk-instructions { flex: 1; }

.download-section { margin: 1rem 0; }
.download-label { font-size: .8rem; color: var(--text-muted); margin-bottom: .5rem; }
.download-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }

.rustdesk-steps { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.25rem; }
.rd-step { display: flex; align-items: flex-start; gap: .75rem; }
.rd-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0; margin-top: 1px;
}
.rd-step p { font-size: .9rem; line-height: 1.5; }

.device-id-input { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.device-id-input input { flex: 1; min-width: 140px; letter-spacing: .1em; font-size: 1.1rem; }

.connecting-status {
  display: flex; align-items: center; gap: .75rem;
  background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.25);
  border-radius: 8px; padding: .75rem 1rem; margin-top: 1rem;
  font-size: .9rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Step 5: connected ── */
.connected-wrap { text-align: center; padding: 2rem 0; }
.check-circle { width: 80px; height: 80px; margin: 0 auto 1.25rem; }
.connected-tip { color: var(--text-muted); font-size: .85rem; margin-top: .5rem; }

/* ── Footer ── */
.portal-footer {
  display: flex; align-items: center; justify-content: center;
  gap: .75rem; font-size: .8rem; color: var(--text-muted);
  padding-bottom: .5rem;
}
.portal-footer a { color: var(--accent); text-decoration: none; }
.portal-footer a:hover { text-decoration: underline; }
.sep { opacity: .4; }
.security-note { display: flex; align-items: center; gap: .3rem; }

/* ── Utilities ── */
.hidden { display: none !important; }

@media (max-width: 480px) {
  .portal-main { padding: 1.25rem; }
  .step4-layout { flex-direction: column; }
  .avatar-small-wrap { display: flex; align-items: center; gap: 1rem; width: 100%; }
  .avatar-video-small, .avatar-photo-small { width: 60px; height: 60px; }
}

/* ── Service Tier Selection ── */
.tier-select { display:flex; gap:1rem; margin-bottom:1.5rem; }
.tier-card { flex:1; border:2px solid var(--border); border-radius:12px; padding:1rem; cursor:pointer; position:relative; transition:border-color .2s,background .2s; }
.tier-card input[type=radio] { display:none; }
.tier-card:hover { border-color:#3b82f6; }
.tier-selected { border-color:#2563eb !important; background:rgba(37,99,235,.08); }
.tier-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:.75rem; }
.tier-name { font-weight:700; font-size:1rem; color:var(--text); }
.tier-price { font-weight:800; font-size:1.3rem; color:#2563eb; }
.tier-features { list-style:none; padding:0; margin:0; font-size:.85rem; color:#94a3b8; display:flex; flex-direction:column; gap:.3rem; }
.tier-features li { color:#cbd5e1; }
.tier-badge { position:absolute; top:-10px; right:12px; background:#2563eb; color:#fff; font-size:.7rem; font-weight:700; padding:.2rem .6rem; border-radius:20px; text-transform:uppercase; }
@media(max-width:500px){ .tier-select { flex-direction:column; } }

/* ── File upload ───────────────────────────────────────────────────────────── */
.upload-drop {
  border: 2px dashed #334155;
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-top: .35rem;
  min-height: 80px;
}
.upload-drop:hover, .upload-drop.drag-over {
  border-color: #2563eb;
  background: rgba(37,99,235,.05);
}
.upload-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  color: #64748b;
  font-size: .88rem;
  pointer-events: none;
}
.upload-drop-inner u { color: #3b82f6; }
.upload-file-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.upload-file-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  padding: .3rem .6rem;
  font-size: .82rem;
  color: #cbd5e1;
}
.upload-file-item .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-item .fsize { color: #64748b; flex-shrink: 0; }
.upload-file-item .fremove { color: #ef4444; cursor: pointer; flex-shrink: 0; font-size: 1rem; line-height: 1; }
.upload-progress { height: 3px; background: #2563eb; border-radius: 2px; margin-top: .3rem; transition: width .3s; }
