@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800;900&family=Poppins:wght@400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

/* ============================================
   Number Sorter - by Yaseen
   ============================================ */

.ns-wrapper {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px;
  font-family: 'Poppins', sans-serif;
  background: #ffffff;
  box-sizing: border-box;
}

/* Card */
.ns-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 2px 20px rgba(14,165,233,0.07);
  box-sizing: border-box;
}

/* Quick */
.ns-quick-section {
  border: 1.5px dashed #cbd5e1;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 24px;
  background: #fafcff;
}

.ns-quick-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #0EA5E9;
  margin: 0 0 12px 0 !important;
  font-family: 'Poppins', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ns-quick-btns { display: flex; flex-wrap: wrap; gap: 9px; }

.ns-quick-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1.5px solid #0EA5E9;
  background: #0EA5E9;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Poppins', sans-serif;
}

.ns-quick-btn:hover { background: #0284c7; border-color: #0284c7; transform: translateY(-1px); }

/* Field */
.ns-field { margin-bottom: 20px; }

.ns-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px !important;
  font-family: 'Poppins', sans-serif;
}

.ns-label-hint { font-weight: 400; color: #94a3b8; font-size: 0.75rem; margin-left: 6px; }

/* Textarea */
.ns-textarea {
  width: 100%;
  min-height: 160px;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: #334155;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f8fafc;
  box-sizing: border-box;
  line-height: 1.8;
}

.ns-textarea:focus {
  border-color: #0EA5E9;
  box-shadow: 0 0 0 4px rgba(14,165,233,0.1);
  background: #fff;
}

.ns-textarea::placeholder { color: #cbd5e1; font-family: 'Poppins', sans-serif; font-size: 0.82rem; }

.ns-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 7px;
}

.ns-detected {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: 'Poppins', sans-serif;
}

.ns-detected strong { color: #0EA5E9; font-weight: 700; }

.ns-clear-btn {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: 'Poppins', sans-serif;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  transition: color 0.2s;
}

.ns-clear-btn:hover { color: #ef4444; }

/* Options Row */
.ns-options-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}

.ns-field-opt { margin-bottom: 0; }

/* Radio Group */
.ns-radio-group {
  display: flex;
  gap: 10px;
}

.ns-radio-group--col { flex-direction: column; gap: 8px; }

.ns-radio-label { cursor: pointer; }
.ns-radio-label input[type="radio"] { display: none; }

.ns-radio-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  transition: all 0.2s;
  cursor: pointer;
}

.ns-radio-label input:checked + .ns-radio-box {
  border-color: #0EA5E9;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}

.ns-radio-icon {
  font-size: 1.1rem;
  font-weight: 900;
  color: #0EA5E9;
  font-family: 'Montserrat', sans-serif;
  line-height: 1;
}

.ns-radio-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  font-family: 'Poppins', sans-serif;
  line-height: 1.3;
}

.ns-radio-text small { display: block; font-weight: 400; color: #94a3b8; font-size: 0.7rem; }

/* Checkboxes */
.ns-check-group { display: flex; flex-direction: column; gap: 10px; }

.ns-check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: #334155;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  cursor: pointer;
}

.ns-check-label input[type="checkbox"] {
  accent-color: #0EA5E9;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Tip */
.ns-tip {
  background: #eff6ff;
  border-left: 3px solid #0EA5E9;
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  font-size: 0.8rem;
  color: #1e40af;
  font-family: 'Poppins', sans-serif;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Sort Button */
.ns-sort-btn {
  width: 100%;
  padding: 17px;
  border-radius: 14px;
  border: none;
  background: #0EA5E9;
  color: #ffffff;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 6px 22px rgba(14,165,233,0.35);
  box-sizing: border-box;
}

.ns-sort-btn:hover { background: #0284c7; transform: translateY(-2px); box-shadow: 0 10px 30px rgba(14,165,233,0.4); }
.ns-sort-btn:active { transform: translateY(0); }

/* Results */
.ns-results { box-sizing: border-box; }

/* Output Card */
.ns-output-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 16px rgba(14,165,233,0.07);
  animation: nsFade 0.5s ease forwards;
}

.ns-results-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.ns-results-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0);
}
.ns-results-line:last-child { background: linear-gradient(90deg, #e2e8f0, transparent); }

.ns-results-title {
  font-family: 'Montserrat', sans-serif !important;
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  color: #0EA5E9 !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.ns-output-wrap { position: relative; }

.ns-output {
  width: 100%;
  min-height: 160px;
  max-height: 320px;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: #334155;
  background: #f8fafc;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  line-height: 1.8;
}

.ns-copy-btn {
  margin-top: 12px;
  padding: 10px 28px;
  border-radius: 10px;
  border: none;
  background: #0EA5E9;
  color: #ffffff;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(14,165,233,0.25);
}

.ns-copy-btn:hover { background: #0284c7; }
.ns-copy-btn.copied { background: #334155; }

/* Section Title */
.ns-section-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  color: #0EA5E9;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* Stats Grid */
.ns-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 4px;
}

.ns-stat-card {
  background: #334155;
  border-radius: 14px;
  padding: 18px 16px;
  text-align: center;
  animation: nsPop 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
  opacity: 0;
  transform: scale(0.88);
}

.ns-stat-highlight { background: #0EA5E9; }

.ns-stat-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: 'Poppins', sans-serif;
  margin-bottom: 8px;
}

.ns-stat-highlight .ns-stat-label { color: rgba(255,255,255,0.8); }

.ns-stat-val {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  word-break: break-all;
}

.ns-stat-val--sm { font-size: 0.95rem; }

/* Chart Card */
.ns-chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  overflow: hidden;
}

/* Number Line */
.ns-numline-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 22px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.ns-numline {
  position: relative;
  height: 60px;
  min-width: 300px;
}

.ns-numline-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: #e2e8f0;
  border-radius: 2px;
  transform: translateY(-50%);
}

.ns-numline-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #0EA5E9, #38bdf8);
  border-radius: 2px;
}

.ns-numline-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: #0EA5E9;
  border: 2px solid #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(14,165,233,0.4);
  transition: transform 0.2s;
  cursor: default;
}

.ns-numline-dot:hover { transform: translate(-50%,-50%) scale(1.4); z-index: 2; }

.ns-numline-min, .ns-numline-max {
  position: absolute;
  bottom: 0;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #64748b;
}

.ns-numline-min { left: 0; }
.ns-numline-max { right: 0; }

/* Reset */
.ns-reset-btn {
  display: block;
  margin: 0 auto;
  padding: 12px 32px;
  border-radius: 10px;
  border: 2px solid #0EA5E9;
  background: transparent;
  color: #0EA5E9;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.ns-reset-btn:hover { background: #0EA5E9; color: #ffffff; }

/* Animations */
@keyframes nsFade { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes nsPop  { to   { opacity:1; transform:scale(1); } }

/* Responsive */
@media (max-width: 900px) {
  .ns-stats-grid  { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .ns-options-row { grid-template-columns: 1fr; }
  .ns-stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .ns-radio-group { flex-direction: column; }
  .ns-card        { padding: 18px; }
}
