.marksheet-wrapper {
  padding: 32px;
  font-family: 'Segoe UI', sans-serif;
  background-color: #fff;
  color: #222;
  max-width: 900px;
  margin: 20px auto;
}

.marksheet-buttons {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
  gap: 12px;
}

.marksheet-buttons button {
  padding: 10px 16px;
  background-color: black;
  color: white;
  border: none;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.marksheet-buttons button:hover {
  background-color: #0056b3;
}

.marksheet-container {
  width: 794px;
  min-height: 1123px;
  padding: 24px;
  margin: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.marksheet-header {
  text-align: center;
  margin-bottom: 24px;
  padding: 15px;
  background-color: #fff;
  border: 1px solid #d0d0d0;
}

.marksheet-header h1 {
  margin: 0;
  font-size: 28px;
  color: #2c3e50;
  font-weight: bold;
}

.marksheet-header p {
  margin: 4px 0;
  font-size: 14px;
  color: #7f8c8d;
}

.marksheet-header h2 {
  margin-top: 12px;
  font-size: 20px;
  color: #34495e;
  text-decoration: underline;
}

.student-info {
  margin-bottom: 24px;
  font-size: 16px;
  line-height: 1.8;
  padding: 15px;
  background-color: #fff;
  border: 1px solid #d0d0d0;
}

.marks-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background-color: #fff;
  border: 1px solid #d0d0d0;
}

.marks-table th,
.marks-table td {
  border: 1px solid #d0d0d0;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  color: #333333;
}

.marks-table th {
  background-color: #999;
  color: #ffffff;
  font-weight: bold;
}

.marks-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.footer-section {
  font-size: 16px;
  line-height: 1.6;
  padding-top: 16px;
  border-top: 1px dashed #999;
  padding: 15px;
  background-color: #fff;
  border: 1px solid #d0d0d0;
}

/* Enhanced Responsive Design */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
  .marksheet-wrapper {
    padding: 24px;
    margin: 16px auto;
  }
  
  .marksheet-container {
    max-width: 100%;
  }
}

/* Tablets */
@media (max-width: 850px) {
  .marksheet-wrapper {
    padding: 20px;
  }
  
  .marksheet-container {
    width: 100%;
    min-height: auto;
    padding: 20px;
    margin: 0;
  }
  
  .marksheet-header h1 {
    font-size: 24px;
  }
  
  .marksheet-header h2 {
    font-size: 18px;
  }
  
  .student-info {
    font-size: 15px;
  }
}

/* Small tablets */
@media (max-width: 768px) {
  .marksheet-wrapper {
    padding: 16px;
  }
  
  .marksheet-container {
    padding: 16px;
    border-radius: 4px;
  }
  
  .marksheet-buttons {
    flex-wrap: wrap;
  }
  
  .marks-table th,
  .marks-table td {
    padding: 8px 6px;
    font-size: 13px;
  }
  
  /* Make table responsive with horizontal scroll */
  .marks-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Mobile devices */
@media (max-width: 600px) {
  .marksheet-wrapper {
    padding: 12px;
    margin: 8px auto;
  }
  
  .marksheet-container {
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .marksheet-buttons {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
  }

  .marksheet-buttons button {
    width: auto;
    padding: 8px 12px;
    font-size: 12px;
    min-width: 80px;
  }

  .marksheet-header {
    padding: 12px;
    margin-bottom: 16px;
  }

  .marksheet-header h1 {
    font-size: 20px;
    line-height: 1.2;
  }

  .marksheet-header h2 {
    font-size: 16px;
  }

  .marksheet-header p {
    font-size: 13px;
  }

  .student-info {
    font-size: 14px;
    line-height: 1.6;
    padding: 12px;
    margin-bottom: 16px;
  }

  .marks-table {
    font-size: 12px;
    margin-bottom: 16px;
  }

  .marks-table th,
  .marks-table td {
    padding: 6px 4px;
    font-size: 12px;
  }
  
  .footer-section {
    padding: 12px;
    font-size: 14px;
  }
}

/* Very small mobile devices */
@media (max-width: 400px) {
  .marksheet-wrapper {
    padding: 8px;
  }
  
  .marksheet-container {
    padding: 8px;
  }

  .marksheet-buttons button {
    padding: 6px 10px;
    font-size: 11px;
    min-width: 70px;
  }

  .marksheet-header h1 {
    font-size: 18px;
  }

  .marksheet-header h2 {
    font-size: 15px;
  }
  
  .marksheet-header p {
    font-size: 12px;
  }

  .student-info {
    font-size: 13px;
    padding: 10px;
  }

  .marks-table th,
  .marks-table td {
    padding: 4px 2px;
    font-size: 11px;
  }

  .footer-section {
    font-size: 13px;
    padding: 10px;
  }
}

/* Extra small devices */
@media (max-width: 320px) {
  .marksheet-buttons button {
    padding: 5px 8px;
    font-size: 10px;
    min-width: 60px;
    margin: 0 10px;
  }

  .marksheet-header h1 {
    font-size: 16px;
  }
  
  .marks-table th,
  .marks-table td {
    padding: 3px 1px;
    font-size: 10px;
  }
}

/* Print styles */
@media print {
  .marksheet-buttons {
    display: none !important;
  }

  .marksheet-wrapper {
    padding: 0;
    margin: 0;
    max-width: none;
  }

  .marksheet-container {
    box-shadow: none;
    border: none;
    width: 100%;
    padding: 0;
    margin: 0;
    background-color: white;
    border-radius: 0;
  }

  .marksheet-header,
  .student-info,
  .marks-table,
  .footer-section {
    border: 1px solid #000 !important;
    background-color: white !important;
  }

  .marks-table th {
    background-color: #f0f0f0 !important;
    color: #000 !important;
  }

  body {
    margin: 0;
    padding: 0;
  }
  
  /* Ensure table fits on printed page */
  .marks-table {
    page-break-inside: avoid;
  }
}

/* Landscape orientation adjustments for mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .marksheet-wrapper {
    padding: 12px;
  }
  
  .marksheet-container {
    padding: 12px;
  }
  
  .marksheet-header h1 {
    font-size: 22px;
  }
}
/* Target the second table (Co-Scholastic) */
.marksheet-container > .container.table-responsive.py-5:last-of-type {
  overflow-x: auto; /* horizontal scroll on small screens */
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  padding: 0; /* remove extra padding from py-5 */
}

/* Make the second table take full width and scale nicely */
.marksheet-container > .container.table-responsive.py-5:last-of-type .table {
  width: 100%;
  min-width: 300px; /* prevents it from being too small on mobile */
  border-collapse: collapse;
}

/* Table cells adjustments for mobile */
@media (max-width: 600px) {
  .marksheet-container > .container.table-responsive.py-5:last-of-type .table td {
    padding: 4px 6px;
    font-size: 12px;
    text-align: left;
  }

  .marksheet-container > .container.table-responsive.py-5:last-of-type h3 {
    font-size: 14px;
    padding: 3px 6px;
  }
}
