/* ============================================================
   Audio Normalizer - Pi7
   Scoped under .an-stage. One white card: a table of files with their
   measurements, the target chips, and the Normalize step.
   ============================================================ */

.an-stage{ margin: 12px auto 0; padding: 6px 12px; position: relative; }   /* full column width, like the other tools */
.an-card{
  max-width: 880px;            /* the select box spans the column, the settings do not */
  margin: 0 auto;
  background: #fff;
  padding: 6px 22px 18px;
}
.an-step{ padding: 16px 0; }
.an-step + .an-step:not(.hide){ border-top: 1px solid #eef0f6; }
.an-step-title{
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px;
  font-size: 16px; font-weight: 700; color: #2d3150;
}
.an-num{
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
  background: var(--pcolor); color: #fff; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.an-hint{ margin: 10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.an-sr-only{ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }


/* ==================== Step 1: the files ==================== */
.an-input{ position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
/* The select box itself is the shared .upload_cnt from common.css */
.an-stage .upload_cnt{ margin-bottom: 14px; }
.an-stage .upload_cnt.dragging label{ border-style: solid; border-color: var(--pcolor); }


/* Original / Equalized flip */

/* ==================== Step 2: presets and sliders ==================== */
.an-chips{ display: flex; flex-wrap: wrap; gap: 8px; }
.an-chip{
  min-height: 36px; padding: 0 14px;
  border: 1px solid #dfe2f2; border-radius: 999px; background: #fff;
  color: #2d3150; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.an-chip:hover{ border-color: var(--pcolor); }
.an-chip.selected{ background: var(--pcolor); border-color: var(--pcolor); color: #fff; }
.an-chip:focus-visible{ outline: 2px solid #8a90d9; outline-offset: 2px; }
.an-preset-desc{ margin: 10px 0 14px; font-size: 14px; color: #4a4f6a; line-height: 1.5; min-height: 21px; }

.an-row{ display: flex; align-items: center; gap: 12px; min-height: 40px; margin-bottom: 4px; }
.an-row-label{ flex: 0 0 80px; font-size: 14px; font-weight: 600; color: #2d3150; }
.an-row input[type="range"]{ flex: 1; min-width: 60px; margin: 0; accent-color: var(--pcolor); }
.an-value{ min-width: 58px; text-align: right; font-size: 14px; font-weight: 700; color: #2d3150; font-variant-numeric: tabular-nums; }

.an-gain-note{ margin: 12px 0 0; font-size: 13px; font-weight: 600; color: #4a4f6a; }

/* ==================== Step 3: save ==================== */
.an-select{
  flex: 1 1 auto; min-width: 0; max-width: 220px; height: 38px; padding: 0 34px 0 12px;
  border: 1px solid #e1e3ef; border-radius: 8px; background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237a7f95' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  color: #2d3150; font-size: 14px; font-weight: 500; font-family: inherit; cursor: pointer;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
.an-select:focus-visible{ outline: none; border-color: var(--pcolor); box-shadow: 0 0 0 3px rgba(68, 73, 166, 0.15); }
.an-make-btn{
  flex-shrink: 0; min-height: 42px; padding: 0 22px; border: none; border-radius: 999px;
  background: var(--pcolor); color: #fff; font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 12px rgba(68, 73, 166, 0.25);
}
.an-make-btn:hover:not(:disabled){ background: #3a3f96; }
.an-make-btn:disabled{ opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.processing{
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 8px 12px;
  background: #f6f7fc; border-radius: 8px; color: var(--pcolor); font-size: 13px; font-weight: 600;
}
.processing.hide{ display: none; }
.proc-spin{
  width: 16px; height: 16px; border: 2px solid var(--pcolor); border-top-color: rgba(255,255,255,0.4);
  border-radius: 50%; animation: an-spin 0.8s linear infinite; flex-shrink: 0;
}
@keyframes an-spin{ to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce){ .proc-spin{ animation-duration: 2.4s; } }
.cancel-btn{
  margin-left: auto; padding: 4px 2px; border: none; background: none; color: #b00d44;
  font-size: 13px; font-weight: 700; font-family: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.cancel-btn:disabled{ opacity: 0.4; cursor: not-allowed; }
.result-card{ display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px; background: #f6f7fc; border-radius: 10px; }
.result-card.hide{ display: none; }
.result-card audio{ width: 100%; height: 40px; }
.result-side{ display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.result-meta{ font-size: 13px; color: #3f4460; font-weight: 600; }
.result-actions{ display: flex; gap: 12px; align-items: center; }
.result-actions .download-btn{
  height: 38px; padding: 0 18px; border-radius: 8px; background: var(--pcolor); color: #fff;
  font-size: 14px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center;
}
.result-actions .download-btn:hover{ background: #3a3f96; }
.result-actions .ctrl-btn{
  padding: 4px 2px; border: none; background: none; color: #4a4f6a; font-size: 13px; font-weight: 600;
  font-family: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ==================== Article (content pass) ==================== */
.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); }
.an-article-table{ overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 18px 0; }
.articlesec table{ width: 100%; border-collapse: collapse; margin: 0; font-size: 15px; 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: 14px; }
.articlesec td{ padding: 11px 14px; border-top: 1px solid #eef0fa; color: #262626; vertical-align: top; }
.articlesec tbody tr:nth-child(even){ background: #f8f9ff; }

/* ==================== Phones ==================== */
@media screen and (max-width: 640px){
  .an-stage{ padding: 4px 12px; }   /* same side padding as the other tool pages */
  .an-card{ padding: 4px 14px 14px; }
  

}

/* ==================== Files table ==================== */
.an-table-wrap{ overflow-x: auto; -webkit-overflow-scrolling: touch; }
.an-files{ width: 100%; border-collapse: collapse; font-size: 14px; }
.an-files th{ text-align: left; padding: 8px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: #7a7f95; border-bottom: 1px solid #e6e8f2; }
.an-files td{ padding: 10px 10px; border-bottom: 1px solid #eef0f6; vertical-align: top; color: #2d3150; line-height: 1.4; }
.an-files tr:last-child td{ border-bottom: none; }
.an-td-name{ min-width: 160px; max-width: 320px; }
.an-name{ display: block; font-weight: 600; word-break: break-word; }
.an-sub{ display: block; font-size: 12px; color: var(--muted); }
.an-td-before, .an-td-after{ white-space: nowrap; min-width: 120px; }
.an-td-action{ white-space: nowrap; text-align: right; }
.an-muted{ color: var(--muted); }
.an-change{ display: inline-block; white-space: nowrap; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #eceefb; color: var(--pcolor); font-size: 12px; font-weight: 700; }
.an-bad{ color: #b00d44; font-weight: 600; }
.an-text-btn{
  padding: 4px 2px; border: none; background: none; color: #4a4f6a; font-size: 13px; font-weight: 600;
  font-family: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.an-remove{ color: #b00d44; }
.an-dl{
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; margin-right: 8px; border-radius: 8px;
  background: var(--pcolor); color: #fff; font-size: 13px; font-weight: 700; text-decoration: none;
}
.an-dl:hover{ background: #3a3f96; }
.an-add-row{ display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.an-add-btn{
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--pcolor); color: var(--pcolor); font-size: 14px; font-weight: 700; cursor: pointer; background: #fff;
}
.an-add-btn:hover{ background: var(--pcolor); color: #fff; }

/* ==================== Player controls inside each result card ==================== */
.an-media{ position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 0; bottom: 0; }
.an-sr-only{ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.an-play-btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 104px; min-height: 40px; padding: 0 16px; border: none; border-radius: 999px;
  background: var(--pcolor); color: #fff; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 12px rgba(68, 73, 166, 0.25);
}
.an-play-btn:hover{ background: #3a3f96; }
.an-play-btn svg{ width: 13px; height: 13px; }
.an-play-btn .an-ic-pause{ display: none; }
.an-play-btn.playing .an-ic-play{ display: none; }
.an-play-btn.playing .an-ic-pause{ display: block; }
.an-play-btn.playing{ background: #c2185b; box-shadow: 0 4px 12px rgba(194, 24, 91, 0.25); }
.an-seek{ flex: 1 1 180px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.an-seek input[type="range"]{ flex: 1; min-width: 0; margin: 0; accent-color: var(--pcolor); }
.an-time{ font-size: 13px; color: #4a4f6a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-ab{ display: inline-flex; padding: 3px; border: 1px solid #d9dcef; border-radius: 999px; background: #fff; cursor: pointer; font-family: inherit; }
.an-ab:disabled{ opacity: 0.5; cursor: not-allowed; }
.an-ab-side{ padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #7a7f95; transition: background 0.15s, color 0.15s; }
.an-ab-side.on{ background: var(--pcolor); color: #fff; }

/* ==================== Results (bottom) ==================== */
.an-results{ margin-top: 16px; padding-top: 14px; border-top: 1px solid #eef0f6; }
.an-results.hide{ display: none; }
.an-section-label{ margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: #7a7f95; }
.an-result-list{ display: flex; flex-direction: column; gap: 8px; }
.an-nw{ white-space: nowrap; }
.an-result{
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; border: 1px solid #e6e8f2; border-radius: 12px; background: #fff;
}
.an-result.on{ border-color: var(--pcolor); background: #f6f7fe; }
.an-result-head{ display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.an-result-sub{ margin-top: -4px; font-size: 13px; color: #4a4f6a; }
.an-result-play{ display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.an-result-note{ margin: 0; }
.an-result .an-dl{ margin-right: 0; height: 34px; flex: 0 0 auto; }
.an-result .an-name{ flex: 1 1 auto; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-result-play .an-ab{ flex: 0 0 auto; }
.an-results-foot{ margin-top: 12px; }

/* ==================== Target chips and advanced ==================== */
.an-chip span{ font-weight: 500; color: #7a7f95; margin-left: 4px; }
.an-chip.selected span{ color: #e6e7ff; }
.an-advanced{ margin-top: 8px; }
.an-advanced summary{
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; user-select: none;
  font-size: 14px; font-weight: 600; color: var(--pcolor); padding: 2px 0;
}
.an-advanced summary::-webkit-details-marker{ display: none; }
.an-advanced summary::before{
  content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s; margin-right: 2px;
}
.an-advanced[open] summary::before{ transform: rotate(45deg); }
.an-advanced-body{ margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.an-row-label{ flex-basis: 110px; }
.an-number{
  width: 96px; height: 38px; padding: 0 10px; border: 1px solid #e1e3ef; border-radius: 8px; font-size: 14px; font-family: inherit; color: #2d3150;
}
.an-number:focus-visible{ outline: none; border-color: var(--pcolor); box-shadow: 0 0 0 3px rgba(68, 73, 166, 0.15); }
.an-unit{ font-size: 13px; color: var(--muted); }

/* ==================== Normalize ==================== */
.an-actions{ display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.an-ghost-btn{
  min-height: 42px; padding: 0 18px; border: 1px solid var(--pcolor); border-radius: 999px; background: #fff;
  color: var(--pcolor); font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.an-ghost-btn:hover:not(:disabled){ background: var(--pcolor); color: #fff; }
.an-ghost-btn:disabled{ opacity: 0.6; cursor: not-allowed; }
.an-ghost-btn.hide{ display: none; }
.an-actions .an-hint{ margin: 0; }
@media screen and (max-width: 640px){
  .an-files th, .an-files td{ padding: 8px 5px; }
  .an-files{ font-size: 13px; }
  .an-result .an-play-btn{ min-width: 92px; padding: 0 14px; }
  .an-result .an-ab-side{ padding: 6px 10px; }
  .an-td-name{ min-width: 80px; max-width: 150px; }
  .an-td-name .an-name{ white-space: normal; overflow-wrap: anywhere; }
  .an-td-before, .an-td-after{ white-space: normal; min-width: 0; }
  .an-result-play .an-seek{ order: 3; flex: 1 1 100%; }
  .an-dl{ margin-right: 0; margin-bottom: 6px; }
  .an-row-label{ flex-basis: 100px; }
}
