/* ============================================================
   MusicBox Manager — Stylesheet
   Self-contained, no external CDN, works offline.
   ============================================================ */

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg:          #f0f2f5;
  --color-surface:     #ffffff;
  --color-border:      #d8dde5;
  --color-primary:     #4f7ef8;
  --color-primary-dk:  #3a63d4;
  --color-danger:      #e53935;
  --color-danger-dk:   #c62828;
  --color-success-bg:  #e8f5e9;
  --color-success-fg:  #2e7d32;
  --color-error-bg:    #ffebee;
  --color-error-fg:    #c62828;
  --color-text:        #1a1d23;
  --color-text-soft:   #5f6880;
  --color-header-bg:   #1e2330;
  --color-header-fg:   #e8eaf0;
  --radius:            8px;
  --shadow:            0 2px 8px rgba(0,0,0,.10);
  --font:              system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Site Header ──────────────────────────────────────────── */
.site-header {
  background: var(--color-header-bg);
  color: var(--color-header-fg);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  flex-shrink: 0;
}

.site-logo { font-size: 1.5rem; }

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .02em;
  flex: 1;
}

.site-nav {
  display: flex;
  gap: .25rem;
}

.nav-link {
  color: var(--color-header-fg);
  text-decoration: none;
  padding: .4rem .9rem;
  border-radius: var(--radius);
  font-size: .9rem;
  opacity: .75;
  transition: opacity .15s, background .15s;
}

.nav-link:hover  { opacity: 1; background: rgba(255,255,255,.08); }
.nav-link.active { opacity: 1; background: rgba(255,255,255,.15); font-weight: 600; }

/* ── Main Container ───────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash-list {
  list-style: none;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid transparent;
  font-size: .93rem;
}

.flash--success {
  background: var(--color-success-bg);
  color: var(--color-success-fg);
  border-color: var(--color-success-fg);
}

.flash--error {
  background: var(--color-error-bg);
  color: var(--color-error-fg);
  border-color: var(--color-error-fg);
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--color-text);
}

/* ── Tag Badge ────────────────────────────────────────────── */
.tag-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #eef2ff;
  border: 1px solid #c5d0f8;
  border-radius: var(--radius);
  padding: .9rem 1.2rem;
  margin-bottom: 1.1rem;
}

.tag-badge__label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-primary);
}

.tag-badge__uid {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  word-break: break-all;
}

/* ── Hint ─────────────────────────────────────────────────── */
.hint {
  font-size: .9rem;
  color: var(--color-text-soft);
  margin-bottom: 1.25rem;
}

/* ── Upload Form ──────────────────────────────────────────── */
.upload-form {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.upload-form__label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--color-text);
}

.upload-form__input {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  font-size: .9rem;
  cursor: pointer;
  transition: border-color .15s;
}

.upload-form__input:hover,
.upload-form__input:focus {
  border-color: var(--color-primary);
  outline: none;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: .93rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  align-self: flex-start;
}
.btn--primary:hover { background: var(--color-primary-dk); }

.btn--danger {
  background: var(--color-danger);
  color: #fff;
}
.btn--danger:hover { background: var(--color-danger-dk); }

.btn--sm {
  padding: .3rem .75rem;
  font-size: .82rem;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--color-text-soft);
}

.empty-state__icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.empty-state__text { font-size: 1.05rem; font-weight: 600; margin-bottom: .25rem; }
.empty-state__sub  { font-size: .9rem; }
.empty-state__sub a { color: var(--color-primary); }

/* ── Folder Card ──────────────────────────────────────────── */
.folder-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.folder-card__header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1rem;
  background: #f7f8fa;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.folder-card__icon { font-size: 1.15rem; }

.folder-card__name {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
  font-size: .95rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card__count {
  font-size: .8rem;
  color: var(--color-text-soft);
}

.folder-card__empty {
  padding: .75rem 1rem;
  font-size: .88rem;
  color: var(--color-text-soft);
  font-style: italic;
}

/* ── File Table ───────────────────────────────────────────── */
.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.file-table thead th {
  text-align: left;
  padding: .5rem 1rem;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-soft);
  background: #fbfcfd;
  border-bottom: 1px solid var(--color-border);
}

.file-table tbody tr { border-bottom: 1px solid var(--color-border); }
.file-table tbody tr:last-child { border-bottom: none; }
.file-table tbody tr:hover { background: #f5f7fa; }

.file-table td { padding: .55rem 1rem; vertical-align: middle; }

.file-table__name { word-break: break-all; }
.file-table__size  { white-space: nowrap; color: var(--color-text-soft); width: 90px; }
.file-table__action { width: 110px; text-align: right; }

/* ── Inline form (buttons in tables) ─────────────────────── */
.inline-form { display: inline; }

/* ── Site Footer ──────────────────────────────────────────── */
.site-footer {
  text-align: center;
  font-size: .78rem;
  color: var(--color-text-soft);
  padding: 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 560px) {
  .site-header { flex-wrap: wrap; gap: .5rem; }
  .site-title  { flex: unset; }
  .site-nav    { width: 100%; }
  .nav-link    { flex: 1; text-align: center; }

  .tag-badge   { flex-direction: column; align-items: flex-start; gap: .35rem; }

  .folder-card__header { gap: .4rem; }
  .folder-card__name   { max-width: 55vw; }

  .file-table__size   { display: none; }
  .file-table__action { width: auto; }
}
