/* Responsive Navigation Bar */
nav1 {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 1200px;
}

nav1 a1 {
  color: var(--text-gray);
  text-decoration: none;
  font-weight: bold;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  padding-bottom: 4px;
  transition: color 0.2s, border-bottom 0.2s;
}

nav1 a.active1 {
  color: var(--accent-yellow);
  border-bottom: 3px solid var(--accent-yellow);
}

/* Cards & Responsive Containers */
.container12 {
  background-color: var(--card-bg);
  padding: clamp(1.25rem, 4vw, 2rem);
  border-radius: 8px;
  width: 100%;
  max-width: 650px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.dashboard-container {
  max-width: 1200px;
}

h2 {
  color: var(--accent-yellow);
  margin-bottom: 1.25rem;
  text-align: center;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

/* Responsive Form Control Elements */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-gray);
  font-size: 0.9rem;
  font-weight: 600;
}

input, textarea {
  width: 100%;
  padding: 0.75rem;
  background-color: #fafafa;
  border: 1px solid #8080804a;
  color: var(--text-dark);
  border-radius: 4px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-yellow);
}

.btn1 {
  width: 100%;
  padding: 0.75rem 1.25rem;
  background-color: var(--accent-yellow);
  color: #ffffff;
  border: none;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, transform 0.1s;
}

.btn1:hover {
  background-color: var(--accent-yellow-hover);
}

.btn1:active {
  transform: scale(0.99);
}

/* Modal Responsive Overlay & Card */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgb(0 0 0 / 73%);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: #ffffff;
  padding: clamp(1.25rem, 4vw, 2rem);
  border-radius: 8px;
  width: 100%;
  max-width: 550px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--text-gray);
  line-height: 1;
}

.close-btn:hover {
  color: var(--text-dark);
}

/* Responsive Table Dashboard Layout */
.table-responsive {
  width: 100%;
  max-width: 1200px;
  overflow-x: auto;
  margin-top: 1.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 750px; /* Guarantees table readability on small viewports */
}

th, td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border: 1px solid var(--border-color);
  font-size: 0.875rem;
  white-space: nowrap;
}

th {
  background-color: var(--accent-yellow);
  color: #ffffff;
  font-weight: 600;
  position: sticky;
  top: 0;
}

tr:nth-child(even) {
  background-color: #f9f9f9;
}

.table-input {
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 100%;
  min-width: 120px;
  font-size: 0.85rem;
}

.save-btn {
  padding: 0.35rem 0.75rem;
  background: var(--accent-yellow);
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-weight: 600;
}

.save-btn:hover {
  background-color: var(--accent-yellow-hover);
}

/* Mobile Devices Optimization (< 600px) */
@media (max-width: 600px) {
  body {
    padding: 0.5rem;
  }

  nav {
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .container {
    padding: 1rem;
  }

  .modal-content {
    padding: 1rem;
  }

  /* Optimize table cell padding for smaller viewports */
  th, td {
    padding: 0.5rem 0.6rem;
  }
}