/* ---------- General Styles ---------- */
body {
  background-color: #e9eef5;
  font-family: Roboto, sans-serif;
  margin: 0;
}

/* ---------- Modal Layout ---------- */
.modal {
  background-color: #2c3e50; 
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.course-modal,
.semester-modal,
.action-modal,
.target-modal {
  width: 500px;
  height: 70vh;
  display: flex;
  gap: 20px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.calculator-modal {
  width: 95%;
  max-width: 1500px;
  margin: 30px auto;
  padding: 40px;
  background: #1f2937;
  border-radius: 18px;
}


/* ---------- Headings ---------- */
h1 {
  font-weight: 700;
  color: #1f2937;
  font-size: 52px;
  text-align: center;
  width: 100%;
  display: block;
  margin-top: 40px;
  margin-bottom: 20px;
}

/* This block ONLY runs on mobile screens */
@media (max-width: 768px) {
  h1 {
    font-size: 38px;
    margin-top: 20px;
    margin-bottom: 10px;
  }
}

.subtitle {
  font-weight: 600;
  opacity: 0.95;
  font-size: 20px;
  color: white;
  margin-bottom: 60px;
}

/* ---------- Buttons ---------- */
button {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 16px;
  font-weight: 500;
  padding: 14px 28px;
  transition: 0.3s;
}

button:hover {
  cursor: pointer;
  background: #1f2d3d;
  transition: 0.15s;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
}

button:active {
  opacity: 0.5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transform: translateY(-1px);
  transition: 0.15s;
}

/* ---------- Layout ---------- */
.semester-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* ---------- Utility Classes ---------- */
.hidden {
  display: none;
}

/* ---------- Calculator Table ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 30px;
  overflow: hidden;
  border-radius: 14px;
}

th {
  background: #1e293b;
  color: #ffffff;
  padding: 16px 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

td {
  padding: 12px 8px;
  text-align: center;
  color: #334155;
  font-size: 14px;
  border-bottom: 1px solid #e2e8f0;
}

tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.95);
}

tr:nth-child(odd) td {
  color: #cfcccc;
}

tr:nth-child(odd) {
  background: rgba(51, 65, 85, 0.85);
}


/* ---------- Form Controls ---------- */
input,
select {
  width: 100%;
  max-width: 90px;
  padding: 8px 12px;
  font-size: 14px;
  color: #1e293b;
  background: #ffffff;
  background-color: #ffffff;
  outline: none;
  text-align: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ---------- SGPA Card ---------- */
.sgpa-card {
  width: 250px;
  margin: 35px auto;
  text-align: center;
  background: #334155;
  color: white;
  border-radius: 16px;
  padding: 20px;
  border-left: 6px solid #6366f1;
}

.sgpa-value {
  font-size: 42px;
  font-weight: bold;
  margin-top: 10px;
}

/* ---------- Responsive Table ---------- */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

th:first-child {
  position: sticky;
  left: 0;
  background: #1e293b;
}

td:first-child {
  position: sticky;
  left: 0;
  background: white;
}

h2 {
  margin-bottom: 35px;
  color: white;
}


/* Keep target combinations inside the calculator */
.calculator-modal {
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

#target-combinations {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.target-results-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.target-results-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.target-results-table th,
.target-results-table td {
  padding: 8px 12px;
  text-align: center;
  border: 1px solid #ddd;
}

/* =========================
   TARGET SGPA TABLE
========================= */

.calculator-modal {
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

/* Hide difficulty in Estimated SGPA mode */
.calculator-modal .difficulty-column {
  display: none;
}

/* Show difficulty in Target SGPA mode */
.calculator-modal.target-mode .difficulty-column {
  display: table-cell;
}

/* Hide theory columns in Target SGPA mode */
.calculator-modal.target-mode .theory-total-column,
.calculator-modal.target-mode .theory-marks-column {
  display: none !important;
}

/* Difficulty dropdown */
.subject-difficulty {
  min-width: 120px;
  max-width: 100%;
  box-sizing: border-box;
}

/* Target combinations container */
#target-combinations {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Allow the results table to scroll horizontally */
.target-results-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Results table */
.target-results-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.target-results-table th,
.target-results-table td {
  padding: 8px 12px;
  text-align: center;
  border: 1px solid #ddd;
}

/* Target model selection */
.target-model-controls {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
}

.target-model-controls h3 {
  width: 100%;
  margin-bottom: 5px;
}

.calculator-modal.target-mode .target-model-controls {
  display: flex;
}

.target-model-btn {
  padding: 10px 16px;
  cursor: pointer;
}

.target-model-btn.active {
  background: #26364a;
  color: white;
}

/* Maximum GP column */
.grade-cap-column {
  display: none;
}

.calculator-modal.grade-point-model .difficulty-column {
  display: none !important;
}

.calculator-modal.grade-point-model .grade-cap-column {
  display: table-cell;
}

.subject-max-gp {
  min-width: 85px;
  max-width: 100%;
  padding: 7px;
  box-sizing: border-box;
}