/* =========================================================
   UOMG Calculator Page — Component Styles Only
   Global variables, reset, layout helpers, buttons, cards
   are already loaded from assets/css/style.css
   ========================================================= */

/* ── Hero tweaks ── */
.uomg-hero-formula {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.uomg-hero-formula code {
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--secondary);
  font-size: 0.92rem;
  font-weight: 600;
}

/* Calculator layout is handled by Bootstrap's grid (row / col-lg-*) in the markup. */

/* ── Left panel (course list) ── */
.calculator-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.calc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.calc-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Column header row */
.course-row-header {
  display: grid;
  grid-template-columns: 1fr 120px 40px;
  gap: 12px;
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.course-row-header span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
}

/* Individual course row */
.course-row {
  display: grid;
  grid-template-columns: 1fr 120px 40px;
  gap: 12px;
  margin-bottom: 10px;
  align-items: center;
  animation: rowIn 0.22s ease both;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Number inputs */
.form-control {
  width: 100%;
  background: var(--bg-base);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Remove button */
.btn-remove {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.08);
  border: 1.5px solid rgba(248, 113, 113, 0.2);
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  transition: all var(--ease);
}

.btn-remove:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.45);
  transform: scale(1.1);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 44px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.8rem;
  margin-bottom: 14px;
  opacity: 0.4;
}

/* Action buttons bar */
.calc-actions {
  display: flex;
  gap: 12px;
  padding-top: 20px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* Both Calculate and Reset share the action bar equally, text centered. */
.calc-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Inline validation error (replaces native alert popups) */
.calc-error {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(248, 113, 113, 0.10);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: errorIn 0.2s ease both;
}

/* Author `display: flex` would otherwise override the [hidden] UA rule. */
.calc-error[hidden] {
  display: none;
}

.calc-error::before {
  content: '⚠️';
  font-size: 1rem;
  flex-shrink: 0;
}

@keyframes errorIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Right panel (result) ── */
.result-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  /* When JS scrolls this panel into view on mobile, keep it clear of the
     sticky navbar at the top. */
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.result-panel-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* UOMG score display */
.uomg-display {
  text-align: center;
  padding: 28px 16px 24px;
  background: var(--bg-base);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.uomg-display::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, rgba(124,106,247,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.uomg-number {
  font-size: 3.8rem;
  font-weight: 900;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  letter-spacing: -2px;
  position: relative;
}

.uomg-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 600;
}

.uomg-standing {
  display: inline-block;
  padding: 4px 18px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.88rem;
  margin-top: 12px;
}

.standing-excellent { background: rgba(74,222,128,0.14);  color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.standing-good      { background: rgba(79,195,247,0.12);  color: #4fc3f7; border: 1px solid rgba(79,195,247,0.3); }
.standing-average   { background: rgba(251,191,36,0.12);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }
.standing-low       { background: rgba(251,146,60,0.12);  color: #fb923c; border: 1px solid rgba(251,146,60,0.3); }
.standing-fail      { background: rgba(248,113,113,0.14); color: #f87171; border: 1px solid rgba(248,113,113,0.35); }

.uomg-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Placeholder state (before first calculation) */
.result-placeholder {
  text-align: center;
  padding: 32px 16px;
  background: var(--bg-base);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.result-placeholder-icon {
  font-size: 2.4rem;
  opacity: 0.25;
  margin-bottom: 12px;
}

.result-placeholder p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Breakdown stats */
.result-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 9px 14px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.breakdown-row .label {
  color: var(--text-muted);
}

.breakdown-row .value {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Formula display */
.formula-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(124,106,247,0.06);
  border: 1px solid rgba(124,106,247,0.15);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  font-family: 'Consolas', monospace;
}

.formula-bar strong {
  color: var(--primary);
}

/* ── Score scale section ── */
/* Column layout handled by Bootstrap (row row-cols-2 row-cols-md-3 row-cols-lg-5). */
.scale-cards {
  margin-top: 28px;
}

.scale-card {
  border-radius: var(--radius-md);
  padding: 18px 12px;
  text-align: center;
  border: 1px solid transparent;
  transition: transform var(--ease), box-shadow var(--ease);
}

.scale-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.scale-card-range {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.scale-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.scale-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Score table */
.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.score-table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.score-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

.score-table tbody tr:hover td {
  background: var(--bg-card-hover);
}

.standing-pill {
  display: inline-block;
  padding: 3px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

/* ── Tips panel inside result ── */
.result-tips {
  padding: 14px;
  background: rgba(124,106,247,0.05);
  border: 1px solid rgba(124,106,247,0.12);
  border-radius: var(--radius-sm);
}

.result-tips-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 10px;
}

.result-tips p {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.result-tips p:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ── Responsive ── */
/* The result panel is sticky only when it sits beside the calculator (Bootstrap's
   lg breakpoint, ≥992px). Below that the columns stack, so it scrolls normally. */
@media (max-width: 991.98px) {
  .result-panel {
    position: static;
  }
}

@media (max-width: 768px) {
  .calculator-panel,
  .result-panel {
    padding: 20px;
  }

  /* Keep score · credit · remove on a single row on mobile.
     Overrides the legacy 2-row grid in the global stylesheet. */
  .course-row,
  .course-row-header {
    grid-template-columns: 1fr 90px 40px;
    grid-template-rows: auto;
  }

  .course-row .form-control:nth-child(1) {
    grid-column: auto;
  }

  .course-row-header {
    display: none;
  }

  .uomg-number {
    font-size: 3rem;
  }
}

@media (max-width: 420px) {
  /* Tighten further on very small screens but stay on one row. */
  .course-row,
  .course-row-header {
    grid-template-columns: 1fr 72px 36px;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .calc-actions {
    flex-direction: column;
  }
}
