/* css/components/score-calculator.css */

/* ── Container ── */
.score-calculator {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 40px;
  margin-bottom: 60px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.4s ease;
}

.sc-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sc-header h2 {
  font-size: 1.6rem;
  color: var(--text-dark);
  font-weight: 700;
  margin: 0;
}

.sc-header h2 i {
  margin-right: 8px;
  color: var(--primary);
}

/* ── Exam selector ── */
.sc-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.sc-selector label {
  font-weight: 600;
  color: var(--text-dark);
}

.sc-selector select {
  padding: 10px 16px;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text-dark);
  cursor: pointer;
  transition: border-color 0.2s;
}

.sc-selector select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ── Input fields ── */
.sc-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.sc-input-group {
  background: var(--white);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.sc-input-group:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.sc-input-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.sc-input-group label i.fas {
  font-size: 16px;
  color: var(--primary);
}

.sc-input-group label small {
  font-weight: 400;
  color: var(--text-light);
  margin-left: auto;
}

.sc-input-group input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1.1rem;
  font-family: inherit;
  color: var(--text-dark);
  background: #f8fafc;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.sc-input-group input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
}

/* ── Calculate button ── */
.sc-calculate-btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  border: none;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 32px;
}

.sc-calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 58, 138, 0.35);
}

.sc-calculate-btn i {
  margin-right: 8px;
}

/* ── Statement of Results ── */
.statement-of-results {
  background: var(--white);
  padding: 24px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.4s ease;
  max-width: 850px;
  margin: 20px auto 0;
}

.sor-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 20px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 30px;
}

.result-header .box {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  font-size: 0.75em;
  font-weight: 600;
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-header .box span {
  font-size: 2em;
  display: block;
  margin-top: 6px;
  color: var(--text-dark);
  font-weight: 800;
}

.result-header .box.red {
  background: #e30613;
  color: rgba(255, 255, 255, 0.85);
  border: none;
}

.result-header .box.red span {
  color: var(--white);
}

/* ── Cambridge Results Chart (modal) ── */
.cb-result-boxes {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.cb-result-box {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: var(--white);
}

@media (max-width: 520px) {
  .cb-result-boxes {
    flex-wrap: wrap;
  }

  .cb-result-box {
    flex: 1 1 calc(50% - 8px);
    min-width: 130px;
  }

  .cb-chart-toggle {
    width: 100%;
  }

  .cb-toggle-btn {
    flex: 1;
    padding: 8px 10px;
  }
}

.cb-result-box.cb-result-green {
  background: #2D2E5F;
  border-color: #2D2E5F;
  color: #fff;
}

.cb-result-box.cb-result-green .cb-result-label {
  color: rgba(255,255,255,0.85);
}

.cb-result-box.cb-result-green .cb-result-value {
  color: #fff;
}

.cb-result-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 2px;
}

.cb-result-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dark);
}

.cb-result-score,
.cb-result-cefr {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Chart mode toggle ── */
.cb-chart-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  width: fit-content;
}

.cb-toggle-btn {
  padding: 6px 18px;
  border: none;
  background: var(--white, #fff);
  color: var(--text-medium, #666);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.cb-toggle-btn:hover {
  background: #f5f3ff;
}

.cb-toggle-btn.cb-toggle-active {
  background: #2D2E5F;
  color: #fff;
}

/* ── Raw chart ── */
.cb-raw-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cb-raw-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.cb-raw-label {
  min-width: 120px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark, #333);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cb-raw-label i {
  color: #2D2E5F;
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
}

.cb-raw-bar-wrap {
  flex: 1;
  min-height: 28px;
  height: auto;
  background: linear-gradient(180deg, #eef2ff 0%, #e8e6f7 100%);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(45, 46, 95, 0.12);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.85);
}

.cb-raw-bar {
  height: 100%;
  min-height: 28px;
  background: linear-gradient(90deg, #2D2E5F 0%, #2563a8 55%, #1E9D8E 100%);
  border-radius: 7px;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.cb-raw-value {
  min-width: 52px;
  text-align: right;
  font-size: 0.88rem;
  font-weight: 700;
  color: #2D2E5F;
  align-self: center;
}

@media (max-width: 520px) {
  .cb-raw-chart {
    gap: 14px;
  }

  .cb-raw-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 12px;
    background: #fafbff;
    border-radius: 10px;
    border: 1px solid #e8e6f7;
  }

  .cb-raw-label {
    min-width: 0;
    font-size: 0.8rem;
  }

  .cb-raw-bar-wrap {
    width: 100%;
    min-height: 22px;
  }

  .cb-raw-bar {
    min-height: 22px;
  }

  .cb-raw-value {
    text-align: left;
    font-size: 0.82rem;
  }
}

/* ── Chart container ── */
.cb-chart {
  margin-bottom: 0;
  overflow: visible;
  padding: 16px;
  font-family: sans-serif;
}

.cb-chart-columns {
  display: flex;
  gap: 6px;
  border-left: 2px solid #9ca3af;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.cb-column {
  display: flex;
  flex-direction: column;
}

.cb-hdr {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-medium);
  padding: 6px 4px;
  line-height: 1.2;
  border-bottom: 2px solid #ccc;
}

.cb-column-cefr { width: 60px; flex-shrink: 0; }
.cb-column-scale { width: 64px; flex-shrink: 0; }
.cb-column-grades { width: 80px; flex-shrink: 0; }
.cb-column-skill { width: 140px; flex-shrink: 1; min-width: 50px; }

.cb-col-body {
  height: 40vh;
  min-height: 200px;
  position: relative;
}

.cb-col-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Graduated ruler background for scale column */
.cb-column-scale .cb-col-inner {
  background: linear-gradient(to right, #e8ecf4, #F4F7FF);
  border-left: 2px solid #9ca3af;
  border-right: 2px solid #9ca3af;
  z-index: 2;
}

.cb-column-skill .cb-col-body {
  background-color: #f5f3ff;
  background-image: linear-gradient(#e5e7eb 1px, transparent 1px);
  background-size: 100% 25px;
}

/* CEFR labels */
.cb-cefr-label {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(50%);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}

/* Scale ticks */
.cb-scale-tick {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  z-index: 3;
}

.cb-scale-num {
  font-size: 0.6rem;
  color: var(--text-dark);
  font-weight: 600;
  background: linear-gradient(to right, #e8ecf4, #F4F7FF);
  padding: 1px 3px;
  border-radius: 2px;
}

.cb-scale-line {
  display: none;
}

/* Grade labels */
.cb-grade-label {
  position: absolute;
  left: 4px;
  right: 0;
  transform: translateY(50%);
}

.cb-grade-text {
  font-size: 0.65rem;
  font-weight: 600;
  color: #2D2E5F;
  line-height: 1.2;
}

/* Grade bands in skill columns */
.cb-band {
  position: absolute;
  left: 0;
  right: 0;
}

.cb-band:nth-child(1) {
  background: rgba(45, 46, 95, 0.10);
}
.cb-band:nth-child(2) {
  background: rgba(45, 46, 95, 0.07);
}
.cb-band:nth-child(3) {
  background: rgba(45, 46, 95, 0.04);
}
.cb-band:nth-child(4) {
  background: rgba(200, 200, 200, 0.08);
}

/* Dotted lines at grade boundaries */
.cb-dotted-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px dashed #9ca3af;
  z-index: 1;
  transform: translateY(0);
}

/* Grade band blocks in the grades column */
.cb-grade-band {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.cb-grade-band-text {
  font-size: 0.6rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

.cb-grade-band.cb-grade-top {
  background: #555;
}
.cb-grade-band.cb-grade-top .cb-grade-band-text {
  color: #fff;
}
.cb-grade-band.cb-grade-below {
  background: #888;
}
.cb-grade-band.cb-grade-below .cb-grade-band-text {
  color: #fff;
}
.cb-grade-band.cb-grade-bottom {
  background: #d4d4d4;
}
.cb-grade-band.cb-grade-bottom .cb-grade-band-text {
  color: #555;
}

/* CEFR band blocks (centered labels) */
.cb-cefr-band {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-cefr-band strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-dark);
}

/* Score arrow markers */
.cb-score-badge {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(50%);
  z-index: 3;
}

.cb-score-badge span {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2D2E5F;
  color: #fff;
  padding: 0 4px;
  height: 28px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  position: relative;
  box-shadow: 0 2px 6px rgba(45, 46, 95, 0.35);
  width: 100%;
  box-sizing: border-box;
}

/* Arrow triangle removed – score badge is now a full-width rectangle */



/* ── Chart area (Score Calculator page) ── */
.chart-area {
  overflow-x: auto;
  padding: 20px;
}

.chart-scale {
  display: flex;
  min-height: 400px;
  max-width: 850px;
  margin: 0 auto;
  position: relative;
  font-family: sans-serif;
}

.chart-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 8px 30px 0;
  min-width: 36px;
}

.chart-label {
  font-size: 0.65rem;
  color: var(--text-light);
  text-align: right;
  line-height: 1;
}

.chart-columns {
  flex: 1;
  display: flex;
  gap: 12px;
  position: relative;
  border-left: 2px solid #9ca3af;
  border-bottom: 1px solid #e2e8f0;
}

/* Grade bands (background) */
.chart-bands {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 30px;
  pointer-events: none;
}

.chart-band {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  box-sizing: border-box;
  border-top: 2px dashed #9ca3af;
}

.chart-band:nth-child(1) {
  background: rgba(45, 46, 95, 0.10);
}
.chart-band:nth-child(2) {
  background: rgba(45, 46, 95, 0.07);
}
.chart-band:nth-child(3) {
  background: rgba(45, 46, 95, 0.04);
}
.chart-band:nth-child(4) {
  background: rgba(200, 200, 200, 0.08);
}

.band-label {
  font-size: 0.6rem;
  color: var(--text-light);
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.7;
}

/* Individual skill column */
.chart-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
  position: relative;
}

.chart-bar-area {
  flex: 1;
  width: 100%;
  position: relative;
  background-color: #f5f3ff;
  background-image: linear-gradient(#e5e7eb 1px, transparent 1px);
  background-size: 100% 25px;
}

.chart-col-label {
  padding: 8px 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-medium);
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
}

/* ── Arrow marker (Cambridge style) ── */
.arrow-marker {
  position: absolute;
  background: #2D2E5F;
  color: var(--white);
  padding: 0 10px;
  height: 28px;
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  left: -5px;
  width: calc(100% - 5px);
  transform: translateY(50%);
  white-space: nowrap;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(45, 46, 95, 0.3);
}

.arrow-marker::before {
  content: '';
  position: absolute;
  right: -10px;
  top: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 10px solid #2D2E5F;
}

.overall-marker {
  background: #2D2E5F;
  box-shadow: 0 2px 6px rgba(45, 46, 95, 0.35);
}

.overall-marker::before {
  border-left-color: #2D2E5F;
}

.overall-column .chart-bar-area {
  border-right: none;
}

.overall-column .chart-col-label {
  color: var(--primary);
}

/* ── App-style score calculator refresh ── */
.score-calculator {
  max-width: 960px;
  background: transparent;
  box-shadow: none;
  padding: 0 16px 44px;
}

.sc-header {
  max-width: 760px;
  margin: 0 auto 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.94);
  border-radius: 22px;
  box-shadow: 0 6px 20px rgba(45, 46, 95, 0.07);
}

.sc-kicker {
  display: block;
  color: #1E9D8E;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sc-header h2 {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 900;
}

.sc-hero-card,
.sc-workspace,
.statement-of-results {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.sc-hero-card {
  margin-bottom: 14px;
  padding: 18px;
  border-radius: 26px;
  color: #173b5d;
  background: linear-gradient(135deg, #dff7e8 0%, #e9f7ff 100%);
  border: 1px solid rgba(30,157,142,0.18);
  box-shadow: 0 8px 22px rgba(45, 46, 95, 0.07);
}

.sc-hero-card .material-symbols-outlined {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  border-radius: 16px;
  background: #fff;
  color: #1E9D8E;
  box-shadow: 0 3px 0 rgba(30,157,142,0.16);
}

.sc-hero-card strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 900;
}

.sc-hero-card p {
  max-width: 520px;
  margin: 6px 0 0;
  color: #526b7d;
}

.sc-workspace {
  padding: 18px;
  border-radius: 26px;
  background: rgba(255,255,255,0.96);
  box-shadow: 0 8px 24px rgba(45, 46, 95, 0.08);
}

.sc-selector {
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: #f6fbff;
  border: 1px solid rgba(45,46,95,0.07);
}

.sc-inputs {
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
}

.sc-input-group {
  box-shadow: none;
  background: #f8fbff;
}

.statement-of-results {
  overflow: hidden;
}

.cb-chart {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .score-calculator {
    max-width: 430px;
    padding: 0 0 28px;
  }

  .sc-header,
  .sc-hero-card,
  .sc-workspace,
  .statement-of-results {
    max-width: 430px;
  }

  .sc-header {
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    border-radius: 20px;
  }

  .sc-selector {
    flex-direction: column;
    align-items: stretch;
  }

  .sc-selector select {
    width: 100%;
    font-size: 16px;
  }

  .sc-inputs {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .sc-input-group {
    padding: 13px;
    border-radius: 15px;
  }

  .sc-input-group label {
    flex-wrap: wrap;
  }

  .sc-input-group input[type="number"] {
    font-size: 16px;
  }

  .sc-calculate-btn {
    min-height: 50px;
    margin-bottom: 0;
    border-radius: 16px;
  }

  .statement-of-results {
    padding: 14px;
    border-radius: 22px;
  }

  .cb-chart {
    margin: 0 -8px;
    padding: 10px 8px;
  }

  .cb-chart-columns {
    min-width: 520px;
  }

  .cb-raw-row {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .cb-raw-label,
  .cb-raw-value {
    min-width: 0;
    text-align: left;
  }
}


