/**
 * uglymorph — стили CDN-страницы (cdn.uglymorph.ru).
 *
 * Использует .liquid (из login.css) для карточек и формы входа.
 * Своё: layout сетки, drop-zone, список файлов, share-блок.
 */

/* ----- stage ----- */
.cdn-stage {
  min-height: 100vh;
  padding: 32px 20px;
}

.cdn-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cdn-auth .auth-card {
  max-width: 440px;
}

/* ----- app view ----- */
.cdn-app {
  max-width: 1180px;
  margin: 0 auto;
}

.cdn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 22px;
  gap: 12px;
  flex-wrap: wrap;
}

.cdn-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}

.cdn-tag {
  margin-top: 2px;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.55);
}

.cdn-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cdn-user-name {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* ----- grid ----- */
.cdn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cdn-list-card {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .cdn-grid { grid-template-columns: 1fr; }
  .cdn-list-card { grid-column: auto; }
}

/* ----- card ----- */
.cdn-card {
  border-radius: 20px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cdn-card-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.muted { color: rgba(255, 255, 255, 0.45); }
.muted.small { font-size: 0.78rem; }

/* ----- drop zone ----- */
.drop {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 28px 18px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.55);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  background: rgba(255, 255, 255, 0.015);
}

.drop:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.75);
}

.drop.drag-over {
  border-color: rgba(167, 139, 250, 0.7);
  background: rgba(167, 139, 250, 0.08);
  color: #fff;
}

.drop-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: #fff;
}

.drop svg { color: rgba(255, 255, 255, 0.4); }
.drop.drag-over svg { color: #a78bfa; }

/* ----- buttons ----- */
.btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.20);
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}
.btn-primary:hover { background: #e8e8e8; border-color: #e8e8e8; }

.btn-icon {
  appearance: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.20);
}
.btn-icon svg { width: 15px; height: 15px; }

/* ----- stats ----- */
.cdn-stats {
  display: flex;
  gap: 16px;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.85);
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ----- howto ----- */
.howto {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  line-height: 1.55;
}

.howto code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #fff;
}

.hint {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.20);
  color: rgba(251, 191, 36, 0.95);
}

/* ----- file list ----- */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  padding: 30px 16px;
  font-size: 0.88rem;
}

.file-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: background 0.15s, border-color 0.15s;
}

.file-row:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
}

.file-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}
.file-icon svg { width: 18px; height: 18px; }

.file-meta {
  min-width: 0;
  flex: 1;
}

.file-name {
  font-size: 0.92rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-sub {
  margin-top: 2px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.share-block, .slug-block {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  min-width: 220px;
  transition: border-color 0.15s;
}
.share-block:focus-within, .slug-block:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
}

.share-url {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 7px 10px;
  color: rgba(255, 255, 255, 0.85);
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  min-width: 0;
}

.share-url:focus { background: transparent; }

.slug-prefix {
  padding: 0 8px 0 10px;
  color: rgba(255, 255, 255, 0.4);
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.slug-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 7px 8px 7px 0;
  color: #fff;
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  min-width: 0;
}

.slug-input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

/* ----- toast (копия из bio.css для изоляции) ----- */
.toast-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: rgba(20, 22, 32, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.88rem;
  min-width: 180px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.25s ease;
}
.toast.ok  { border-color: rgba(74, 222, 128, 0.4); }
.toast.err { border-color: rgba(248, 113, 113, 0.4); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ----- responsive ----- */
@media (max-width: 600px) {
  .cdn-stage { padding: 18px 12px; }
  .cdn-card { padding: 16px; }
  .file-row { padding: 12px; }
  .share-block, .slug-block { min-width: 100%; }
}

/* ============================================================
 * Upload overlay — модалка с прогресс-баром во время загрузки
 * ============================================================ */
.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlay-in 0.2s ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.upload-panel {
  background: rgba(20, 22, 32, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px 26px 22px;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.upload-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.upload-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.005em;
}

.upload-counter {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

.upload-bar-outer {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.upload-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
  transition: width 0.25s ease;
  border-radius: 999px;
}

.upload-files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 50vh;
}

.upload-file {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.2s, border-color 0.2s;
}

.upload-file.uf-done {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.25);
}

.upload-file.uf-fail {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.25);
}

.uf-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
}

.uf-name {
  flex: 1;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uf-size {
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}

.uf-pct {
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  min-width: 38px;
  text-align: right;
  font-weight: 600;
}

.uf-done .uf-pct { color: #4ade80; }
.uf-fail .uf-pct { color: #f87171; }

.uf-bar-outer {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.uf-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
  transition: width 0.2s ease;
}

.uf-done .uf-bar-inner { background: #4ade80; }
.uf-fail .uf-bar-inner { background: #f87171; }

@media (max-width: 480px) {
  .upload-panel { padding: 18px 16px; }
  .uf-row { font-size: 0.8rem; }
}
