/* B45: smv2 namespace */
/* B43: A2 Modal v2 — deployed S496-SI per CAJUN_PASS2_SI_*.md */

/* ============================================================
   A2: SI Modal v2 Styles — Tier-Aware with Calendly
   File: /server/public/css/si-modal-v2.css
   Includes: tier selector, conditional fields, Calendly container
   ============================================================ */

/* ---- Overlay ---- */
.smv2-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.smv2-overlay.active {
  display: block;
  opacity: 1;
}

/* ---- Modal Container ---- */
.smv2-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 92%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0f1724 0%, #1a2332 100%);
  border: 1px solid #2a3a4f;
  border-radius: 14px;
  z-index: 9999;
  display: none;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
  transition: transform 0.25s ease, opacity 0.2s ease;
  opacity: 0;
}
.smv2-modal.active {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---- Header ---- */
.smv2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #232d3f;
  flex-shrink: 0;
}
.smv2-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #e8edf3;
  letter-spacing: -0.2px;
}
.smv2-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #2a3a4f;
  background: #151f2e;
  color: #8b9db8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.smv2-close:hover {
  background: #1e2d3f;
  color: #e8edf3;
  border-color: #3a5a7f;
}

/* ---- Tier Selector ---- */
.smv2-tier-selector {
  display: flex;
  padding: 14px 18px 0;
  gap: 6px;
  flex-shrink: 0;
}
.smv2-tier-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1.5px solid #232d3f;
  background: #131d2a;
  color: #7a8fa8;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}
.smv2-tier-tab:hover {
  border-color: #3a5a7f;
  background: #182536;
  color: #a0b4cc;
}
.smv2-tier-tab.active {
  border-color: currentColor;
  background: rgba(255,255,255,0.04);
}
.smv2-tier-tab.smv2-tier-a { color: #a5d6ff; }
.smv2-tier-tab.smv2-tier-a.active { border-color: #58a6ff; background: rgba(88,166,255,0.08); }
.smv2-tier-tab.smv2-tier-b { color: #ffd700; }
.smv2-tier-tab.smv2-tier-b.active { border-color: #ffd700; background: rgba(255,215,0,0.06); }
.smv2-tier-tab.smv2-tier-c { color: #ff8c00; }
.smv2-tier-tab.smv2-tier-c.active { border-color: #ff8c00; background: rgba(255,140,0,0.06); }
.smv2-tier-tab .smv2-tier-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.smv2-tier-tab .smv2-tier-desc {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.75;
  text-align: center;
  line-height: 1.3;
}

/* ---- Form ---- */
.smv2-form {
  padding: 16px 22px 10px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.smv2-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.smv2-field label {
  font-size: 12px;
  font-weight: 600;
  color: #8b9db8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.smv2-field label .smv2-req {
  color: #f85149;
  margin-left: 2px;
}
.smv2-field input,
.smv2-field textarea,
.smv2-field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a3a4f;
  background: #0f1724;
  color: #e8edf3;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  width: 100%;
}
.smv2-field input:focus,
.smv2-field textarea:focus,
.smv2-field select:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88,166,255,0.12);
}
.smv2-field input::placeholder,
.smv2-field textarea::placeholder {
  color: #4a5a70;
}
.smv2-field textarea {
  resize: vertical;
  min-height: 64px;
}
.smv2-field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b9db8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.smv2-field select option {
  background: #1a2332;
  color: #e8edf3;
}

/* Field hint text */
.smv2-field-hint {
  font-size: 11px;
  color: #5a6f88;
  margin: 2px 0 0;
  line-height: 1.4;
}

/* ---- Tier conditional visibility ---- */
.smv2-tier-b-only,
.smv2-tier-c-only {
  display: none;
}

/* ---- Calendly ---- */
.smv2-calendly-separator {
  display: flex;
  align-items: center;
  padding: 0 22px;
  margin: 4px 0 10px;
  color: #5a6f88;
  font-size: 12px;
  gap: 10px;
}
.smv2-calendly-separator::before,
.smv2-calendly-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #232d3f;
}
.smv2-calendly-container {
  margin: 0 22px 16px;
  min-height: 620px;
  border: 1px solid #232d3f;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.smv2-calendly-fallback {
  padding: 30px 20px;
  text-align: center;
  color: #333;
  background: #f6f8fa;
}
.smv2-calendly-fallback p {
  margin-bottom: 16px;
  font-size: 14px;
  color: #555;
}

/* ---- Submit Button ---- */
.smv2-submit-btn {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #1f6feb 0%, #58a6ff 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  width: 100%;
  margin-top: 4px;
  font-family: inherit;
  letter-spacing: 0.2px;
}
.smv2-submit-btn:hover {
  background: linear-gradient(135deg, #388bfd 0%, #79b8ff 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(31,111,235,0.25);
}
.smv2-submit-btn:active {
  transform: translateY(0);
}
.smv2-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.smv2-submit-btn.smv2-btn-secondary {
  background: #1a2332;
  border: 1px solid #2a3a4f;
  color: #8b9db8;
}
.smv2-submit-btn.smv2-btn-secondary:hover {
  background: #232d3f;
  color: #e8edf3;
}

/* ---- Error Banner ---- */
.smv2-err-banner {
  margin: 12px 22px 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(248,81,73,0.1);
  border: 1px solid rgba(248,81,73,0.25);
  color: #f85149;
  font-size: 13px;
  font-weight: 500;
}

/* ---- Loading Overlay ---- */
.smv2-loading {
  position: absolute;
  inset: 0;
  background: rgba(15,23,36,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
  border-radius: 14px;
}
.smv2-loading.active {
  display: flex;
}
.smv2-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #232d3f;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: siSpin 0.8s linear infinite;
}
@keyframes siSpin {
  to { transform: rotate(360deg); }
}
.smv2-loading span {
  color: #8b9db8;
  font-size: 13px;
}

/* ---- Success States ---- */
.smv2-success {
  padding: 36px 22px;
  text-align: center;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.smv2-success.active {
  display: flex;
}
.smv2-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
}
#siSuccessA .smv2-success-icon { background: rgba(88,166,255,0.12); color: #58a6ff; }
#siSuccessB .smv2-success-icon { background: rgba(255,215,0,0.12); color: #ffd700; }
#siSuccessC .smv2-success-icon { background: rgba(255,140,0,0.12); color: #ff8c00; }
.smv2-success h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #e8edf3;
}
.smv2-success p {
  margin: 0;
  color: #8b9db8;
  font-size: 14px;
  line-height: 1.55;
  max-width: 380px;
}

/* ---- Footer ---- */
.smv2-footer {
  padding: 14px 22px 18px;
  border-top: 1px solid #232d3f;
  text-align: center;
  flex-shrink: 0;
}
.smv2-footer p {
  margin: 3px 0;
  font-size: 11px;
  color: #5a6f88;
}
.smv2-footer a {
  color: #58a6ff;
  text-decoration: none;
}
.smv2-footer a:hover {
  text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .smv2-modal {
    width: 96%;
    max-height: 94vh;
    border-radius: 12px;
  }
  .smv2-header { padding: 14px 16px 10px; }
  .smv2-header h2 { font-size: 16px; }
  .smv2-tier-selector { padding: 10px 12px 0; gap: 4px; }
  .smv2-tier-tab { padding: 8px 4px; }
  .smv2-tier-tab .smv2-tier-name { font-size: 11px; }
  .smv2-tier-tab .smv2-tier-desc { font-size: 9px; }
  .smv2-form { padding: 12px 14px 8px; gap: 11px; }
  .smv2-calendly-container { margin: 0 14px 12px; min-height: 520px; }
  .smv2-calendly-separator { padding: 0 14px; }
  .smv2-err-banner { margin: 10px 14px 0; }
  .smv2-success { padding: 28px 14px; }
}

@media (max-width: 380px) {
  .smv2-tier-tab .smv2-tier-desc { display: none; }
  .smv2-tier-tab { padding: 10px 4px; }
}

/* Print styles */
@media print {
  .smv2-overlay, .smv2-modal { display: none !important; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .smv2-overlay,
  .smv2-modal,
  .smv2-tier-tab,
  .smv2-submit-btn,
  .smv2-field input,
  .smv2-field textarea {
    transition: none !important;
  }
  .smv2-spinner { animation: none; border-top-color: #58a6ff; }
}
