/* ============================================================
   Magic Coloring — components.css
   Page-level components: hero, generator, gallery, image view,
   tables, tabs, badges, pagination, progress panel
   ============================================================ */

/* ---------- landing hero ---------- */

.hero { text-align: center; padding: 70px 0 50px; }

.hero h1 { font-size: 2.7rem; line-height: 1.25; margin-bottom: 18px; }

.hero h1 .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p.lead { color: var(--muted); font-size: 1.15rem; max-width: 640px; margin: 0 auto 30px; }

.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- landing sections ---------- */

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; padding: 30px 0; }

.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  text-align: center;
}

.feature .icon { font-size: 2.2rem; margin-bottom: 12px; }

.feature h3 { margin-bottom: 8px; font-size: 1.05rem; }

.feature p { color: var(--muted); font-size: 0.9rem; }

.section-title { text-align: center; font-size: 1.7rem; margin: 46px 0 10px; }

.section-sub { text-align: center; color: var(--muted); margin-bottom: 26px; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; padding-bottom: 30px; }

.step { text-align: center; padding: 22px 16px; background: var(--bg-soft); border-radius: var(--radius); border: 1px dashed var(--border); }

.step .num {
  width: 40px; height: 40px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--gradient);
  font-weight: 700; color: #fff;
}

/* ---------- auth pages ---------- */

.auth-wrapper { display: flex; justify-content: center; padding: 46px 0 70px; }

.auth-card { width: 100%; max-width: 430px; padding: 34px; }

.auth-card h2 { text-align: center; margin-bottom: 8px; }

.auth-card .auth-sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 0.92rem; }

.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 0.9rem; }

.auth-alt a { color: var(--brand1); text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

/* ---------- dashboard ---------- */

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin: 22px 0; }

.stat-card { text-align: left; }

.stat-card .label { color: var(--muted); font-size: 0.88rem; margin-bottom: 8px; }

.stat-card .value { font-size: 2.3rem; font-weight: 800; line-height: 1.1; }

.stat-card .value.grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-card .sub { margin-top: 6px; color: var(--muted); font-size: 0.85rem; }

.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

/* ---------- generator ---------- */

.gen-layout { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 22px; }

@media (min-width: 900px) { .gen-layout { grid-template-columns: 1.5fr 1fr; align-items: start; } }

.mode-tabs { display: flex; gap: 8px; margin-bottom: 18px; }

.mode-tabs button {
  flex: 1;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.95rem;
}

.mode-tabs button.active { background: rgba(139, 92, 246, 0.16); border-color: var(--brand1); color: #fff; }

.preset-picker { margin-bottom: 20px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.chip {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.chip.active { background: rgba(236, 72, 153, 0.15); border-color: var(--brand2); color: #fff; }

.preset-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 300px; overflow-y: auto; padding-right: 4px; }

.preset-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font-size: 0.88rem;
  text-align: center;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.preset-item:hover { transform: translateY(-2px); border-color: var(--brand1); }

.preset-item.selected { border-color: var(--brand2); background: rgba(236, 72, 153, 0.12); font-weight: 600; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }

.gen-summary {
  position: sticky;
  top: 90px;
}

.cost-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.95rem;
}

.cost-line .big { font-size: 1.3rem; font-weight: 700; }

/* progress panel */

.progress-panel { text-align: center; padding: 40px 24px; }

.progress-panel h3 { margin: 16px 0 6px; }

.progress-panel .stage { color: var(--muted); min-height: 1.6em; }

.progress-steps { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; text-align: left; max-width: 320px; margin-left: auto; margin-right: auto; }

.progress-step { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.9rem; }

.progress-step .dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.15); flex-shrink: 0; }

.progress-step.done .dot { background: var(--success); }
.progress-step.done { color: var(--text); }
.progress-step.active .dot { background: var(--brand1); animation: pulse 1s infinite; }
.progress-step.active { color: #fff; }

@keyframes pulse { 50% { opacity: 0.4; } }

.result-box { text-align: center; }

.result-box img {
  max-width: 100%;
  max-height: 430px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

/* ---------- gallery ---------- */

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; margin-top: 22px; }

.gallery-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-card .thumb-wrap { position: relative; aspect-ratio: 4 / 5; background: #fff; }

.gallery-card .thumb-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }

.gallery-card .body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.gallery-card .title { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gallery-card .meta { color: var(--muted); font-size: 0.78rem; }

.gallery-card .meta .expires-soon { color: var(--warn); }

.gallery-card .actions { display: flex; gap: 8px; margin-top: auto; }

.gallery-card .actions .btn { flex: 1; }

.gallery-empty { text-align: center; color: var(--muted); padding: 60px 20px; }

.gallery-empty .big { font-size: 3rem; margin-bottom: 12px; }

/* pagination */

.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 30px 0; flex-wrap: wrap; }

.pagination .page-info { color: var(--muted); font-size: 0.9rem; padding: 0 8px; }

/* ---------- image view ---------- */

.image-layout { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 22px; }

@media (min-width: 860px) { .image-layout { grid-template-columns: 1.4fr 1fr; align-items: start; } }

.image-stage {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  min-height: 300px;
}

.image-stage img { max-width: 100%; max-height: 620px; }

.meta-list { display: flex; flex-direction: column; gap: 0; }

.meta-list .row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); font-size: 0.92rem; }

.meta-list .row .k { color: var(--muted); }

/* ---------- tables (admin / account) ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }

table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }

table.data th { background: var(--bg-soft); color: var(--muted); font-weight: 600; white-space: nowrap; }

table.data tr:last-child td { border-bottom: none; }

table.data tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ---------- badges ---------- */

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-success { background: rgba(52, 211, 153, 0.12); color: var(--success); border-color: rgba(52, 211, 153, 0.4); }
.badge-danger { background: rgba(248, 113, 113, 0.12); color: var(--danger); border-color: rgba(248, 113, 113, 0.4); }
.badge-warn { background: rgba(251, 191, 36, 0.12); color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.badge-info { background: rgba(139, 92, 246, 0.14); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.4); }
.badge-muted { background: rgba(255, 255, 255, 0.06); color: var(--muted); border-color: var(--border); }

/* ---------- pricing ---------- */

.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 26px 0; }

.plan-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  text-align: center;
  position: relative;
}

.plan-card h3 { margin-bottom: 6px; }

.plan-card .price { font-size: 2.2rem; font-weight: 800; margin: 12px 0 2px; }

.plan-card .price small { font-size: 0.95rem; color: var(--muted); font-weight: 500; }

.plan-card .credits-line { color: var(--brand2); font-weight: 700; margin-bottom: 18px; }

.plan-card .desc { color: var(--muted); font-size: 0.88rem; margin-bottom: 20px; flex: 1; }

.promo-box { display: flex; gap: 10px; max-width: 460px; margin: 8px auto 30px; }

.promo-box input { flex: 1; }

/* ---------- admin tabs ---------- */

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 18px 0; }

.tabs button {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
}

.tabs button.active { background: rgba(139, 92, 246, 0.16); border-color: var(--brand1); color: #fff; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }

.toolbar input, .toolbar select { width: auto; min-width: 160px; }

.storage-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 { margin-bottom: 16px; }

.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- notice strip ---------- */

.retention-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fde68a;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 0.88rem;
  margin: 16px 0;
}

/* ---------- success page ---------- */

.center-box { max-width: 520px; margin: 60px auto; text-align: center; }

.center-box h2 { margin: 18px 0 8px; }

.center-box p { color: var(--muted); margin-bottom: 22px; }

/* ---------- series (batch) ---------- */

.series-progress-card { margin-bottom: 22px; }

.series-progress-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  transition: width 0.4s ease;
}

.series-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.series-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.series-placeholder span[style] { color: var(--danger); }

.tile-failed { background: rgba(248, 113, 113, 0.06); text-align: center; }

.page-count-chip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(5, 8, 18, 0.72);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 3px 9px;
}

.thumb-wrap { position: relative; }

/* ---------- gallery multi-select ---------- */

.card-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  cursor: pointer;
}

.card-check input {
  width: 22px;
  height: 22px;
  accent-color: var(--brand2);
  cursor: pointer;
}

.select-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  max-width: min(94vw, 640px);
}

.select-bar .select-count { font-weight: 600; font-size: 0.92rem; white-space: nowrap; }

.radio-list { display: flex; flex-direction: column; gap: 10px; }

.radio-row, .checkbox-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }

.radio-row input, .checkbox-row input { accent-color: var(--brand2); }
