/**
 * Solar Energy Calculator Styles
 * Light / Teal UI (matches provided reference screenshot)
 * Note: this file changes styling only (no HTML/JS changes).
 */

/* ------------------------------------------------------------------
   Theme Tokens
------------------------------------------------------------------ */
#solar-calculator-wrapper{
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #0f172a;
  --muted:#000000;

  --brand:#E7C554;      /* teal */
  --brand-2:#E7C554;    /* darker teal */
  --line:#dfe9ea;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 10px 28px rgba(0,0,0,.21);

  --field-h: 52px;
  --field-pad-x: 16px;
  --icon-size: 18px;
  --unit-w: 54px;

  font-family: "Tajawal", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  direction: ltr;
  color: var(--text);
}

/* ------------------------------------------------------------------
   Layout
------------------------------------------------------------------ */
.solar-calc-container{
  max-width: 980px;
  margin: 40px auto;
  padding: 26px 20px 34px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* Header */
.solar-calc-header{
  text-align: center;
  padding: 12px 0 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(6, 143, 160, .12);
}
.solar-calc-header h2{
  margin: 0;
  font-size: 40px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--text);
}

/* Tabs */
.solar-calc-tabs{
  display:flex;
  justify-content:center;
  gap: 18px;
  margin: 18px auto 26px;
  border-bottom: none;
}

.tab-btn{
  min-width: 170px;
  height: 46px;
  padding: 0 22px;
  border-radius: 8px;
  border: 2px solid var(--brand);
  background: transparent;
  color: var(--brand);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: .2s ease;
  position: relative;
  bottom: 0;
}
.tab-btn:hover{
  transform: translateY(-1px);
  background: rgba(10, 166, 181, .06);
}
.tab-btn.active{
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
    
}

/* Hide the system-info text blocks to match the clean reference UI */
.system-info{
  display:none !important;
}

/* ------------------------------------------------------------------
   Inputs - single-line rows (label on right, field on left)
------------------------------------------------------------------ */
.solar-calc-content{
  padding-top: 8px;
}

/* Each card becomes a row */
.input-card{
  background: transparent;
  border: none;
  box-shadow: none;
  margin: 1px auto;
  padding: 0;
  max-width: 760px;
  padding-bottom: 19px;

  display:flex;
  flex-direction: row-reverse;   /* label on the right */
  align-items: center;
  justify-content: center;
  gap: 18px;
}

/* label on the right like screenshot */
.input-card label{
    font-family: "Tajawal";
  margin: 0;
  font-weight: 700;
  color: var(--muted);
  font-size: 15px;
  min-width: 260px;
  text-align: left;
  display:flex;
  align-items:center;
  gap: 8px;
}

/* remove asterisk feel */
.input-card label .required{
  display:none;
}

/* number input field */
.input-card input[type="number"]{
  width: 420px;
  max-width: 100%;
  height: var(--field-h);
  padding: 0 calc(var(--field-pad-x) + var(--unit-w)) 0 calc(var(--field-pad-x) + 42px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 6px 16px rgba(15,23,42,.06);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: .15s ease;
  box-sizing: border-box;
}

/* focus */
.input-card input[type="number"]:focus{
  border-color: rgba(10,166,181,.55);
  box-shadow: 0 0 0 4px rgba(10,166,181,.12), 0 10px 18px rgba(15,23,42,.06);
}

/* Placeholder like faint UI */
.input-card input[type="number"]::placeholder{
  color: rgba(107,124,134,.55);
}

/* Left icon inside the field (lightning / clock) */
.input-card input[type="number"]{
  background-repeat: no-repeat;
  background-position: 16px 50%;
  background-size: var(--icon-size) var(--icon-size);
}

/* lightning for current fields */
#ongrid-daytime-current,
#hybrid-daytime-current,
#hybrid-nighttime-current{
  background-image: url("http://new.dar-alhafidh.iq/wp-content/plugins/ar-solar-energy-calculator/assets/lightning.png");
}

/* clock for backup hours */
#hybrid-backup-hours{
  background-image: url("http://new.dar-alhafidh.iq/wp-content/plugins/ar-solar-energy-calculator/assets/shape.png");
}

/* Unit text on the far-right inside the field (AMP / Hr) */
.input-card{
  position: relative;
}
.input-card::after{
  content: "";
  position: absolute;
  left: calc(50% - 210px + 420px - (var(--unit-w) - 6px)); /* aligns to input's right edge */
  top: 50%;
  transform: translateY(-50%);
  width: var(--unit-w);
  text-align: center;
  color: rgba(107,124,134,.75);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .6px;
  pointer-events: none;
}

/* Default to AMP (most fields) */
#ongrid-daytime-current ~ .error-msg,
#hybrid-daytime-current ~ .error-msg,
#hybrid-nighttime-current ~ .error-msg{
  /* keep selector present for compatibility */
}
.input-card:has(#ongrid-daytime-current)::after{ content: "AMP"; }
.input-card:has(#hybrid-daytime-current)::after{ content: "AMP"; }
.input-card:has(#hybrid-nighttime-current)::after{ content: "AMP"; }
.input-card:has(#hybrid-backup-hours)::after{ content: "Hr"; }

/* If :has isn't supported, it's okay — fields will still look correct, just without the unit text. */

/* Error text below the field */
.error-msg{
  display:block;
  min-height: 18px;
  color: #d11a2a;
  font-size: 12px;
  font-weight: 600;
  margin: 8px auto 0;
  max-width: 420px;
  text-align: left;
}

/* ------------------------------------------------------------------
   Radio groups (keep functional but soften look)
------------------------------------------------------------------ */
.radio-group{
  width: 420px;
  max-width: 100%;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------
   Results: Disclaimers & Multi-results
------------------------------------------------------------------ */
.solar-warning{
  background:#fff3cd;
  color:#856404;
  border:2px solid #ffeeba;
  padding:14px 16px;
  border-radius:12px;
  font-weight:800;
  text-align:center;
  margin: 10px 0 16px;
  line-height:1.6;
}

.parallel-warning{
  background:#eef9ff;
  color:#0b4b61;
  border:1px solid rgba(10,166,181,.35);
  padding:12px 14px;
  border-radius:12px;
  font-weight:700;
  margin: 0 0 16px;
}

.phase-result-block{
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(223,233,234,.9);
  box-shadow: 0 10px 22px rgba(15,23,42,.05);
  border-radius: 14px;
  padding: 14px 14px 10px;
  margin: 14px 0;
}

.phase-title{
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
}

.inverter-note{
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  line-height: 1.5;
  background: rgba(10,166,181,.08);
  border: 1px solid rgba(10,166,181,.25);
}
.inverter-note.danger{
  background:#ffecef;
  border-color:#ffc2ca;
  color:#8a1c2b;
}
.inverter-note.warning{
  background:#fff3cd;
  border-color:#ffeeba;
  color:#856404;
}

.inverter-options{
  margin-top: 14px;
}
.inverter-options .subhead{
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 900;
  color: var(--muted);
}

/* Responsive table wrapper (horizontal scroll on small screens) */
.results-table-wrapper{
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.results-table-wrapper::-webkit-scrollbar{
  height: 10px;
}
.results-table-wrapper::-webkit-scrollbar-thumb{
  background: rgba(15,23,42,.18);
  border-radius: 999px;
}
.results-table-wrapper::-webkit-scrollbar-track{
  background: rgba(15,23,42,.06);
  border-radius: 999px;
}

.options-table{
  border: 1px solid rgba(223,233,234,.9);
  border-radius: 12px;
  overflow: hidden; /* keep corners clean */
  background: #fff;
  min-width: 720px; /* enables horizontal scroll wrapper on small screens */
  width: max-content;
}

.opt-row{
  display: grid;
  grid-template-columns: 70px 1fr 140px 140px 90px;
  gap: 10px;
  padding: 10px 12px;
  align-items: center;
  border-bottom: 1px solid rgba(223,233,234,.9);
  font-size: 13px;
}
.opt-row:last-child{
  border-bottom: none;
}
.opt-head{
  background: rgba(10,166,181,.08);
  font-weight: 900;
  color: var(--text);
}

.support-only{
  background: #ffffff;
  border: 1px solid rgba(223,233,234,.9);
  border-radius: 14px;
  padding: 16px;
}
.support-only h4{
  margin: 0 0 8px;
  font-weight: 900;
}
.support-only p{
  margin: 0;
  font-weight: 800;
}

.ev-suggestion{
  margin-top: 16px;
  background: rgba(10,166,181,.06);
  border: 1px solid rgba(10,166,181,.2);
  border-radius: 14px;
  padding: 14px;
}
.ev-suggestion h4{
  margin: 0 0 8px;
  font-weight: 900;
}
.ev-suggestion p{ margin: 0 0 8px; }
.ev-list{ margin: 0 0 0 18px; }

@media (max-width: 720px){
  /* Keep the grid layout and allow horizontal scrolling for clarity */
  .options-table{
    min-width: 720px;
  }
  .opt-row{
    font-size: 12.5px;
    grid-template-columns: 64px 1fr 140px 140px 90px;
    padding: 9px 10px;
  }
}

.radio-label{
  display:flex;
  align-items:center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 6px 16px rgba(15,23,42,.06);
  cursor:pointer;
  transition: .15s ease;
  min-width: 130px;
}
.radio-label:hover{
  border-color: rgba(10,166,181,.45);
}
.radio-label input[type="radio"]{
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  margin: 0;
}
.radio-label span{
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.radio-label input[type="radio"]:checked + span{
  color: var(--brand);
}

/* Warning messages */
.warning-msg{
  width: 420px;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #f59e0b;
  background: rgba(245,158,11,.10);
  border-radius: 10px;
  color: #8a5a00;
  font-weight: 700;
  direction: rtl;
}

/* ------------------------------------------------------------------
   Calculate button (full-width teal bar)
------------------------------------------------------------------ */
.calculate-btn{
  display:block;
  width: min(760px, 100%);
  margin: 26px auto 0;
  height: 56px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  cursor:pointer;
  text-transform: none;
  letter-spacing: .2px;
  transition: .18s ease;
}
.calculate-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 26px rgba(10,166,181,.30);
}
.calculate-btn:active{
  transform: translateY(0);
}
.calculate-btn:disabled{
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
}

/* ------------------------------------------------------------------
   Results Modal/Popup
------------------------------------------------------------------ */
.modal-overlay{
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.results-panel{
  position: relative;
  max-width: 760px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 24px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(15,23,42,.25);
  animation: slideUp 0.3s ease;
}

.modal-close{
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(10,166,181,.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .2s ease;
  z-index: 1;
}

.modal-close:hover{
  background: rgba(10,166,181,.2);
  transform: rotate(90deg);
}

.modal-close svg{
  width: 20px;
  height: 20px;
  stroke: var(--brand-2);
  stroke-width: 2.5;
}

.results-panel h3{
  margin: 0 0 20px;
  padding-right: 40px;
  text-align:center;
  color: var(--brand-2);
  font-weight: 900;
  font-size: 22px;
}
.result-item{
  background: #f7fbfb;
  border: 1px solid rgba(6,143,160,.12);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.result-label{
  display:block;
  font-size: 12px;
  font-weight: 800;
  color: rgba(107,124,134,.9);
  letter-spacing: .2px;
  text-transform: none;
}
.result-value{
  display:block;
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
}
.result-value.highlight{
  color: var(--brand-2);
}

/* Inverter note */
.inverter-note{
  padding: 12px 14px;
  margin: 10px 0;
  border-radius: 10px;
  background: rgba(10,166,181,.08);
  border: 1px solid rgba(10,166,181,.2);
  color: var(--brand-2);
  font-weight: 700;
  text-align: center;
  direction: rtl;
}


/* Pricing */
.pricing-section{
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(10,166,181,.06);
  border: 1px dashed rgba(10,166,181,.35);
}
.pricing-header{
  margin: 0 0 10px;
  text-align:center;
  color: var(--brand-2);
  font-weight: 900;
  font-size: 16px;
}
.price-item{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(15,23,42,.06);
  margin-bottom: 8px;
}
.price-label{
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}
.price-value{
  color: var(--brand-2);
  font-weight: 900;
  font-size: 14px;
}
.price-item.total-price{
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
  border: none;
}
.price-item.total-price .price-label,
.price-item.total-price .price-value{
  color: #fff;
  font-size: 15px;
}

/* Arabic note */
.arabic-note{
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f0fbfb;
  border: 1px solid rgba(10,166,181,.20);
  direction: rtl;
  text-align: center;
}
.arabic-note p{
  margin: 0;
  color: var(--brand-2);
  font-weight: 800;
}

/* ------------------------------------------------------------------
   Responsive
------------------------------------------------------------------ */
@media (max-width: 860px){
  .solar-calc-container{ margin: 18px 10px; }
  .solar-calc-header h2{ font-size: 32px; }
  .tab-btn{ min-width: 140px; }
  .input-card{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    max-width: 520px;
  }
  .input-card label{ min-width: auto; width: 100%; text-align: left; justify-content:flex-start; }
  .input-card input[type="number"],
  .radio-group{ width: 100%; }
  .error-msg{ max-width: 100%; }
  .calculate-btn{ width: 100%; }
  /* unit positioning in stacked mode */
  .input-card::after{ left: auto; right: 18px; }
  
  /* Modal adjustments */
  .results-panel{
    max-height: 90vh;
    padding: 24px 18px;
  }
}

@media (max-width: 480px){
  .solar-calc-header h2{ font-size: 26px; }
  .tab-btn{ min-width: 100px; height: 61px; }
  
  .results-panel{
    padding: 20px 16px;
    border-radius: 12px;
  }
  
  .modal-close{
    width: 32px;
    height: 32px;
  }
}


/* --- tweaks --- */
.solar-calc-tabs{max-width:760px;margin:0 auto 22px;padding:12px 0;border-top:1px solid rgba(15,23,42,.08);border-bottom:1px solid rgba(15,23,42,.08);justify-content:flex-start;}
/* ---.solar-calc-tabs::before{content:"نوع النظام";color:var(--muted);font-weight:800;font-size:13px;margin-right:14px;} --- */
.solar-calc-tabs .tab-btn:first-of-type{margin-left:auto;}
.input-card label{min-width:230px;flex:0 0 230px;white-space:nowrap;}
.input-card input[type="number"],.radio-group,.warning-msg{width:440px;}
.radio-group{align-items:center;}
.radio-label{flex:0 0 auto;height:44px;padding:0 14px;box-sizing:border-box;}
@media(max-width:740px){.input-card{flex-direction:column;align-items:flex-start;gap:10px}.input-card label{flex:0 0 auto;min-width:0;width:100%;white-space:normal}}


/* Tabs content show/hide */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =========================================================
   PATCH: Topology row + alignment + spacing + dividers
   ========================================================= */

/* 1) Topology: النص يسار — الأزرار يمين بنفس السطر + خط علوي/سفلي */
.solar-calc-tabs{
  width: min(760px, 100%);
  margin: 2px auto 2px;
  justify-content: flex-end;     /* الأزرار يمين */
  padding: 6px 0;
  position: relative;

  border-top: 1px solid rgba(6,143,160,.18);
  border-bottom: 1px solid rgba(6,143,160,.18);
}

.solar-calc-tabs::before{
  /* --- content: "نوع النظام";--- */
  position: absolute;
  left: 0;                       /* يسار */
  top: 50%;
  transform: translateY(-50%);
  color: rgba(107,124,134,.95);
  font-weight: 800;
  font-size: 15px;
}

/* 2) منع تداخل Daytime Current (Amp) + توحيد عرض الحقول مع اللي تحتها */
.input-card{
  max-width: 760px;
  gap: 10px;                     /* مسافة أوضح بين الحقل والليبل */
}

/* الليبل على اليمين بدون تداخل */
.input-card label{
  min-width: 260px;
  flex: 0 0 47px;
  text-align: left;
  white-space: nowrap;           /* يمنع كسر السطر اللي يسبب تداخل */
}

/* نفس عرض الإدخال مع مجموعات الراديو */
.input-card input[type="number"],
.radio-group{
  width: 520px;
  max-width: 100%;
}

/* خيارات الراديو تكون بعرض كامل ومتناسقة */
.radio-group{
  flex-direction: column;
}
.radio-label{
  width: 100%;
  min-width: 0;
}

/* 3) Phase Selection و Roof Space: مسافة أكبر عن حقل Daytime */
.input-card:has(.radio-group){
  margin-top: 0px;
    border-top: 1px solid #e7c5543b;
    padding-top: 20px;
}

/* الخط الخفيف الفاصل أعلى/أسفل محتوى التبويب */
.tab-content{
  padding-top: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(6,143,160,.10);
}

/* مهم: لا نعرض كل التبويبات */
.tab-content{ display:none; }
.tab-content.active{ display:block; }

/* (اختياري) لإزالة أي عنصر unit كان ممكن يسوي تداخل */
.input-card::after{ display:none !important; }
