.rvsc-wrapper {
  --gap: 12px;
  --radius: 14px;
  font-family: inherit;
  max-width: 100%;
}

/* Main layout - horizontal split */
.rvsc-main-layout {
  display: grid;
  grid-template-columns: minmax(585px, 1fr) minmax(250px, 400px);
    gap: 10px;
  align-items: start;
}

/* Results container - houses both gate and results */
.rvsc-results-container {
  position: relative;
  min-height: 600px;
}

/* Gate styles - occupies same space as results */
.rvsc-gate {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 500px;
  z-index: 10;
}

.rvsc-gate-message h3 {
  margin: 0 0 8px 0;
  color: #111;
  font-size: 1.5rem;
}

.rvsc-gate-message p {
  margin: 0 0 30px 0;
  color: #666;
  font-size: 1.1rem;
}

.rvsc-gate .gform_wrapper {
  text-align: left;
}

/* Results section */
.rvsc-results {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: opacity 0.3s ease;
}

.rvsc-results.hidden {
  display: none;
}

.rvsc-results.visible {
  display: block;
}

#rvsc-results-title {
  margin: 0 0 16px 0;
  color: #111;
}

.rvsc-summary {
  background: #f8fafc;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
  font-size:20px;
}

/* Chart container */
.rvsc-chart-container {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  position: relative;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#rvsc-chart {
  max-width: 100%;
  max-height: 100%;
}

.rvsc-years-slider {
  margin: 10px 0 16px;
  padding: 12px 14px;
  border: 1px solid #eee;
  border-radius: var(--radius);
  background: #f9fafb;
  display: grid;
  gap: 10px;
}
.rvsc-years-slider label {
  font-weight: 600;
  color: #111;
  text-align: center;
}
.rvsc-years-slider input[type="range"] {
  width: 65%;
  min-width:240px;
  margin:auto;
  height:7px;
  background:#333;
  border-radius:25px;
}

.rvsc-years-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; /* allow custom thumb but keep native track */
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff; /* ball color */
  cursor: pointer;
  border: 2px solid #333;
  box-shadow: 0 0 2px rgba(0,0,0,0.2);
}

.rvsc-years-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: 2px solid #333;
  box-shadow: 0 0 2px rgba(0,0,0,0.2);
}


/* Cards */
.rvsc-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.rvsc-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.rvsc-card h4 {
  margin: 0 0 8px;
  color: #111;
}

.rvsc-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.rvsc-card li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}

.rvsc-card strong {
  font-weight: 700;
  color: #0f766e;
}

/* Form section (right side) */
.rvsc-form {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.rvsc-form:hover {z-index: 999;}

#rvsc-form-title {
  margin: 0 0 20px 0;
  color: #111;
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.rvsc-section-group {
  margin-bottom: 24px;
}

.rvsc-section {
  margin: 0 0 16px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 8px;
}

/* 2-column grid for form fields */
.rvsc-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 12px;
}

.rvsc-field {
  margin-bottom: 0; /* Remove bottom margin since grid handles spacing */
}

/* For sections with odd number of fields, span the last field across both columns if needed */
.rvsc-field:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: 50%;
}

.rvsc-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.3;
}

.rvsc-input {
  position: relative;
}

.rvsc-input input,
.rvsc-number-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.rvsc-input input:focus,
.rvsc-number-input:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.rvsc-input.adorn-left:before {
  content: attr(data-symbol);
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: .7;
  font-weight: 500;
}

.rvsc-input.adorn-left input {
  padding-left: 24px;
}

.rvsc-input.adorn-right:after {
  content: attr(data-symbol);
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: .7;
  font-weight: 500;
}

.rvsc-input.adorn-right input {
  padding-right: 24px;
}

/* Checkbox styles */
.rvsc-checkbox-field {
  grid-column: 1 / -1;
  max-width: 100%;
}

.rvsc-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: #374151;
  gap: 8px;
}

.rvsc-checkbox-label input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ddd;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 5px -4px;
}

.rvsc-checkbox-label input[type="checkbox"]:checked {
  background-color: #0f766e;
  border-color: #0f766e;
}

.rvsc-checkbox-label input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -1px;
  left: 2px;
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.rvsc-checkbox-label input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

/* Responsive Tooltip styles - Updated for new system */
.rvsc-tooltip {
  cursor: help;
  color: #6b7280;
  margin-left: 4px;
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e5e7eb;
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  font-weight: bold;
  transition: background-color 0.2s;
}

.rvsc-tooltip:hover {
  background: #9ca3af;
  color: white;
}

.rvsc-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.rvsc-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Responsive positioning for tooltips near edges */
.rvsc-tooltip[data-position="left"]::after {
  left: auto;
  right: 100%;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  margin-right: 10px;
}

.rvsc-tooltip[data-position="right"]::after {
  left: 100%;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  margin-left: 10px;
}

.rvsc-tooltip[data-position="bottom"]::after {
  top: 125%;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
}

/* Auto-adjust tooltips that would overflow on mobile */
@media (max-width: 768px) {
  .rvsc-tooltip::after {
    max-width: 220px;
    font-size: 11px;
  }
}

/* Actions */
.rvsc-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.rvsc-btn {
  background: #0f766e;
  color: white;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 600;
  flex: 1;
  transition: background-color 0.2s;
}

.rvsc-btn:hover {
  background: #0d6560;
}

.rvsc-btn.ghost {
  background: #f4f4f5;
  color: #111;
}

.rvsc-btn.ghost:hover {
  background: #e4e4e7;
}

/* Table */
.rvsc-table-wrap {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  overflow-y: hidden;
  overflow-x:auto;
}

.rvsc-table-note {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #eee;
  margin-top: 15px;
  border-radius: 10px;
}

.rvsc-table-note p {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.rvsc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.rvsc-table thead tr th {
    padding: 8px 8px;
    line-height: 1.4em;
}

.rvsc-table tbody tr td {
    padding: 6px 8px;
}

.rvsc-table th,
.rvsc-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #f0f0f0;
  text-align: right;
}

.rvsc-table th:first-child,
.rvsc-table td:first-child {
  text-align: center;
}

.rvsc-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  font-size: 11px;
}

.rvsc-table tbody tr:hover {
  background: #f9fafb;
}

@media (max-width: 980px) {
  .rvsc-main-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  
  .rvsc-form {
    position: static;
    order: -1; /* Form appears above results on mobile */
    display:grid;

  }
  
  .rvsc-table-wrap {
    overflow: auto;
  }
  
  .rvsc-table {
    min-width: 800px;
  }
  
  .rvsc-actions {
    flex-direction: column;
  }

  /* Stack form fields on mobile */
  .rvsc-field-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .rvsc-field:last-child:nth-child(odd) {
    grid-column: 1;
    max-width: 100%;
  }

  .rvsc-checkbox-field {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .rvsc-cards {
    grid-template-columns: 1fr;
  }
  
  .rvsc-chart-container {
    height: 250px;
  }
  
  .rvsc-wrapper {
    padding: 0 10px;
  }

  .rvsc-field label {
    font-size: 0.8rem;
  }
}