/* Tool Card */
.unit-container {
  max-width: 580px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--card); 
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  color: var(--text); 
}

.unit-container:hover {
  transform: translateY(-1px);
  opacity: 1;
}

.unit-container h1 {
  font-size: 2rem;
  font-weight: 850;
  margin: .4rem 0 0.5rem;
  text-align: center;
  color: var(--text);
}

.unit-container p {
  font-size: 1rem;
  text-align: center;
  color: var(--soft);
}

/* Input fields */
.input-field {
  font-size: 1rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  transition: all 0.2s ease;
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}

.output-field{
  font-size: 1.1rem;
  height: 3rem;
  box-shadow: 0 0 0 3px var(--border);
}

.search-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-wrapper .input-field {
  padding-left: 2.5rem; 
  box-shadow: 0 0 0 3px var(--border);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--soft);
  pointer-events: none; 
}

/* Rows */
.row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.row > div {
  flex: 1;
}

/* Swap */
.swap-wrapper {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}
.swap-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  padding: 0.75rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}
.swap-btn:hover {
  transform: rotate(180deg);
}
.swap-btn .icon {
  width: 20px;
  height: 20px;
}

/* Result */
.result-wrapper {
  font-size: 1rem;
  position: relative;
}

#outputValue {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 600;
  color: var(--text);
}

.copy-btn {
  position: absolute;
  right: 0.5rem;
  top: 40%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  color: var(--soft);
}

.copy-btn:hover {
  background: rgba(0,0,0,0.05);
}

.icon {
  width: 30px;
  height: 30px;
}

.icon.success {
  color: #22c55e;
}

/* Status */
.status-message {
  text-align: center;
  min-height: 1.5rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--soft);
}

/* Action Button */
#showTableButton {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  width: 100%;
}

#showTableButton:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; }
.modal-overlay { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: rgba(0,0,0,0.4); }
.modal-card {
  background: var(--card);
  border-radius: 1.5rem;
  padding: 2rem;
  width: 100%;
  max-width: 700px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  position: relative;
}
.modal-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 1rem;
}
.hidden {
  display: none;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--soft);
}
.close-btn:hover { color: var(--text); }



/* =========================
   MOBILE ENHANCEMENTS 
   ========================= */
@media (max-width: 520px) {

  .unit-container {
    max-width: none !important; 
    width: 98% !important;
    padding: 1.4rem !important;
    margin: 1rem auto 1rem !important;
    border-radius: 12px !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1) !important;
  }

  /* Headings & Text */
  .unit-container h1 {
    font-size: 1.55rem !important;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.3 !important;
    text-align: center !important;
  }

  .unit-container p {
    font-size: 0.92rem !important;
    font-weight: 500;
    line-height: 1.55 !important;
    text-align: center !important;
    margin-bottom: 1rem !important;
  }

  /* Inputs & Labels */
  ..unit-container  input {
    padding: 0.75rem 0.85rem !important;
    font-size: 0.96rem !important;
    border-radius: 8px !important;
    min-height: 46px !important;
    appearance: none;
  }

  .unit-container label {
    font-size: 0.88rem !important;
    font-weight: 800;
  }

  .unit-card {
    width: 100% !important;
    background: var(--muted);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  }

  .search-wrapper .input-field {
    padding-left: 2.5rem; 
    box-shadow: 0 0 0 3px var(--ring);
  }

  input:focus, select:focus, button:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
  }

.output-field{
  box-shadow: 0 0 0 3px var(--ring);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto; 
  -webkit-overflow-scrolling: touch;
}

  /* Overlay (dims background) */
  .modal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem; 
    box-sizing: border-box;
  }

  /* Modal card (main container) */
  .modal-card {
    background: var(--card);
    border-radius: 1.5rem;
    padding: 2rem;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: auto;              
    max-height: 90vh;            
    box-sizing: border-box;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform: translateY(0);
  }

  /* Title */
  .modal-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    margin-bottom: 1rem;
  }

  /* Hidden state */
  .hidden {
    display: none;
  }

  /* Close button */
  .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--soft);
    font-size: 1.25rem;
    line-height: 1;
    z-index: 10;
  }

  .close-btn:hover {
    color: var(--text);
  }

}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 0.5rem;
    
  }

  .modal-card {
    width: 95%;
    padding: 1.25rem 1rem;
    border-radius: 1rem;
    margin-top: 2rem;
    max-height: 90vh; 
  }

  .modal-card h2 {
    font-size: 1.25rem;
  }

  .close-btn {
    top: 0.5rem;
    right: 0.75rem;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .modal-card {
    width: 100%;
    max-width: none;
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem auto;
  }

  .modal-card h2 {
    font-size: 1.1rem;
  }
}

