/* Variables for easy color management */
:root {
  --primary-blue: #3b82f6; /* Used for accents and main button */
  --light-blue: #eff6ff; /* Background for instructions */
  --dark-gray: #1f2937; /* Main text color */
  --light-gray-bg: #f9fafb; /* Body and input card background */
  --border-gray: #d1d5db; /* Input borders */
}

/* Base styles */
body {
  font-family: "Inter", sans-serif;
  background-color: var(--light-gray-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Navigation Bar */
nav {
  background-color: white;
  padding: 16px 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid var(--border-gray);
  width: 100%;
  box-sizing: border-box;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark-gray);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  font-size: 1rem;
  color: var(--dark-gray);
  text-decoration: none;
  font-weight: 500;
  transition: color 150ms ease-in-out;
}

.nav-links a:hover {
  color: var(--primary-blue);
}

/* Main Content Wrapper */
.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Main App Container */
#app {
  width: 100%;
  max-width: 500px;
  background-color: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
}

/* Title and Separator */
h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark-gray);
  margin-bottom: 8px;
}

hr {
  border: none;
  border-top: 4px solid var(--primary-blue);
  width: 25%;
  margin-bottom: 24px;
}

/* Instructions Box */
#instructions {
  margin-bottom: 32px;
  padding: 16px;
  background-color: var(--light-blue);
  border-left: 4px solid var(--primary-blue);
  border-radius: 8px;
  font-size: 0.875rem;
  color: #4b5563;
}

.instructions-content {
  display: flex;
  align-items: flex-start;
}

.instructions-icon {
  width: 20px;
  height: 20px;
  color: var(--primary-blue);
  margin-right: 12px;
  font-size: 1.25rem;
  line-height: 1;
}

/* Conversion Inputs Layout (Responsive) */
.conversion-inputs {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}
@media (min-width: 640px) {
  .conversion-inputs {
    flex-direction: row;
  }
}

/* Input and Output Cards */
.input-card,
.output-card {
  flex: 1 1 0%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid;
}

/* Input Card Styling */
.input-card {
  background-color: var(--light-gray-bg);
  border-color: #e5e7eb;
}

/* Output Card Styling */
.output-card {
  background-color: #e0f2fe; /* light blue background */
  border-color: #93c5fd;
}

/* Labels */
label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.input-card label {
  color: #6b7280;
}
.output-card label {
  color: #1d4ed8;
}

.label-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  font-size: 1rem;
}

/* Input and Select Fields */
input[type="number"],
select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-gray);
  border-radius: 8px;
  font-size: 1.125rem;
  transition: border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;
  box-sizing: border-box;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

select {
  margin-top: 12px;
  background-color: white;
  font-size: 1rem;
  appearance: none;
}

/* Output Display */
#valueOutput {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background-color: #f0f9ff;
  border: 1px solid #60a5fa;
  border-radius: 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e40af;
}

/* Submit Button */
#convertButton {
  width: 100%;
  padding: 16px;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  background-color: var(--primary-blue);
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.5);
  transition: background-color 300ms, transform 300ms, box-shadow 300ms;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

#convertButton:hover {
  background-color: #2563eb;
}

#convertButton:active {
  transform: scale(0.98);
}

.button-icon {
  width: 24px;
  height: 24px;
  margin-right: 8px;
  font-size: 1.5rem;
}

/* Message Box (Static UI element only) */
#messageBox {
  position: fixed;
  inset: 0;
  background-color: rgba(31, 41, 55, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

#messageBox > div {
  background-color: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 384px;
  width: 100%;
}

#messageBox h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #dc2626;
}

#messageBox p {
  margin-bottom: 16px;
  color: #374151;
}

#messageBox button {
  width: 100%;
  padding: 8px 16px;
  background-color: #ef4444;
  color: white;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background-color 300ms;
}

#messageBox button:hover {
  background-color: #dc2626;
}

/* Footer */
footer {
  background-color: white;
  padding: 16px 20px;
  border-top: 1px solid var(--border-gray);
  width: 100%;
  box-sizing: border-box;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-text {
  font-size: 0.875rem;
  color: var(--dark-gray);
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--primary-blue);
  text-decoration: none;
  margin-left: 16px;
  transition: color 150ms ease-in-out;
}

.footer-links a:hover {
  color: #2563eb;
}

/* Utility for strong text */
strong {
  font-weight: 600;
}

/* ======================================= */
/* === MEDIA QUERIES (Responsiveness) === */
/* ======================================= */

/* Mobile Adjustments (Below 640px) */
@media (max-width: 639px) {
  /* Navigation */
  .nav-links {
    display: none; /* Hide desktop links */
  }
  .nav-hamburger {
    display: block; /* Show hamburger icon */
  }
  .nav-container {
    padding: 0 10px; /* Tighter padding for mobile nav */
  }

  /* Main Content */
  .main-content {
    padding: 10px;
  }

  /* App Card */
  #app {
    padding: 20px;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  /* Conversion Layout */
  /* Already handled by default: .conversion-inputs { flex-direction: column; } */

  /* Footer */
  .footer-container {
    flex-direction: column;
    gap: 8px;
  }
  .footer-text,
  .footer-links {
    text-align: center;
  }
  .footer-links a {
    margin: 0 4px;
  }
}

/* Desktop/Tablet Adjustments (640px and above) */
@media (min-width: 640px) {
  .footer-container {
    flex-direction: row;
  }
  .footer-text {
    width: auto;
    text-align: left;
  }
  .footer-links {
    width: auto;
    text-align: right;
  }
}
