* {
  box-sizing: border-box;
}

:root {
  --primary: #13a4ec;
  --primary-strong: #0f8fd0;
  --secondary: #22c55e;
  --accent: #0e7279;
  --icon-warning: #f59e0b;
  --bg-top: #f6f7f8;
  --bg-bottom: #e4edf7;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --surface-tint: #edf7ff;
  --surface-hover: #dce6f0;
  --border: #d7e0ea;
  --text: #1f2937;
  --text-inverse: #ffffff;
  --muted: #64748b;
  --muted-soft: #6b806d;
  --success: #16a34a;
  --success-soft: #eafaf1;
  --danger: #ca2626;
  --warning: #d97706;
  --focus-ring: rgba(19, 164, 236, 0.14);
  --accent-soft: rgba(19, 164, 236, 0.18);
  --chart-zero-line: rgba(100, 116, 139, 0.35);
  --chart-grid-line: rgba(100, 116, 139, 0.14);
  --chart-fill-above: rgba(202, 38, 38, 0.08);
  --chart-fill-below: rgba(22, 163, 74, 0.1);
  --shadow-md: 0 10px 25px rgba(16, 28, 34, 0.08);
  --shadow-lg: 0 12px 30px rgba(16, 28, 34, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-top: #0d171f;
    --bg-bottom: #101c22;
    --surface: #142532;
    --surface-soft: #1a2f3e;
    --surface-tint: #173648;
    --surface-hover: #284356;
    --border: #2a4353;
    --text: #e2ecf4;
    --muted: #a1b5c7;
    --muted-soft: #9ab7ad;
    --success-soft: #17392a;
    --focus-ring: rgba(19, 164, 236, 0.24);
    --accent-soft: rgba(19, 164, 236, 0.26);
    --chart-zero-line: rgba(161, 181, 199, 0.45);
    --chart-grid-line: rgba(161, 181, 199, 0.18);
    --chart-fill-above: rgba(202, 38, 38, 0.15);
    --chart-fill-below: rgba(22, 163, 74, 0.16);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.35);
  }

  input,
  select,
  textarea {
    color: var(--text);
    -webkit-text-fill-color: var(--text);
  }

  input::placeholder,
  textarea::placeholder {
    color: var(--muted);
    -webkit-text-fill-color: var(--muted);
  }
}

body {
  margin: 0;
  font-family: Inter, system-ui, Arial, sans-serif;
  background:
    radial-gradient(at 0% 0%, rgba(19, 164, 236, 0.12) 0px, transparent 52%),
    radial-gradient(at 100% 100%, rgba(34, 197, 94, 0.14) 0px, transparent 50%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 40px 20px;
  padding-top: 86px; /* banner height + clearer breathing room above logo */
}

body.banner-closed {
  padding-top: 40px; /* keep safe top gap when banner is dismissed */
}

.app {
  width: 100%;
  max-width: 520px;
}

/*Banner*/
.top-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 10px 40px 10px 12px;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.top-banner a {
  color: var(--text-inverse);
  text-decoration: none;
}

.top-banner a:hover {
  text-decoration: underline;
}

.banner-close {
  position: absolute;
  right: 12px;
  top: 8px;
  background: transparent;
  border: none;
  color: var(--text-inverse);
  font-size: 14px;
  cursor: pointer;
}

html {
  scroll-behavior: smooth;
}

#solarQuote {
  scroll-margin-top: 70px; /* adjust to banner height */
}

/*Content*/
.header {
  text-align: center;
  margin-bottom: 25px;
}

.header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.logo {
  width: 90px;
  height: 90px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(19, 164, 236, 0.18), rgba(34, 197, 94, 0.22));
  border-radius: 50%;
  animation: pulse 3s infinite ease-in-out;
}

.logo svg {
  color: var(--primary);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.card {
  background: var(--surface);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.toggle {
  display: flex;
  background: var(--surface-soft);
  border-radius: 999px; /*pill shape*/
  padding: 4px;
  margin-bottom: 15px;
  gap: 4px;
}

.toggle button {
  flex: 1;
  padding: 8px 8px;
  border: none;
  border-radius: 999px; /*pill shape*/
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  transition: all 0.2s ease;
}

.toggle button.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 999px;
  color: var(--text-inverse);
  box-shadow: 0 6px 14px rgba(19, 164, 236, 0.28);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 15px 0 20px;
}

.input-group {
  margin-bottom: 18px;
}

.field-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.input-group label {
  display: block;
  margin-bottom: 6px;
}

.label-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.label-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}

.label-with-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  opacity: 0.9;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.date-grid .input-wrapper {
  border-color: var(--border);
  background: var(--surface-soft);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.date-grid .input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--surface);
}

#billingEndDate {
  color: var(--muted);
}

#billingStartDate,
#billingEndDate {
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  font-weight: 400;
  accent-color: var(--primary);
}

#billingStartDate::-webkit-datetime-edit,
#billingEndDate::-webkit-datetime-edit,
#billingStartDate::-webkit-datetime-edit-text,
#billingEndDate::-webkit-datetime-edit-text,
#billingStartDate::-webkit-datetime-edit-month-field,
#billingEndDate::-webkit-datetime-edit-month-field,
#billingStartDate::-webkit-datetime-edit-day-field,
#billingEndDate::-webkit-datetime-edit-day-field,
#billingStartDate::-webkit-datetime-edit-year-field,
#billingEndDate::-webkit-datetime-edit-year-field {
  font-family: inherit;
  font-size: 16px;
}

#billingStartDate:focus,
#billingEndDate:focus {
  outline: none;
}

#billingStartDate::-webkit-calendar-picker-indicator,
#billingEndDate::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.9;
  filter: invert(24%) sepia(58%) saturate(2417%) hue-rotate(252deg) brightness(90%) contrast(92%);
}

/* Vanilla Datepicker - align typography and tone with app UI */
.datepicker {
  font-family: inherit;
}

.datepicker-dropdown {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

.datepicker-picker {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.datepicker-controls .button {
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.datepicker-controls .button:hover {
  background: var(--surface-soft);
}

.datepicker-main .dow {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.datepicker-cell {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-radius: 8px;
}

.datepicker-cell:hover {
  background: var(--surface-tint);
}

.datepicker-cell.selected,
.datepicker-cell.selected:hover {
  background: var(--primary);
  color: var(--text-inverse);
  font-weight: 700;
}

.datepicker-cell.today:not(.selected) {
  background: var(--accent-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.input-wrapper span {
  font-size: 13px;
  color: var(--muted);
}

.primary-btn {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--text-inverse);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(19, 164, 236, 0.35);
  transition: all 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
}

.secondary-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.result-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 18px;
  margin-top: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.result-container {
  font-size: 14px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 800;
  border-bottom: 2px solid var(--border);
  margin-bottom: 6px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child {
  border-bottom: none;
}

.result-row.best {
  background: var(--success-soft);
  border-radius: 10px;
  font-weight: 800;
}

.summary-box {
  background: var(--surface-soft);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.compare-table {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.compare-header,
.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  font-size: 13px;
}

.compare-header {
  font-weight: 700;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.compare-row {
  border-bottom: 1px solid var(--border);
}

.compare-row:last-child {
  border-bottom: none;
}

.compare-row.best {
  background: var(--success-soft);
}

.result-value.negative {
  color: var(--success);
  font-weight: 800;
}

.result-value.positive {
  color: var(--danger);
  font-weight: 800;
}

/* Chart */
.chart-wrap {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-bottom: 20px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 240px !important;
}

/* Slider */
.slider {
  width: 100%;
  margin-top: 10px;
  appearance: none;
  height: 6px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
}

.slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.tou-kwh {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-tint);
  border: 1px solid var(--focus-ring);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.tou-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* Info Box */
.info-box {
  display: flex;
  gap: 14px;
  background: var(--surface-tint);
  border: 1px solid var(--focus-ring);
  padding: 16px;
  border-radius: 14px;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text);
}

.info-text {
  flex: 1;
  line-height: 1.6;
  text-align: justify;
}

.info-icon-circle {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: var(--text-inverse);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

/* Powered Section */
.powered {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.powered a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
}

.powered a:hover {
  text-decoration: underline;
}

/* Bottom Footer */
.footer-bottom {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.slider-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-soft);
  transition: all 0.2s ease;
}

.step-btn:hover {
  background: var(--surface-hover);
}

/* Info Tooltip */

.with-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--primary);
  cursor: pointer;
  user-select: none;
}

.info-tooltip {
  position: absolute;
  top: 26px;              /* appear above */
  left: 0;
  transform: translateX(-50%) translateY(6px);
  width: 270px;
  padding: 14px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  text-align: justify;
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 20;
}

/* Show on hover (desktop) */
.info-trigger:hover .info-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Show when focused (keyboard / mobile tap) */
.info-trigger:focus .info-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.info-title {
  font-weight: 600; /* not bold-bold */
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text);
}

.info-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: translateX(-50%) rotate(45deg);
}

/* AFA History Rate Table */
.afa-history {
  margin-top: -15px;
  font-size: 12px;
  
}

.afa-history summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.afa-table {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.afa-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.afa-row:hover {
  background: var(--surface-tint);
}

.afa-row.current {
  background: var(--accent-soft);
  font-weight: 700;
}

.afa-row.cycle-month {
  background: var(--success-soft);
  font-weight: 700;
}

.afa-row.grid-picked {
  outline: 1px solid var(--success);
}

.afa-row.forecast span:last-child {
  color: var(--warning);
}

.afa-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

/* Summary Styling */
.afa-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  list-style: none; /* remove default arrow */
}

.afa-summary::-webkit-details-marker {
  display: none; /* remove default browser arrow */
}

.disclaimer-summary {
  justify-content: flex-start;
  gap: 10px;
}

.afa-arrow {
  transition: transform 0.25s ease;
  font-size: 14px;
}

/* Rotate arrow when open */
.afa-history details[open] .afa-arrow {
  transform: rotate(90deg);
}

/* Takaful Quick Quote Section */
/* Solar Quote Section */
.solar-quote {
  margin-top: 24px;
  font-size: 13px;
}

.quote-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  list-style: none;
  padding: 6px 0;
}

.quote-summary::-webkit-details-marker {
  display: none;
}

.quote-arrow {
  transition: transform 0.25s ease;
  font-size: 14px;
}

.solar-quote details[open] .quote-arrow {
  transform: rotate(90deg);
}

.quote-content {
  margin-top: 12px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

/* Quote Inputs */
.quote-content .input-group {
  margin-bottom: 14px;
}

.quote-content input,
.quote-content select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  outline: none;
}

.quote-content input:focus,
.quote-content select:focus {
  border-color: var(--primary);
}

/* Quote Buttons */
.quote-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quote-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--text-inverse);
}

.quote-secondary {
  background: var(--surface-soft);
  color: var(--text);
}

.quote-whatsapp {
  background: #25d366;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.quote-whatsapp:hover {
  background: #1eb95a;
}

.whatsapp-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.quote-btn:hover {
  transform: translateY(-2px);
}

/* Result */
.quote-result {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  background: var(--success-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

/* Compact Quote Layout */

.quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
}

.quote-row label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.quote-input {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  height: 48px;
  flex: 1;
}

.quote-input input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
}

.quote-input span {
  font-size: 12px;
  color: var(--muted-soft);
}

.quote-row select {
  flex: 1;
  height: 48px;                 /* same visual height */
  padding: 0px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 16px;
  color: var(--text);
  background-color: var(--surface-soft);
  /*background: white;*/
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  padding-right: 36px;
}

.quote-row select:focus {
  color: var(--text);
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  color: var(--text);
}

/* Arrow inside the box */
.select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 12px;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

.icon-primary {
  color: var(--primary);
}

.icon-secondary {
  color: #8922ce;
  /*var(--secondary)*/
}

.icon-warning {
  color: var(--icon-warning);
}

.icon-success {
  color: var(--success);
}

.icon-accent {
  color: var(--accent);
}

.rule-divider {
  margin: 10px 0;
  border: none;
  border-top: 1px solid var(--border);
}

.note-muted {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.quote-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.quote-actions .quote-btn {
  flex: 1;
}

@media (max-width: 480px) {
.date-grid {
  grid-template-columns: 1fr;
}

.quote-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.quote-actions .quote-btn {
  flex: 1;
  height: 50px;                 /* fixed consistent height */
  border-radius: 20px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
}

/* Remove number input arrows (Chrome, Safari, Edge) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

