/* ============================================================
   M3U-EDIT.COM v2 — Unified Tool Page Styles
   Location: assets/css/tool.css

   Used by ALL tool pages (splitter, cleaner, merger, sorter,
   duplicate-remover, validator, checker, converters, etc.)
   ============================================================ */

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.tool-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 30px 24px 80px;
}

@media (max-width: 600px) {
  .tool-page { padding: 20px 16px 60px; }
}

/* ============================================================
   TOOL HEADER
   ============================================================ */
.tool-header {
  text-align: center;
  margin-bottom: 32px;
}

.tool-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 34px;
  margin-bottom: 18px;
  box-shadow: 0 12px 30px rgba(var(--primary-rgb), 0.35);
  position: relative;
  animation: tool-icon-float 3s ease-in-out infinite;
}

@keyframes tool-icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.tool-header-icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), var(--accent), var(--pink));
  z-index: -1;
  opacity: 0.4;
  filter: blur(20px);
}

.tool-header h1 {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tool-header p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 600px;
  margin: 0 auto;
}

/* Breadcrumbs above header */
.tool-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.tool-breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--t-fast);
}
.tool-breadcrumbs a:hover { color: var(--primary); }
.tool-breadcrumbs .sep { opacity: 0.5; }

/* ============================================================
   TOOL CARDS (steps)
   ============================================================ */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  transition: border-color var(--t-base);
}

@media (max-width: 600px) {
  .tool-card { padding: 18px; border-radius: var(--radius); }
}

.tool-card.is-active {
  border-color: rgba(var(--primary-rgb), 0.3);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.05);
}

.tool-card.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.tool-card-step {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.tool-card-step.is-done {
  background: var(--success);
}

.tool-card-step.is-pending {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.tool-card-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.tool-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.tool-card-body {
  /* Content area */
}

/* ============================================================
   FILE INFO PILL (after upload)
   ============================================================ */
.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.05), rgba(var(--accent-rgb), 0.03));
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.file-info-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.file-info-content { flex: 1; min-width: 0; }
.file-info-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  flex-wrap: wrap;
}

.file-info-badge {
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
}

.file-info-reset {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.file-info-reset:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================================
   STATS GRID (after parsing)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-box {
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  text-align: center;
}

.stat-box-value {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-box-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

/* ============================================================
   CATEGORY/CHANNEL LIST (with checkboxes)
   ============================================================ */
.checklist {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

.checklist-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
  flex-wrap: wrap;
}

.checklist-search {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
}
.checklist-search:focus {
  outline: none;
  border-color: var(--primary);
}

.checklist-actions {
  display: flex;
  gap: 4px;
}
.checklist-action-btn {
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}
.checklist-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.checklist-items {
  padding: 4px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast);
  user-select: none;
}
.checklist-item:hover {
  background: rgba(var(--primary-rgb), 0.06);
}

.checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-item-label {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checklist-item-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.checklist-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================================
   OPTIONS GRID
   ============================================================ */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--t-base);
}
.option-card:hover {
  border-color: rgba(var(--primary-rgb), 0.3);
}
.option-card input[type="checkbox"],
.option-card input[type="radio"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}
.option-card-content { flex: 1; }
.option-card-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}
.option-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

.option-card.is-checked {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
}

/* ============================================================
   ACTION BAR
   ============================================================ */
.tool-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.tool-actions .btn { flex-shrink: 0; }

.tool-actions-spacer { flex: 1; }

/* ============================================================
   RESULT BOX (after processing)
   ============================================================ */
.result-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.02));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 18px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.result-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  animation: result-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes result-pop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.result-header h3 {
  font-size: 17px;
  margin: 0 0 2px;
  color: var(--success);
}

.result-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.result-stat {
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  text-align: center;
}
.result-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.result-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
}

.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   CODE PREVIEW (for showing M3U sample)
   ============================================================ */
.code-preview {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 14px;
  border-radius: var(--radius);
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  max-height: 240px;
  overflow: auto;
  margin: 12px 0;
  white-space: pre;
}
.code-preview .extm3u   { color: #c586c0; }
.code-preview .extinf   { color: #4ec9b0; }
.code-preview .url      { color: #ce9178; }
.code-preview .attr     { color: #9cdcfe; }

/* ============================================================
   PROGRESS BAR (during processing)
   ============================================================ */
.process-progress {
  margin-top: 12px;
}
.process-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 999px;
  overflow: hidden;
}
.process-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ============================================================
   "RELATED TOOLS" SECTION
   ============================================================ */
.related-tools {
  margin-top: 50px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

.related-tools h3 {
  text-align: center;
  font-size: 18px;
  margin-bottom: 18px;
}

.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.related-tool-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all var(--t-base);
}
.related-tool-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  color: inherit;
}
.related-tool-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.related-tool-name {
  font-size: 13px;
  font-weight: 600;
}
