/* =========================
   IP + CIDR FORM
========================= */
.wrap {
  display: grid;
  place-items: center;
  margin: 2rem 0;
  overflow-x: auto;
  
}

.panel {
  width: min(900px, 95vw);

  /* CHANGED: Background color from var(--panel) to #dcdedf */
  background: #dcdedf; /* Light gray */
 /* backdrop-filter: blur(6px);*

  /* CHANGED: Solid border 1.5px */
  border: 2px solid var(--edge);

  border-radius: 0.20rem;
  box-shadow: var(--shadow);
  padding: 22px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.segments {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 12px;

  /* CHANGED: Background color from #fff to #dcdedf */
  background: #dcdedf;

  /* CHANGED: Solid border 1.5px */
  border: 1.5px solid #c6c6c9; 

  border-radius: 0.20rem;
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 82%;
}

.segments:focus-within {
  border-color: var(--blue); /* keep blue on focus */
  box-shadow: 0 0 0 0.5px var(--blue);
}

.seg {
  width: 20rem;
  text-align: center;
  padding: 10px 8px;
  font-size: 1.08rem;
  font-weight: 600;

  /* CHANGED: Background color from default to #dcdedf */
  background: #dcdedf;

  /* CHANGED: Solid border 1.5px */
  border: 1.5px solid #c6c6c9; 

  border-radius: 0.20rem;
  outline: 0;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.seg:focus {
  border-color: var(--blue); /* keep blue focus */
  box-shadow: 0 0 0 0.5px var(--blue);
}



.dot, .slash {
  width: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  user-select: none;
}

.cidr-seg {
  width: 190px;
  text-align: center;
  padding: 11px 10px;
  font-size: 1.05rem;
  font-weight: 600;

  /* CHANGED: Background color */
  background: #dcdedf;

  /* CHANGED: Solid border 1.5px */
  border: 1.5px solid #c6c6c9; 

  border-radius: 0.20rem;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.cidr-seg:focus {
  border-color: var(--blue); /* keep blue focus */
  box-shadow: 0 0 0 0.5px var(--blue);
}

.hosts-seg {
  width: 100px;
  text-align: center;
  padding: 11px 10px;
  font-size: 1.05rem;
  font-weight: 600;

  /* CHANGED: Background color */
  background: #dcdedf;

  /* CHANGED: Solid border 1.5px */
  border: 1.5px solid #c6c6c9; 

  border-radius: 0.20rem;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.hosts-seg:focus {
  border-color: var(--blue); /* keep blue focus */
  box-shadow: 0 0 0 0.5px var(--blue);
}


.seg.input-error,
.cidr-seg.input-error, 
.hosts-seg.input-error {
    border-color: #e53935 !important;
    box-shadow: 0 0 0 1.5px #e53935 !important;
}
.error-message {
    flex-basis: 100%;
    width: 100%;
    display: block;
    color: #e53935;
    font-size: 0.9rem;
    margin-top: 0.2em;
    /* No display:flex! Let divs stack naturally. */
}


.btn {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  margin-left: auto; /* push to right */
  border: 0;
  border-radius: 0.20rem;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37,99,235,.35);
  transition: background 0.3s ease;
}

.btn:hover {
  background: linear-gradient(180deg, #2563eb, #1e40af);
}

.table-button-container {
  display: flex;
  justify-content: flex-end; /* align button to the right */
  margin-right: 2.1rem; /* space from right edge */
  margin-top: 3.5rem; /* space from top */
  margin-bottom: 0; /* space between button and table */
}

.btn-export {
 background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  border: 0;
  border-radius: 0.20rem;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37,99,235,.35);
  transition: background 0.3s ease;
  
}
.btn-export:hover {
  background: linear-gradient(180deg, #2563eb, #1e40af);
}

.hint {
  margin-top: 10px;
  color: #475569;
  font-size: 0.92rem;
}

/* =========================
   RESPONSIVE FORM STYLES
========================= */

/* Tablets (768px and down) */
@media (max-width: 768px) {
  .panel {
    width: min(600px, 95vw);
    padding: 18px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .segments {
    width: 100%;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
  }
  
  .seg {
    width: 100%;
    max-width: 300px;
    align-self: center;
  }
  
  .cidr-seg {
    width: 100%;
    max-width: 200px;
    align-self: center;
  }
  
  .hosts-seg {
    width: 100%;
    max-width: 150px;
    align-self: center;
  }
  
  .btn {
    width: 100%;
    max-width: 200px;
    align-self: center;
    margin-left: 0; /* reset margin-left to center button */
  }
  
  .table-button-container {
    justify-content: center;
    margin-right: 0;
    margin-top: 2rem;
  }
}

/* Mobile phones (480px and down) */
@media (max-width: 480px) {
  .wrap {
    margin: 1rem 0;
  }
  
  .panel {
    width: min(350px, 95vw);
    padding: 15px;
  }
  
  .segments {
    padding: 12px;
    gap: 10px;
  }
  
  .seg,
  .cidr-seg,
  .hosts-seg {
    padding: 12px 8px;
    font-size: 1rem;
    width: 100%;
    max-width: none;
  }
  
  .btn{
    padding: 12px 14px;
    font-size: 0.95rem;
    width: 100%;
    margin-left: 0;
  }

  
  .btn-export {
    padding: 12px 14px;
    font-size: 0.95rem;
    width: 100%;
    max-width: 200px;
    margin-left: 0;
  }
  
  .hint {
    font-size: 0.85rem;
    text-align: center;
  }
  
  .table-button-container {
    margin-top: 1.5rem;
  }
}

/* Extra small phones (360px and down) */
@media (max-width: 360px) {
  .panel {
    width: min(320px, 95vw);
    padding: 12px;
  }
  
  .segments {
    padding: 10px;
  }
  
  .seg,
  .cidr-seg,
  .hosts-seg {
    font-size: 0.95rem;
    padding: 10px 6px;
  }
  
  .hint {
    font-size: 0.8rem;
  }
}