/* General body styles */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: auto;
  background-color: #f4f4f4;
  margin: 0;
  font-family: 'Arial', sans-serif;
}

/* Container styles */
.container {
  --main-color: #323232;
  --font-color: #323232;
  --font-color-sub: #666;
  --bg-color: #fff;
  --shadow-color: rgba(0, 0, 0, 0.2);
  margin-top: 30px;
  width: 80%;
  max-width: 320px;
  padding: 20px;
  background-color: var(--bg-color);
  border-radius: 10px;
  box-shadow: 6px 6px var(--main-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#parserTable {
  margin-top: 30px;
  width: 100%;
  max-width: 600px;
  border: 2px solid #323232; /* Border around the entire table container */
  border-radius: 10px;
  background-color: #fff;
  padding: 10px;
  box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
}

#parserTable h2 {
  text-align: center;
  font-size: 20px;
  color: #323232;
  margin-bottom: 10px;
}

#parseTable {
  width: 100%;
  border-collapse: collapse; /* Ensures that borders are not doubled */
}

#parseTable thead {
  background-color: #f4f4f4;
}

#parseTable th,
#parseTable td {
  border: 1px solid #323232; /* Border for each cell */
  padding: 8px;
  text-align: left;
  font-size: 14px;
}

#parseTable th {
  font-weight: bold;
  text-transform: uppercase;
  color: #323232;
}

#parseTable tbody tr:nth-child(even) {
  background-color: #f9f9f9; /* Alternating row background color */
}

#parseTable tbody tr:hover {
  background-color: #e0e0e0; /* Highlight row on hover */
}

/* Heading styles */
h2 {
  text-align: center;
  font-size: 25px;
  font-weight: bold;
  color: var(--main-color);
  margin: 0;
}

/* Production row styles */
.production-row {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
}

.production-row input[type="text"] {
  height: 40px;
  padding: 5px 10px;
  border: 2px solid var(--main-color);
  border-radius: 5px;
  font-size: 16px;
  color: var(--font-color);
  background-color: var(--bg-color);
  box-shadow: 4px 4px var(--main-color);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.production-row input[type="text"]:focus {
  border-color: #2d8cf0;
}

.non-terminal {
  width: 20%;
  /* Non-terminal input takes up 20% */
}

.production-rule {
  width: 80%;
  /* Production rule input takes up 80% */
}

.arrow {
  font-size: 24px;
  margin: 0 10px;
}

/* Input boxes */
.input-box,
.result-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 95%;
}

/* Label styling */
label {
  font-weight: bold;
  font-size: 14px;
  color: var(--font-color);
}

/* Button styles */
button {
  width: auto;
  /* Button width is now based on text inside it */
  padding: 10px 20px;
  /* Added padding for better spacing */
  border: 2px solid #000;
  margin-right: 2px;
  margin-bottom: 300px;
  border-radius: 5px;
  background-color: #f9f9f9;
  box-shadow: 4px 4px #000;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
}

button:active {
  box-shadow: 0 0 #000;
  transform: translate(2px, 2px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  /* Increased gap between buttons */
  justify-content: center;
}

.actions button {
  width: auto;
  /* Width based on text content */
}

button.okay {
  background-color: #108317;
  color: #fff;
}

button.random {
  background-color: yellow;
  color: #000;
}

button.clear {
  background-color: #f44336;
  color: #fff;
}

/* Result box styling */
#results {
  margin-top: -250px;
  width: 96%;
  border: 2px solid var(--main-color);
  border-radius: 5px;
  background-color: var(--bg-color);
  box-shadow: 4px 4px var(--main-color);
  color: var(--font-color);
  font-size: 14px;
  min-height: 50px;
}

#parserTable {
  width: 96%;
  border: 2px solid var(--main-color);
  border-radius: 5px;
  background-color: var(--bg-color);
  box-shadow: 4px 4px var(--main-color);
  color: var(--font-color);
  font-size: 14px;
  min-height: 50px;
}

/* Theory container styles */
#theory{
  width: 80%;
  max-width: 320px;
  padding: 20px;
  background-color: var(--bg-color);
  border-radius: 10px;
  box-shadow: 6px 6px var(--main-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#firstResults, #followResults{
  text-align: center;
}

.theory-container h2 {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  color: var(--main-color);
}

.theory-container ul {
  padding-left: 20px;
}

.theory-container ul li {
  font-size: 16px;
  line-height: 1.5;
}

/* Media Queries for responsiveness */
@media (max-width: 500px) {
  button {
    width: auto;
    /* Adjust width according to text */
    height: 45px;
    font-size: 16px;
  }

  .container {
    width: 95%;
  }

  .theory-container {
    width: 95%;
  }
}

/* Footer styles */
footer {
  text-align: center;
  padding: 15px;
  margin-bottom: 10px;
  font-family: 'Arial', sans-serif;
  width: 35%;
  height: 1px;
  border: 2px solid #000;
  border-radius: 5px;
  background-color: #f9f9f9;
  box-shadow: 4px 4px #000;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

footer p {
  margin: 0;
  font-size: 14px;
}

footer a {
  color: #000;
  text-decoration: none;
}