* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 10px;
  background: #efefef;
  font-family: Arial, sans-serif;
  overflow-x: hidden;
  color: #111;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
}

.instruction-box{
  max-width:860px;
  margin:0 auto 15px auto;
  background:#ffffff;
  border:1px solid #d8d8d8;
  border-left:5px solid #218838;
  padding:14px;
  border-radius:6px;
  font-size:14px;
  line-height:1.7;
  font-weight:700;
}

.instruction-box h3{
  margin:0 0 8px 0;
  color:#167d2f;
  font-size:18px;
}

.instruction-box span{
  color:#c00000;
  font-weight:900;
}

.search-box {
  text-align: center;
  margin-bottom: 14px;
}

.search-box input {
  padding: 11px;
  width: 260px;
  max-width: 92%;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 700;
  color: #000;
}

.search-box button {
  padding: 11px 18px;
  background: #218838;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  margin-top: 8px;
}

.year-selector {
  text-align: center;
  margin-bottom: 20px;
}

.year-selector label {
  font-weight: 700;
  color: #1f5e46;
  margin-right: 12px;
  font-size: 1rem;
}

.year-selector select {
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 30px;
  border: 1px solid #bbb;
  background: #fff;
  cursor: pointer;
  outline: none;
  width: 320px;
  max-width: 95%;
}

#output {
  max-width: 860px;
  margin: auto;
  overflow-x: hidden;
}

.result-container {
  background: #fff;
  border: 1px solid #cfcfcf;
  border-radius: 5px;
  overflow: hidden;
  width: 100%;
}

.college-header {
  text-align: center;
  padding: 10px 8px;
  border-bottom: 1px solid #ddd;
}

.college-header img {
  width: 85px;
  max-width: 100%;
}

.college-title {
  font-size: 26px;
  font-weight: 900;
  color: #167d2f;
  line-height: 1.3;
  margin-top: 5px;
}

.college-sub {
  font-size: 14px;
  color: #333;
  font-weight: 700;
}

/* FIXED: result-title text color white with important */
.result-title {
  background: #4cae4f;
  color: #ffffff !important;
  text-align: center;
  padding: 10px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  word-wrap: break-word;
}

.info-table td {
  padding: 9px 8px;
  border: 1px solid #dddddd;
  background: #fafafa;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: break-word;
  color: #111;
}

.label {
  font-weight: 900 !important;
  width: 22%;
  background: #f1f1f1 !important;
  color: #000 !important;
}

.fail-text {
  background: #ffdddd;
  color: #c00000;
  padding: 4px 7px;
  border-radius: 4px;
  font-weight: 900;
  display: inline-block;
}

.pass-text {
  color: green;
  font-weight: 900;
}

.subject-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.subject-table th,
.subject-table td {
  border: 1px solid #cfcfcf;
  padding: 10px 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: break-word;
}

.subject-table th {
  background: #d9d9d9;
  color: #000;
  font-weight: 900;
}

.subject-table td:first-child {
  text-align: center;
  font-weight: 800;
}

.subject-table td:nth-child(2) {
  text-align: left;
}

.fail-row td {
  background: #ffe9e9 !important;
  color: #c00000 !important;
  font-weight: 900;
}

.grade-title {
  text-align: center;
  font-size: 23px;
  font-weight: 900;
  padding: 10px 5px;
  color: #111;
}

.gpa-box {
  text-align: center;
  padding: 12px;
  background: #fafafa;
  margin: 6px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.8;
  color: #111;
}

.fourth-subject {
  margin: 6px;
  padding: 10px;
  border: 1px solid #ccc;
  background: #fafafa;
  text-align: center;
  border-radius: 5px;
  font-size: 15px;
  font-weight: 800;
  color: #111;
  word-break: break-word;
}

.print-area {
  text-align: center;
  padding: 10px;
}

.print-btn {
  background: #218838;
  color: #fff;
  padding: 11px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 900;
  font-size: 14px;
}

.footer {
  border-top: 1px solid #ddd;
  padding: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #222;
  flex-wrap: wrap;
}

.global-footer {
  margin-top: 25px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #4a4a4a;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  padding: 12px 15px;
  width: 100%;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.global-footer span {
  font-weight: 600;
  color: #2c6e2c;
}

@media (max-width: 600px) {

  body {
    padding: 6px;
  }

  .result-container {
    width: 100%;
  }

  .college-title {
    font-size: 20px;
  }

  .college-sub {
    font-size: 13px;
  }

  .result-title {
    font-size: 18px;
    padding: 9px;
  }

  .info-table td {
    font-size: 13px;
    padding: 7px 6px;
  }

  .subject-table th {
    font-size: 13px !important;
    white-space: normal !important;
    word-break: break-word !important;
    padding: 8px 4px;
  }

  .subject-table td {
    font-size: 12px;
    padding: 7px 5px;
  }

  .grade-title {
    font-size: 19px;
  }

  .gpa-box {
    font-size: 15px;
  }

  .fourth-subject {
    font-size: 13px;
  }

  .footer {
    flex-direction: column;
    text-align: center;
    font-size: 10px;
  }

  .print-btn {
    width: 100%;
    max-width: 260px;
  }

  .year-selector select {
    width: 95%;
    margin-top: 8px;
  }

  .instruction-box{
    font-size:13px;
  }

  .global-footer {
    font-size: 10px;
    padding: 10px 12px;
    margin-top: 20px;
  }
}

@page {
  size: A4;
  margin: 0;
}

@media print {

  body {
    background: #fff;
    margin: 5mm !important;
    padding: 0 !important;
  }

  .result-container {
    max-width: 100%;
    box-shadow: none;
  }

  .print-area,
  .search-box,
  .year-selector,
  .instruction-box,
  .global-footer {
    display: none;
  }

  #output {
    max-width: 100%;
    margin: 0;
  }
}