/* =========================
   LAYOUT (Main Container)
   ========================= */
.a4-container {
  /*Alignments*/
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;

  /* Margin,Padding,Gaps */
  gap: 5px;
  margin: 5px;
  padding: 5px;

  /*Color,Border,Shadows */
  border-radius: 8px;
  background: #fafafa;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
}
/* General container for input/output sections */
.a4-colinp {
  /*Alignments*/
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;

  /* Margin,Padding,Gaps */
  padding: 2%;
  gap: 1.5rem;
  max-width: 100%;

  /*Color,Border,Shadows */
  border: 2px groove #ddd;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.a4-colout {
  /*Alignments*/
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;

  /* Margin,Padding,Gaps */
  max-width: 100%;
  padding: 1%;

  /*Color,Border,Shadows */
  border: 2px groove #ddd;
  border-radius: 6px;
  background: #f6f3f3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/*  ===============================================
   INPUT SECTION
    =============================================== */
/* Rows inside (inductor + capacitor side by side) */
.a4-rowinp {
  /*Alignments*/
  display: flex;
  flex-direction: row;
  justify-content: center;

  /* Margin,Padding,Gaps */
  width: 100%;
  gap: 1.5rem;
}

/* Column cards (inductor, capacitor) */
.a4-colinpload,
.a4-colinppf {
  /*Alignments*/
  flex: 1 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  /* Margin,Padding,Gaps */
  gap: 1rem;
  padding: 1.5rem;

  /*Color,Border,Shadows */
  border: 2px groove #ddd;
  border-radius: 8px;
  background: #fafafa;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* Image styling */
.a4-colinpload img,
.a4-colinppf img {
  /* Margin,Padding,Gaps */
  max-width: 100px !important;
  height: auto !important;
}

.a4-input-with-unit {
  /*Alignments*/
  display: flex;
  align-items: stretch;     /* ensure both children have same height */

  /* Margin,Padding,Gaps */
  width: 100%;
  min-width: 200px;

  /*Color,Border,Shadows */
  overflow: hidden;         /* keeps rounded corners clean */
}

.a4-input-with-unit input {
  /*Alignments*/
  flex: 4 1 0;              /* grow:4 shrink:1 basis:0 -> approx 66% vs select*/

  /* Margin,Padding,Gaps */
  width: 0;                 /* important with flex-basis:0 so flex decides size */
  min-width: 0;             /* allow shrink inside flex container */
  height: 100%;             /* match select height */
  padding : 10px;

  /*Color,Border,Shadows */
  outline: none;
  border: 1px groove #ddd;
  border-radius: 6px 0 0 6px;
}

.a4-input-with-unit select {
  /* Special Parameters */
  cursor: pointer;

  /*Alignments*/
  flex: 2 1 0;              /* grow:2 shrink:1 basis:0 -> approx 33% */
  text-align: center;

  /* Margin,Padding,Gaps */
  padding : 10px;

  /*Color,Border,Shadows */
  background: #f5f5f5;
  font-weight: 500;
  border: 1px groove #ddd;
  border-radius: 0 6px 6px 0;
}

/* Button row */
.a4-rowbut {
  /*Alignments*/
  display: flex;
  justify-content: center;

  /* Margin,Padding,Gaps */
  gap: 0.5rem;
}
/* =========================
   OUTPUT SECTION
   ========================= */
/* Rows inside ( side by side) */
.a4-rowout {
  /*Alignments*/
  flex: 1 1;
  display: flex;
  flex-direction: column;
  align-items: center;

  /* Margin,Padding,Gaps */
  gap: 1.5rem;
  padding: 2%;
  width: 100%;
}

.a4-rowoutcap,
.a4-rowoutrp,
.a4-rowoutper {
  /*Alignments*/
  flex: 1 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;

  /* Margin,Padding,Gaps */
  gap: 1rem;
  padding: 1%;
  width: 95%;
  min-width: 320px;

  /*Color,Border,Shadows */
  border: 2px groove #ddd;
  border-radius: 8px;
  background: #fafafa;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* Image styling */
.a4-rowoutcap img,
.a4-rowoutrp img,
.a4-rowoutper img {
  /* Margin,Padding,Gaps */
  max-width: 75px !important;
  height: auto !important;
}

.a4-coloutfield {
  /*Alignments*/
  display: flex;
  flex-direction: column;
  align-items: center;

  /* Margin,Padding,Gaps */
  gap: 1rem;
  padding: 3%;
}

.a4-output-with-unit {
  /*Alignments*/
  display: flex;
  align-items: stretch;     /* ensure both children have same height */

  /* Margin,Padding,Gaps */
  min-width: 200px;
  height: 40px;

  /*Color,Border,Shadows */
  overflow: hidden;         /* keeps rounded corners clean */
  border-radius: 6px;
  border: 1px solid #ccc;
}

.a4-output-with-unit output {
  /*Alignments*/    
  flex: 4 1 0;              /* grow:4 shrink:1 basis:0 -> approx 66% vs select*/
  display: flex;                 /* make output a flex container */
  align-items: center;           /* vertical center */
  justify-content: center;       /* horizontal center */

  /* Margin,Padding,Gaps */
  width: 0;                 /* important with flex-basis:0 so flex decides size */
  min-width: 0;             /* allow shrink inside flex container */
  margin: 0;
  height: 100%;             /* match select height */

  /*Color,Border,Shadows */
  border: none;
  outline: none;
  font-size: medium;
  font-weight: 500;
}

.a4-output-with-unit span {
  /* Special Parameters */
  cursor: pointer;

  /*Alignments*/
  text-align: center;
  flex: 2 1 0;              /* grow:2 shrink:1 basis:0 -> approx 33% */

  /* Margin,Padding,Gaps */
  padding : 10px;

  /*Color,Border,Shadows */
  border: none;
  outline: none;
  border-radius: 6px;
  background: #f5f5f5;
  font-weight: 500;
}

/* ===============================================
   UTILITIES
   =============================================== */

h2 {
  /*Alignments*/
  text-align: center;
  /* center aligned */
  letter-spacing: 0.5px;
  /* slightly spaced text */

  /* Margin,Padding,Gaps */
  margin-bottom: 15px;
  /* space below heading */
  padding-bottom: 5px;
  /* spacing for underline */

  /*Color,Border,Shadows */
  color: #2c3e50;
  /* dark blue-gray */
  border-bottom: 2px solid #8d8989;
  /* subtle underline */
  font-size: 1.5rem;
  /* balanced size */
  font-weight: 600;
  /* semi-bold */
}

.a4-container label {
  /*Alignments*/
  display: block;
  /* make it a block element */

  /* Margin,Padding,Gaps */
  padding: 10px;

  /*Color,Border,Shadows */
  color: #000;
  font-size: large;
  font-family: "Times New Roman", Times, serif;
}
/* =========================
   BUTTONS
   ========================= */
.a4-rowbut button {
  /* Special Parameters */
  cursor: pointer;
  transition: box-shadow 0.2s;

  /* Margin,Padding,Gaps */
  padding: 8px 12px;

  /*Color,Border,Shadows */
  color: #000;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
}

#a4-submit {
  /*Color,Border,Shadows */
  background-color: #c1d82a;
}

#a4-submit:hover,
#a4-submit:active {
  /*Color,Border,Shadows */
  color: #fffdfd;
  background-color: #889d13;
}

#a4-reset {
  /*Color,Border,Shadows */
  background-color: #fbb7b0;
}

#a4-reset:hover,
#a4-reset:active {
  /*Color,Border,Shadows */
  color: #fffdfd;
  background-color: #f3475e;
}

button:hover {
  /*Color,Border,Shadows */
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

/* =========================
   Loading Effect
   ========================= */
.a4-loading-popup {
  /* Special Parameters */
  transform: translate(-50%, -50%);

  /*Alignments*/
  display: none;
  /* hidden initially */
  text-align: center;

  /* Margin,Padding,Gaps */
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 2000;
  padding: 20px;

  /*Color,Border,Shadows */
  border-radius: 80px;
  background: rgba(255, 255, 255, 0.7);
  /* 90% opaque white */
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.a4-sandclock {
  /* Margin,Padding,Gaps */
  width: 100px;
  /* adjust size of your GIF */
  height: 100px;
}

/* =========================
   Custom Alert messages
   ========================= */
/* Overlay */
.a4-custom-alert {
  /*Alignments*/
  display: none;
  /* hidden by default */
  justify-content: center;
  align-items: center;

  /* Margin,Padding,Gaps */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3000;

  /*Color,Border,Shadows */
  background: rgba(0, 0, 0, 0.4);
}

/* Box */
.a4-custom-alert-box {
  /*Alignments*/
  text-align: center;

  /* Margin,Padding,Gaps */
  padding: 20px 30px;
  min-width: 280px;

  /*Color,Border,Shadows */
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Icon */
#a4-customAlertIcon {
  /*Alignments*/
  display: block;

  /* Margin,Padding,Gaps */
  margin-bottom: 10px;

  /*Color,Border,Shadows */
  font-size: 28px;
}

/* Message */
#a4-customAlertMsg {
  /*Alignments*/
  display: block;

  /* Margin,Padding,Gaps */
  margin-bottom: 20px;

  /*Color,Border,Shadows */
  font-size: 16px;
}

/* Button */
#a4-customAlertBtn {
  /* Special Parameters */
  cursor: pointer;

  /* Margin,Padding,Gaps */
  padding: 6px 14px;

  /*Color,Border,Shadows */
  border: none;
  border-radius: 6px;
  background: #ec3f3f;
  color: #fff;
}

#a4-customAlertBtn:hover {
  /* Special Parameters */
  filter: brightness(1.1);
}

/* =========================
   INFO BUTTON (popup trigger)
   ========================= */
.a4-info-btn {
  /* Special Parameters */
  animation: pulseAnim 1.2s ease-in-out infinite;
  cursor: pointer;

  /*Alignments*/
  text-align: center;

  /* Margin,Padding,Gaps */
  padding: 0;
  width: 20px;
  height: 20px;
  border: none;
  margin-left: 6px;
  border-radius: 50%;

  /*Color,Border,Shadows */
  color: #ffffff;
  background: #a7ce1a;
  font-size: 12px;
  font-weight: bold;
  line-height: 20px;
}

@keyframes pulseAnim {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

/* =========================
   POPUP STYLES
   ========================= */
/* Overlay (hidden by default) */
.a4-popup-overlay {
  /*Alignments*/
  position: fixed;
  display: none;
  /* hidden until opened */
  align-items: center;
  /* center Y */
  justify-content: center;
  /* center X */

  /* Margin,Padding,Gaps */
  z-index: 1000;
  inset: 0;

  /*Color,Border,Shadows */
  background: rgba(0, 0, 0, 0.6);
}

.a4-popup-overlay.a4-open {
  /*Alignments*/
  display: flex;
}

/* show + center */

/* Popup box */
.a4-popup-box {
  /*Alignments*/
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: auto;
  /* scroll inside if content grows */

  /* Margin,Padding,Gaps */
  width: min(700px, 90vw);
  max-height: 85vh;
  padding: 20px;
  gap: 16px;

  /*Color,Border,Shadows */
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* Title & close */
.a4-popup-box h3 {
  margin: 0 0 6px;
}

.a4-close {
  /* Special Parameters */
  cursor: pointer;
  position: absolute;
  
  /* Margin,Padding,Gaps */
  top: 10px;
  right: 12px;
  border: 0;
  width: 28px;
  height: 28px;

  /* Center the text perfectly */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Visuals */
  color: #333;
  background: #ff7272;
  border-radius: 50%;
  font-size: 16px;
}

/* Rows */
.a4-rows {
  /*Alignments*/
  display: flex;
  flex-direction: column;

  /* Margin,Padding,Gaps */
  gap: 10px;
}

.a4-definition,
.a4-formula,
.a4-derivation {
  /*Alignments*/
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;

  /* Margin,Padding,Gaps */
  gap: 12px;
  padding: 10px 12px;

  /*Color,Border,Shadows */
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

.a4-heading {
  /*Alignments*/
  text-align: center;
  /* center aligned */

  /* Margin,Padding,Gaps */
  margin-bottom: 15px;
  /* space below heading */
  padding-bottom: 5px;
  /* spacing for underline */
  letter-spacing: 0.5px;
  /* slightly spaced text */

  /*Color,Border,Shadows */
  font-size: 1.5rem;
  /* balanced size */
  font-weight: 600;
  /* semi-bold */
  color: #5a7925;
  /* dark blue-gray */
}

.a4-value {
  /*Alignments*/
  text-align: center;
  /* center aligned */

  /* Margin,Padding,Gaps */
  margin-bottom: 15px;
  /* space below heading */
  padding-bottom: 5px;
  /* spacing for underline */
  letter-spacing: 0.5px;
  /* slightly spaced text */

  /*Color,Border,Shadows */
  font-size: 1.2rem;
  /* balanced size */
  font-weight: 700;
  /* semi-bold */
  color: #000000;
  /* dark blue-gray */
}

.a4-row {
  /*Alignments*/
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  /* Margin,Padding,Gaps */
  gap: 12px;
  padding: 10px 12px;

  /*Color,Border,Shadows */
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

/* Footer */
.a4-footer {
  /*Alignments*/
  display: flex;
  justify-content: flex-end;

  /* Margin,Padding,Gaps */
  gap: 8px;
}

.a4-btn-primary {
  /* Special Parameters */
  cursor: pointer;

  /* Margin,Padding,Gaps */
  border: 0;
  padding: 8px 14px;

  /*Color,Border,Shadows */
  color: #fff;
  border-radius: 6px;
  background: #2b8a4e;
}

.a4-btn-primary:hover {
  filter: brightness(1.05);
}

/* =========================
   RESPONSIVE TWEAKS
   ========================= */
/* Responsive tweaks */
@media (max-width: 768px) {
  .a4-rowinp {
    /*Alignments*/
    /* stack cards vertically */
    flex-direction: column;
    align-items: stretch;
  }

  /* Button row */
  .a4-rowbut {
    /*Alignments*/
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Margin,Padding,Gaps */
    gap: 1rem;
    width: 100%;
  }

  .a4-rowbut button {
    /*Alignments*/
    flex: 1 1;
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Margin,Padding,Gaps */
    gap: 10px;
    width: 80%;
  }

  .a4-rowoutcap,
  .a4-rowoutrp,
  .a4-rowoutper {
    /*Alignments*/
    display: flex;
    flex-direction: column;
    min-width: 250px;
  }
}