* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base styles */
body {
  font-family: Arial, sans-serif;
  background-color: #1e1e1e;
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
  color: white;
  padding: 20px;
  min-height: 100vh;
}

.body-centered {
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-card {
  width: 100%;
  max-width: 800px;
  background-color: #2a2a2a;
  border: 1px solid #d6f8e0;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
  background-color: #2a2a2a;
  padding: 20px;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto 20px;
  border-radius: 16px;
  border: 1px solid #d6f8e0;
}

.main-card header {
  background-color: transparent;
  border: none;
  border-bottom: 1px solid #d6f8e0;
  margin-bottom: 0;
  border-radius: 0;
  padding: 0 0 20px 0;
}

header h1 {
  color: #d6f8e0;
  font-size: 28px;
  margin-bottom: 15px;
}

/* Shared styles for header buttons */
.view-formula-button {
  background-color: #d6f8e0;
  color: #1e1e1e;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  text-decoration: none;
  display: inline-block;
  font-size: 15px;
  font-family: inherit;
  vertical-align: middle;
  margin: 5px;
  line-height: normal; /* Ensure consistent height */
}

.view-formula-button:hover {
  background-color: #c5e7cf;
}

/* Main content container */
main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Selection Screen */
.selection-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  margin-bottom: 20px;
}

.selection-container {
  background-color: #2a2a2a;
  padding: 40px;
  border-radius: 16px;
  border: 1px solid #d6f8e0;
  max-width: 600px;
  width: 100%;
}

.main-card .selection-container {
  background-color: transparent;
  border: none;
  padding: 20px;
}

.selection-container h2 {
  color: #d6f8e0;
  text-align: center;
  margin-bottom: 30px;
  font-size: 24px;
}

.selection-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Form */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 16px;
  font-weight: bold;
  color: #d6f8e0;
}

.select-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #3a3a3a;
  border-radius: 16px;
  background-color: #1e1e1e;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: #d6f8e0;
}

.select-input option {
  background-color: #1e1e1e;
  color: white;
}

.selection-actions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.proceed-button {
  width: 100%;
  background-color: #d6f8e0;
  color: #1e1e1e;
  border: none;
  padding: 15px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
}

.proceed-button:hover {
  background-color: #c5e7cf;
}

.cgpa-calculator-button {
  width: 100%;
  background-color: transparent;
  color: #d6f8e0;
  border: 2px solid #d6f8e0;
  padding: 15px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
}

.cgpa-calculator-button:hover {
  background-color: #d6f8e0;
  color: #1e1e1e;
}

.cgpa-calculator-button-small {
  background-color: transparent;
  color: #d6f8e0;
  border: 1px solid #d6f8e0;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
}

.cgpa-calculator-button-small:hover {
  background-color: #d6f8e0;
  color: #1e1e1e;
}

.error-message {
  background-color: #ff6b6b;
  color: white;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  margin-top: 10px;
}

/* Calculation Screen */
.calculator-screen {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Navigation back to selection screen */
.breadcrumb {
  background-color: #2a2a2a;
  padding: 15px 20px;
  border-radius: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #d6f8e0;
  gap: 15px;
}

.breadcrumb span {
  color: #d6f8e0;
  font-size: 16px;
  font-weight: bold;
}

.breadcrumb-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.change-selection-button {
  background-color: transparent;
  color: #d6f8e0;
  border: 1px solid #d6f8e0;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
}

.change-selection-button:hover {
  background-color: #d6f8e0;
  color: #1e1e1e;
}

/* Info box */
.info-box {
  background-color: #2a2a2a;
  padding: 15px;
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid #d6f8e0;
}

/* Subject cards grid */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
  align-items: start;
}

.subject-card {
  background-color: #2a2a2a;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #3a3a3a;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.subject-card h3 {
  color: #d6f8e0;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #d6f8e0;
  min-height: 48px;
  display: flex;
  align-items: center;
}

/* CGPA Calculator Grid */
.cgpa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.cgpa-card {
  background-color: #2a2a2a;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #3a3a3a;
}

.cgpa-card h3 {
  color: #d6f8e0;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #d6f8e0;
  font-size: 18px;
}

/* Input groups */
.input-group {
  margin-bottom: 15px;
}

.input-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  min-height: 20px;
}

.input-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #3a3a3a;
  border-radius: 16px;
  background-color: #1e1e1e;
  color: white;
  font-size: 14px;
}

.input-group input:focus {
  outline: none;
  border-color: #d6f8e0;
}

/* Elective Dropdown Styling */
.elective-dropdown {
  width: 100%;
  padding: 10px;
  border: 1px solid #3a3a3a;
  border-radius: 16px;
  background-color: #1e1e1e;
  color: white;
  font-size: 14px;
  cursor: pointer;
}

.elective-dropdown:focus {
  outline: none;
  border-color: #d6f8e0;
}

.elective-dropdown option {
  background-color: #1e1e1e;
  color: white;
}

/* Buttons */
.calculate-subject-button {
  background-color: #d6f8e0;
  color: #1e1e1e;
  border: none;
  padding: 12px 20px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
  margin-top: auto;
  margin-bottom: 0;
}

.calculate-subject-button:hover {
  background-color: #c5e7cf;
}

.calculate-sgpa-container {
  text-align: center;
  margin: 30px 0;
}

.calculate-sgpa-button {
  background-color: #d6f8e0;
  color: #1e1e1e;
  border: none;
  padding: 15px 40px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
}

.calculate-sgpa-button:hover {
  background-color: #c5e7cf;
}

/* Subject result */
.subject-result {
  background-color: #1e1e1e;
  margin-top: 15px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid #d6f8e0;
  display: none;
  min-height: 80px;
}

.subject-result strong {
  color: #d6f8e0;
}

/* Output section */
.output-section {
  background-color: #2a2a2a;
  padding: 30px;
  border-radius: 16px;
  margin: 20px 0;
  min-height: 50px;
  border: 1px solid #3a3a3a;
}

.placeholder-text {
  padding-top: 10px;
  text-align: center;
  color: #888;
}

.placeholder-text h3 {
  margin-bottom: 10px;
  font-size: 22px;
}

/* SGPA/CGPA display */
.sgpa-display {
  text-align: center;
  margin: 20px 0;
  padding: 15px;
  border: 1px solid #d6f8e0;
}

.sgpa-display .label {
  font-size: 13px;
}

.sgpa-display .value {
  font-size: 40px;
  font-weight: bold;
  color: #d6f8e0;
  margin: 5px 0;
}

.breakdown-title {
  margin-top: 25px;
  margin-bottom: 10px;
  font-size: 18px;
  color: #d6f8e0;
  text-decoration: underline;
}

.breakdown-list {
  list-style: none;
  padding: 0;
}

.breakdown-list li {
  background-color: #2a2a2a;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid #3a3a3a;
}

.summary-box {
  background-color: #2a2a2a;
  padding: 15px;
  margin-top: 25px;
  text-align: center;
  border-top: 2px solid #d6f8e0;
  border-bottom: 2px solid #d6f8e0;
}

/* Footer */
footer {
  background-color: #2a2a2a;
  padding: 20px;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto 20px;
  border-radius: 16px;
  border: 1px solid #d6f8e0;
}

.main-card footer {
  background-color: transparent;
  border: none;
  border-top: 1px solid #d6f8e0;
  margin-top: 0;
  border-radius: 0;
  padding: 20px 0 0 0;
}

footer a {
  color: #d6f8e0;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
}

.modal-overlay.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #2a2a2a;
  padding: 30px;
  border-radius: 16px;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  margin: 20px;
}

.close-modal-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: #d6f8e0;
  color: #1e1e1e;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
}

.close-modal-button:hover {
  background-color: #c5e7cf;
}

.modal-content h2 {
  color: #d6f8e0;
  margin-bottom: 20px;
  font-size: 24px;
}

.modal-section {
  margin-bottom: 30px;
}

.modal-section h3 {
  color: #d6f8e0;
  margin-bottom: 15px;
  font-size: 18px;
}

/* Table */
table {
  width: 100%;
  margin: 15px 0;
  border: 3px solid #d6f8e0;
  border-radius: 16px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

/* Breakdown Table */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}

.breakdown-table th,
.breakdown-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #333;
}

.breakdown-table th {
  background-color: #d6f8e0;
  color: #1e1e1e;
  font-weight: bold;
}

.breakdown-table tr:last-child td {
  border-bottom: none;
}

.table-responsive {
  overflow-x: auto;
  border: 2px solid #333;
  border-radius: 8px;
  margin-bottom: 20px;
}

th,
td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #3a3a3a;
}

/* Prediction Text */
.prediction-text {
  font-size: 12px;
  margin-top: 5px;
  color: #8fbc8f; /* Dull lime green */
}

.predict-success {
  color: #2ecc71;
  font-weight: bold;
}

.predict-fail {
  color: #e74c3c;
  font-weight: bold;
}

th {
  background-color: #d6f8e0;
  color: #1e1e1e;
  font-weight: bold;
}

/* Calculation steps */
.calculation-step {
  background-color: #1e1e1e;
  padding: 15px;
  border-radius: 16px;
  margin-bottom: 15px;
  border: 1px solid #d6f8e0;
}

.calculation-step h4 {
  color: #d6f8e0;
  margin-bottom: 10px;
}

.calculation-step code {
  display: block;
  background-color: #2a2a2a;
  padding: 10px;
  border-radius: 16px;
  margin: 10px 0;
  color: white;
  font-family: monospace;
}

.calculation-step p {
  margin-top: 10px;
}

.highlight-step {
  border: 2px solid #d6f8e0;
}

.important-notes {
  list-style: none;
  padding: 0;
}

.important-notes li {
  background-color: #1e1e1e;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 16px;
  border: 1px solid #d6f8e0;
}

/* Mobile responsive adjustment */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .main-card {
    padding: 20px;
    width: 100%;
    max-width: 100%;
    border-radius: 15px;
  }

  .banner h1 {
    font-size: 24px;
  }

  .view-formula-button {
    padding: 8px 16px;
    font-size: 14px;
  }

  .selection-form {
    padding: 15px;
  }

  .subjects-grid {
    grid-template-columns: 1fr; /* Stack cards on mobile */
  }

  .cgpa-grid {
    grid-template-columns: 1fr; /* Stack cards on mobile */
  }

  .subject-card,
  .cgpa-card {
    padding: 15px;
  }

  .input-group input {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .calculate-sgpa-button,
  .proceed-button,
  .cgpa-calculator-button {
    width: 100%;
    padding: 12px;
  }

  .breadcrumb {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .breadcrumb-buttons {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  header h1 {
    font-size: 22px;
  }

  .subjects-grid {
    grid-template-columns: 1fr;
  }

  .cgpa-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 20px;
  }

  .selection-container {
    padding: 25px;
  }

  .breadcrumb {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .breadcrumb-buttons {
    flex-direction: column;
    width: 100%;
  }

  .change-selection-button,
  .cgpa-calculator-button-small {
    width: 100%;
  }
}

/* Print Button */
.print-container {
  text-align: center;
  margin: 30px 0;
}

.print-button {
  background-color: #d6f8e0;
  color: #1e1e1e;
  border: none;
  padding: 15px 40px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.print-button:hover {
  background-color: #c5e7cf;
}
