/* =========================
   General Page Styling
   ========================= */
html, body {
  width: 100%;
  overflow-x: hidden; /* ✅ Prevents horizontal scroll */
}




body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #f8f9fb;
  color: #333;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background: #004080;
  color: #fff;
  padding: 15px 30px;
  box-sizing: border-box;
}

header h1 {
  margin: 0;
  font-size: 1.6em;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* =========================
   Navigation
   ========================= */
.topnav {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.topnav a {
  color: #fff;
  padding: 8px 15px;
  text-decoration: none;
  display: inline-block;
}

.topnav a:hover {
  background: #0066cc;
  border-radius: 4px;
}

.dropdown {
  display: inline-block;
  position: relative;
}

.dropdown .dropbtn {
  background: none;
  border: none;
  color: #fff;
  padding: 8px 15px;
  font-size: 1em;
  cursor: pointer;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: #fff;
  min-width: 160px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  z-index: 1;
}

.dropdown-content a {
  color: #333;
  padding: 10px;
  display: block;
  text-decoration: none;
}

.dropdown-content a:hover {
  background: #f1f1f1;
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* =========================
   Container and Content
   ========================= */
.container {
  max-width: 1000px; 
  width: 100%; 
  margin: 30px auto;
  padding: 25px 30px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  flex: 1;
  box-sizing: border-box;
}

.container img,
.container canvas,
.container table {
  max-width: 100%;
  height: auto;
}

h2 {
  margin-top: 0;
  color: #004080;
}

.equation {
  font-family: "Courier New", monospace;
  background: #f4f6f9;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 20px;
  overflow-x: auto; /* allows horizontal scroll only inside equations */
}

/* =========================
   Inputs and Buttons
   ========================= */
.inputs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

label {
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

input {
  padding: 5px;
  margin-left: 10px;
  flex: 1;
  min-width: 0;
}

.btn-row {
  margin: 15px 0;
}

button {
  background: #004080;
  color: #fff;
  border: none;
  padding: 10px 20px;
  margin-right: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
}

button:hover {
  background: #0066cc;
}

/* =========================
   Table Styling
   ========================= */
table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 15px;
  font-size: 0.95em;
  table-layout: auto;
  word-wrap: break-word;
}

table, th, td {
  border: 1px solid #ddd;
}

th {
  background: #004080;
  color: #fff;
}

td, th {
  padding: 8px;
  text-align: center;
}

tbody tr:nth-child(even) {
  background: #f9f9f9;
}

/* =========================
   Canvas & Footer
   ========================= */
canvas {
  margin-top: 25px;
  max-width: 100%;
  height: auto;
  display: block;
}

footer {
  background: #666;
  color: white;
  text-align: center;
  padding: 15px 0;
  border-top: 1px solid #ccc;
  width: 100%;
  margin-top: auto;
  font-size: 0.9em;
  box-sizing: border-box;
}

/* =========================
   Mobile Adjustments
   ========================= */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden; /* ✅ Reinforce no side scroll */
  }

@media (max-width: 768px) {
  .container {
    max-width: 100%;      /* Full width of the screen */
    width: 95%;           /* Small margin from edges */
    margin: 10px auto;    /* Center the container */
    padding: 15px;        /* Smaller padding for mobile */
    box-sizing: border-box; 
  }
}

  header {
    padding: 10px 15px;
    text-align: center;
  }

  header h1 {
    font-size: 1.3em;
  }

  .topnav {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .dropdown-content {
    position: static;
    box-shadow: none;
  }

  .container {
    margin: 10px;
    padding: 15px;
    overflow-x: hidden;
  }

  img, canvas {
    width: 100%;
    height: auto;
  }

  .inputs {
    grid-template-columns: 1fr;
  }

  label {
    flex-direction: column;
    align-items: flex-start;
  }

  input {
    margin: 8px 0 0 0;
    width: 100%;
  }

  button {
    width: 100%;
    margin-bottom: 10px;
  }

  table {
    font-size: 0.85em;
    display: block;
    overflow-x: auto;
  }

  footer {
    font-size: 0.8em;
    padding: 12px 0;
  }
}
