*, *::before, *::after {
  box-sizing: border-box;
}

p {
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
}

.skip-link:focus {
  top: 0;
  left: 0;
  color: white !important;
  background-color: #237bdf;
}

.navbar {
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  background-color: #1a3e68;
  box-shadow: 0 0 5px black;
  top: 0;
  margin-bottom: 0;
  width: 100%;
  z-index: 1000;
}

.navbar-item {
  color: #f0f0f0;
  text-decoration: none;
  padding: 8px 14px 10px;
  margin: 0 5rem 0 5rem;
  font-weight: bold;
  font-size: 1.1rem;
  min-width: 44px;
  min-height: 44px;
  align-content: center;
}

.navbar-item:focus,
.navbar-item:hover {
  color: #f1d787;
  outline: none;
}

h1, h3 {
  margin: 0.25rem 0;
}

body {
  background-color: #f9f4e5;
  font-family: Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
}

.banner-container {
  background-color: rgb(245, 245, 245);
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
  padding-top: 175px; 
}

form, #output-container {
  background: #f5f5f5;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0px 4px 12px rgba(0,0,0,0.3);
  width: 600px;
  min-height: 120px;
  box-sizing: border-box;
  margin-bottom: 3rem;
  overflow-wrap: break-word;
}

/* Initially hide the output container */
#output-container {
  display: none;
}

/* Show the output container when it has the 'visible' class */
#output-container.visible {
  display: block;
}

input[type="text"], textarea {
  font-family: inherit;
  width: 100%;
  padding: 0.5rem;
  border: 2px solid #acacac;
  border-radius: 10px;
  font-size: 1rem;
  min-height: 100px;
}

button {
  background-color: #1a3e68;
  color: #f0f0f0;
  border: none;
  padding: 0.8rem 1.2rem;
  margin-top: 1rem;
  font-size: 1rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
}

button:focus,
button:hover {
  background-color: #235288;
  outline-color: #a0b8d3;
  outline-width: 3px;
}

button:disabled {
  background-color: gray;
  cursor: not-allowed;
  opacity: .7;
}

#output-label {
  font-weight: bold;
  margin-bottom: 0rem;
  margin-top: 0rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

#download-buttons {
  display: flex;
  gap: 0.5rem;
}

#input-label {
  font-weight: bold;
  margin-bottom: 3rem;
  margin-top: 0rem;
}

#output-text {
  font-family: monospace;
  font-size: .95rem;
}

/* Structured results styling */
.result-item {
  margin-bottom: 1.5rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 1rem;
  background-color: #fff;
}

.query-section h3 {
  margin: 0 0 0.5rem 0;
  color: #1a3e68;
  font-size: 1.1rem;
}

.query-details {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.query-type {
  background-color: #e6f3ff;
  padding: 0.3rem 0.6rem;
  border-radius: 15px;
  border: 1px solid #b3d9ff;
}

.match-status {
  padding: 0.3rem 0.6rem;
  border-radius: 15px;
}

.match-status.no-match {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.match-status.exact-match {
  background-color: #d4edda;
  color: #0d3b18;
  border: 1px solid #c3e6cb;
}

.match-status.first-block-match {
  background-color: #fff3cd;
  color: #745903;
  border: 1px solid #ffeaa7;
}

.match-level.exact {
  background-color: #d4edda;
  padding: 0.3rem 0.6rem;
  border-radius: 15px;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.match-level.first-block {
  background-color: #fff3cd;
  padding: 0.3rem 0.6rem;
  border-radius: 15px;
  border: 1px solid #ffeaa7;
  color: #745903;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  padding: 0.5rem;
  border-radius: 5px;
  margin-top: 0.5rem;
  border: 1px solid #f5c6cb;
}

.matches-section h4 {
  margin: 1rem 0 0.5rem 0;
  color: #1a3e68;
}

.match-item {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.match-header {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: #495057;
}

.match-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.match-field {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.match-field label {
  font-weight: bold;
  color: #465766;
  min-width: 120px;
  font-size: 0.85rem;
}

.match-field span {
  flex: 1;
  word-break: break-all;
}

.monospace {
  font-family: 'Courier New', monospace;
  background-color: #ebedf0;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
  min-height: 1.5rem;
  display: flex;
  align-items: center;
}

.small-text {
  font-size: 0.75rem;
}

.result-separator {
  border: none;
  height: 2px;
  background-color: #dee2e6;
  margin: 1.5rem 0;
}

.download-btn {
  background-color: #1a3e68;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1.0rem;
  margin: 0px 15px 0px 0px;
}

.download-btn:hover {
  background-color: #235288;
}

*:focus {
  outline: 2px solid #36679e;
  outline-offset: -1px;
}

/* Responsive design for mobile devices */
@media (max-width: 768px) {
  .banner-container {
    padding: 80px 10px 0 10px; /* Reduced spacing for thinner navbar */
  }
  
  form, #output-container {
    width: calc(100vw - 40px);
    max-width: 600px;
    margin-left: 10px;
    margin-right: 10px;
  }
  
  .navbar {
    padding: 6px 8px;
    /* Keep flex-direction: row (default) for horizontal layout */
  }
  
  .navbar-item {
    margin: 0 0.8rem;
    padding: 6px 10px;
    font-size: 0.85rem;
  }
  
  .query-details {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .match-field {
    flex-direction: column;
    gap: 0.2rem;
  }
  
  .match-field label {
    min-width: auto;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .banner-container {
    padding: 70px 5px 0 5px; /* Further reduced for mobile */
  }
  
  form, #output-container {
    width: calc(100vw - 30px);
    padding: 1rem;
  }
  
  .navbar {
    padding: 4px 6px;
    /* Keep horizontal layout */
  }
  
  .navbar-item {
    margin: 0 0.4rem;
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  
  .result-item {
    padding: 0.75rem;
  }
  
  .match-item {
    padding: 0.5rem;
  }
  
  .monospace {
    font-size: 0.75rem;
    padding: 0.1rem 0.3rem;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  #download-buttons {
    width: 100%;
    flex-wrap: wrap;
  }

  .download-btn {
    flex: 1;
    min-width: 120px;
  }
}
