/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700&display=swap');
/* Global Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #314755 0%, #314755 45%, #26a0da 75%, #2575fc 100%);
  background-attachment: fixed;
  color: #2d3748;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px 15px;
}

/* Main Container Layout */
.app-container {
  width: 100%;
  max-width: 900px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: fadeIn 0.5s ease-in-out;
}

/* Header Section */
.app-header {
  background: linear-gradient(135deg, #314755, #26a0da);
  color: #ffffff;
  padding: 30px 20px;
  text-align: center;
}

.app-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.app-header p {
  font-size: 0.95rem;
  opacity: 0.9;
  font-weight: 300;
}

.animated-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.3;
}




.animated-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.4;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

  text-shadow: 0 0 20px rgba(38, 160, 218, 0.25);
}

.calculator-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid #fff;
  width: 0;

  animation:
    typingTitle 4s steps(21, end) infinite,
    cursorBlink 0.8s infinite;
}

@keyframes typingTitle {
  0% {
    width: 0;
  }

  50% {
    width: 21ch;
  }

  80% {
    width: 21ch;
  }

  100% {
    width: 0;
  }
}

@media (max-width: 480px) {
  .animated-title {
    font-size: 2.5px;
    line-height: 1.4;
    padding: 0 10px;
  }

  .calculator-text {
    font-size: 1.3rem;
    border-right: 2px solid #fff;
  }
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
  flex: 1;
  padding: 16px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn:hover {
  color: #4f46e5;
  background: rgba(255, 255, 255, 0.6);
}

.tab-btn.active {
  color: #4f46e5;
  background: #ffffff;
  border-bottom: 3px solid #4f46e5;
}

/* Tab Content Areas */
.tab-content {
  display: none;
  padding: 30px;
}

.tab-content.active {
  display: block;
  animation: slideUp 0.3s ease-out;
}

/* Card Sections */
.card-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Subject Rows Header (Desktop) */
.subject-row-header {
  display: grid;
  grid-template-columns: 2.5fr 1.2fr 1.5fr 1.2fr 45px;
  gap: 12px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 10px 10px 10px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 12px;
}

/* Subject Row Layout */
.subject-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subject-row {
  display: grid;
  grid-template-columns: 2.5fr 1.2fr 1.5fr 1.2fr 45px;
  gap: 12px;
  align-items: center;
  background: #ffffff;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.subject-row:focus-within {
  border-color: #26a0da;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Form Inputs & Selects */
.input-group {
  display: flex;
  flex-direction: column;
}

.input-field {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.2s ease;
}

.input-field:focus {
  border-color: #26a0da;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.input-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 6px;
}

/* Calculated Grade Display Badge in Row */
.grade-badge {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #edf2f7;
  padding: 6px 10px;
  border-radius: 6px;
  text-align: center;
  min-height: 42px;
}

.grade-badge .grade-letter {
  font-weight: 700;
  font-size: 0.95rem;
  color: #26a0da;
}

.grade-badge .grade-pts {
  font-size: 0.75rem;
  color: #64748b;
}

/* Action Buttons */
.btn-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #26a0da);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #26a0da, #4f46e5);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}

.btn-secondary:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.btn-danger {
  background: #fee2e2;
  color: #26a0da;
  border-radius: 8px;
  padding: 10px;
  width: 42px;
  height: 42px;
}

.btn-danger:hover {
  background: #26a0da;
  color: #ffffff;
}

.btn-block {
  width: 100%;
}

/* Results Display Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.result-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.result-card.highlight {
  background: linear-gradient(135deg, #26a0da, #314755);
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
  grid-column: span 1;
}

.result-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 6px;
}

.result-card.highlight .result-title {
  color: rgba(255, 255, 255, 0.9);
}

.result-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
}

.result-card.highlight .result-value {
  font-size: 2.2rem;
  color: #ffffff;
}

/* CGPA Input Layout */
.cgpa-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Grading Table Section */
.grading-table-container {
  overflow-x: auto;
  margin-top: 15px;
}

.grading-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.grading-table th,
.grading-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
}

.grading-table th {
  background: #edf2f7;
  color: #475569;
  font-weight: 600;
}

.grading-table tr:hover {
  background: #f1f5f9;
}

/* Collapsible / Details styling */
details.grading-scale {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 25px;
}

details.grading-scale summary {
  font-weight: 600;
  color: #4f46e5;
  cursor: pointer;
  outline: none;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  color: #64748b;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive Adjustments */
@media (max-width: 650px) {
  body {
    padding: 10px;
  }

  .tab-content {
    padding: 15px;
  }

  .subject-row-header {
    display: none;
  }

  .subject-row {
    grid-template-columns: 1fr;
    gap: 10px;
    position: relative;
    padding-bottom: 15px;
  }

  .btn-danger {
    position: absolute;
    top: 10px;
    right: 10px;
  }

  .cgpa-form {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: 1fr 1fr;
  }

  .result-card.highlight {
    grid-column: span 2;
  }
}
