/* ==========================================================
   MP3 Bitrate Changer - Pi7
   Scoped under .br-stage. Batch-first: file list + one picker.
   ========================================================== */

.br-stage{
  margin: 14px auto 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.br-stage input[type="file"]{ display: none; }

/* --- Bitrate picker row --- */
.br-picker{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f8f9ff;
  border: 1px solid #eef0fa;
  border-radius: 8px;
}
.br-picker-label{
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.br-picker select{
  padding: 9px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--pcolor);
  border: 2px solid #e5e7f0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  outline: none;
  min-width: 160px;
  font-family: inherit;
}
.br-picker select:hover{ border-color: var(--pcolor); }
.br-picker select:focus{
  border-color: var(--pcolor);
  box-shadow: 0 0 0 3px rgba(68, 73, 166, 0.15);
}
.br-picker-hint{
  font-size: 12px;
  color: var(--muted);
  flex-basis: 100%;
  margin: 0;
}

/* --- File list --- */
.br-files{
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.br-row{
  display: grid;
  grid-template-columns: minmax(0, 2fr) 1fr 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #eef0fa;
  border-radius: 6px;
}
.br-row.done{ background: #f4faf6; border-color: #d3ecd9; }
.br-row.pending{ background: #f8f9ff; }
.br-name{
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.br-name .br-fname{
  color: #262626;
  font-weight: 500;
}
.br-status-pill{
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-right: 6px;
  vertical-align: 1px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.br-status-pill.mp3{
  background: #eef0fa;
  color: var(--pcolor);
}
.br-status-pill.done{
  background: #d3ecd9;
  color: #1a6a35;
}
.br-status-pill.pending{
  background: #fff5f7;
  color: #b00d44;
}
.br-metric{
  font-size: 13px;
  color: #4a4a4a;
  text-align: center;
  white-space: nowrap;
}
.br-metric .from{ color: var(--muted); }
.br-metric .arrow{ color: var(--pcolor); font-weight: 700; margin: 0 4px; }
.br-metric .to{ color: var(--pcolor); font-weight: 700; }
.br-remove{
  background: #fff;
  border: 1px solid #e5e7f0;
  color: #b00d44;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.2;
}
.br-remove:hover{ background: #fff5f7; border-color: #f5c5d3; }
.br-invalid{ opacity: 0.7; }
.br-invalid .br-name .br-fname{ text-decoration: line-through; }

/* --- Total footer --- */
.br-totals{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #eef0fa;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--pcolor);
}
.br-totals .br-total-metric .arrow{
  color: var(--pcolor);
  font-weight: 700;
  margin: 0 6px;
}
.br-totals .br-total-metric .to{ color: #1a6a35; }

/* --- Actions row --- */
.br-actions{
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.br-add-more{
  flex: 0 0 auto;
  padding: 12px 20px;
  background: #fff;
  border: 1px dashed #c9cee5;
  border-radius: 6px;
  color: var(--pcolor);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.br-add-more:hover{
  border-style: solid;
  border-color: var(--pcolor);
  background: #f8f9ff;
}
.br-actions .process-btn{ flex: 1; padding: 14px 26px; }

/* --- Processing box --- */
.processing{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eef0fa;
  color: var(--pcolor);
  font-size: 14px;
}
.proc-spin{
  width: 22px;
  height: 22px;
  border: 3px solid var(--pcolor);
  border-top-color: rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: br-spin 0.8s linear infinite;
}
@keyframes br-spin{ to { transform: rotate(360deg); } }
.cancel-btn{
  background: #fff;
  border: 1px solid #f5c5d3;
  color: #b00d44;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}
.cancel-btn:hover:not(:disabled){ background: #fff5f7; }
.cancel-btn:disabled{ opacity: 0.5; cursor: not-allowed; }

/* --- Result box (single file) --- */
.br-result{
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: #f4faf6;
  border: 1px solid #d3ecd9;
  border-radius: 8px;
}
.br-result audio{
  width: 100%;
  border-radius: 6px;
}
.br-result-meta{
  font-size: 13px;
  color: #1a6a35;
  font-weight: 600;
}
.br-result-actions{ display: flex; gap: 10px; }
.download-btn{
  background: linear-gradient(135deg, #4449a6, #373c8f);
  color: #fff;
  padding: 12px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 6px 18px rgba(68, 73, 166, 0.30);
}
.download-btn:hover{ transform: translateY(-1px); box-shadow: 0 10px 26px rgba(68, 73, 166, 0.42); }
.ctrl-btn{
  background: #fff;
  border: 1px solid #e5e7f0;
  color: var(--pcolor);
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ctrl-btn:hover{ background: #f8f9ff; border-color: var(--pcolor); }

/* --- Process button (shared Pi7 pattern) --- */
.process-btn{
  background: linear-gradient(135deg, #4449a6, #373c8f);
  color: #fff;
  border: none;
  padding: 14px 26px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: block;
  box-shadow: 0 6px 18px rgba(68, 73, 166, 0.30);
  transition: transform 0.15s, box-shadow 0.15s;
}
.process-btn:hover:not(:disabled){
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(68, 73, 166, 0.42);
}
.process-btn:disabled{
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* --- Reject notice (non-MP3 files) --- */
.br-reject-notice{
  padding: 10px 14px;
  background: #fff5f7;
  border: 1px solid #f5c5d3;
  border-radius: 6px;
  color: #b00d44;
  font-size: 13px;
  line-height: 1.5;
}
.br-reject-notice a{ color: var(--pcolor); text-decoration: underline; }

/* --- Article section shared bits --- */
.articlesec table{
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(68, 73, 166, 0.06);
}
.articlesec thead{ background: var(--pcolor); color: #fff; }
.articlesec th{
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 13px;
}
.articlesec td{
  padding: 11px 14px;
  border-top: 1px solid #eef0fa;
  color: #262626;
  vertical-align: top;
}
.articlesec tbody tr:nth-child(even){ background: #f8f9ff; }
.illus{
  margin: 24px 0 36px;
  display: flex;
  justify-content: center;
}
.illus img{
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(68, 73, 166, 0.14);
}

/* --- Mobile: row stacks --- */
@media (max-width: 700px){
  .br-row{
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name remove"
      "size size"
      "bitrate bitrate";
    gap: 6px 10px;
    padding: 10px 12px;
  }
  .br-row .br-name{ grid-area: name; }
  .br-row .br-remove{ grid-area: remove; }
  .br-row .br-metric.br-size{ grid-area: size; text-align: left; }
  .br-row .br-metric.br-bitrate{ grid-area: bitrate; text-align: left; }
  .br-totals{
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .br-actions{ flex-direction: column; }
  .br-picker{ padding: 10px 12px; }
  .br-picker select{ min-width: auto; width: 100%; }
}
