/* Cache Simulator Stylesheet */

* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 20px;
  background-color: #f5f5f5;
}

h1 {
  text-align: center;
  color: #333;
}

/* Remove floats and use flexbox for main layout */
.app-layout {
  display: grid;
  grid-template-columns: 330px 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

/* System Parameters - left column, full height */
.app-layout > div:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / 4;
  max-width: 100%;
}

#pFieldset {
  width: 100%;
}

/* Manual Memory Access - top middle */
#memory-access {
  grid-column: 2;
  grid-row: 1;
}

/* Simulation Messages - top right, next to Manual Memory Access */
.app-layout > div:nth-child(3) {
  grid-column: 3;
  grid-row: 1;
}

/* History - bottom left */
#history {
  grid-column: 1;
  grid-row: 4;
  max-width: 100%;
}

#history fieldset {
  width: 100%;
}

/* Canvas - bottom spanning columns 2-3 */
#p5canvas {
  grid-column: 2 / 4;
  grid-row: 2 / 5;
  min-height: 400px;
}

fieldset {
  background-color: #ffffff;
  border: 1px solid #d1dce5;
  border-radius: 8px;
  padding: 15px;
  height: 100%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

legend {
  padding: 0 10px;
  font-weight: normal;
  color: #34495e;
  font-size: 15px;
}

/* Add minimum height to Manual Memory Access */
#memory-access fieldset {
  min-height: 280px;
}

table {
  width: 100%;
  margin: 10px 0;
}

td {
  padding: 8px 5px;
  vertical-align: middle;
}

/* Manual Memory Access specific styling */
#memory-access fieldset {
  padding: 20px;
}

#memory-access label {
  font-weight: 500;
  margin-right: 5px;
  color: #333;
}

/* Access controls table */
.access-controls {
  width: 100%;
  border-spacing: 0;
  margin-bottom: 20px;
}

.access-controls td {
  padding: 8px 5px;
}

.access-controls .button-cell {
  width: 100px;
  text-align: left;
}

.access-controls .input-cell {
  padding-left: 10px;
}

.access-controls input[type="submit"] {
  width: 75px;
  padding: 6px 8px;
  font-weight: normal;
}

.access-controls input[type="text"] {
  width: 60px;
  text-align: center;
  font-family: monospace;
  font-size: 14px;
}

.access-controls input[type="text"]::placeholder {
  color: #999;
}

/* Status table (Tag/Index/Offset) */
.status-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.status-table td {
  border: 1px solid #999;
  text-align: center;
  padding: 10px 5px;
  font-size: 14px;
}

.status-table tr:first-child td {
  background-color: #d0d0d0;
  font-weight: bold;
  border: 1px solid #999;
}

.status-table tr:nth-child(2) td {
  font-family: monospace;
  font-size: 15px;
}

input[type="text"] {
  border: 1px solid #d1dce5;
  padding: 4px 6px;
  border-radius: 4px;
  transition: border-color 0.3s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

input[type="submit"] {
  background-color: #5a67d8;
  color: white;
  border: none;
  padding: 6px 12px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 13px;
  margin: 3px 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

input[type="submit"]:hover {
  background-color: #4c51bf;
}

input[type="submit"]:active {
  background-color: #434190;
}

select {
  padding: 4px;
  border: 1px solid #d1dce5;
  border-radius: 4px;
  background-color: #ffffff;
  transition: border-color 0.3s ease;
}

select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

textarea {
  width: 100%;
  border: 1px solid #d1dce5;
  border-radius: 4px;
  padding: 8px;
  font-family: 'Consolas', 'Monaco', monospace;
  resize: vertical;
  background-color: #f8f9fa;
  transition: border-color 0.3s ease;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
  background-color: #ffffff;
}

.center-buttons {
  text-align: center;
  margin-top: 10px;
}

/* History buttons - uniform sizing */
#history input[type="submit"] {
  margin: 3px 2px;
  font-size: 13px;
  line-height: 1;
  height: 29px;
  vertical-align: middle;
}

#loadHist {
  padding: 6px 14px;
}

#upButton, #dnButton {
  width: 40px;
  padding: 6px 2px;
}

/* Zebra striping for tables */
.zebra tr:nth-child(even) {
  background-color: #f9f9f9;
}
