/* ── storage.tnn · tema escuro moderno ───────────────────────── */

:root {
  --bg: #0d0f14;
  --bg-elev: #151821;
  --bg-hover: #1c2130;
  --border: #262c3d;
  --text: #e8eaf0;
  --text-dim: #8b93a7;
  --accent: #ff8a3d;
  --accent-soft: rgba(255, 138, 61, 0.14);
  --danger: #ff5d5d;
  --success: #4ade80;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Garante que [hidden] vença regras com display explícito (grid/flex). */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button { font: inherit; cursor: pointer; }

/* ── topbar ──────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 138, 61, 0.05), transparent);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-icon {
  font-size: 26px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 138, 61, 0.25);
  border-radius: 12px;
}

.brand h1 { font-size: 1.15rem; letter-spacing: -0.01em; }

.zone-info { font-size: 0.78rem; color: var(--text-dim); }

.user-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 0 4px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── login ───────────────────────────────────────────────────── */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 138, 61, 0.18), transparent),
    var(--bg);
}

.login-card {
  width: min(100%, 380px);
  padding: 32px 28px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-brand {
  text-align: center;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-brand h1 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.login-brand p {
  font-size: 0.88rem;
  color: var(--text-dim);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.login-field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 11px 14px;
  font: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.login-field input:focus { border-color: var(--accent); }

.login-error {
  font-size: 0.85rem;
  color: var(--danger);
  margin: 0;
}

.login-submit { width: 100%; padding: 12px 16px; margin-top: 4px; }

.filter-input {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 14px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
.filter-input:focus { border-color: var(--accent); }

/* ── botões ──────────────────────────────────────────────────── */

.btn {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 16px;
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1005;
  font-weight: 600;
}
.btn-primary:hover { background: #ffa05e; }

.btn-ghost { background: transparent; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  padding: 6px 9px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

/* ── breadcrumb ──────────────────────────────────────────────── */

.breadcrumb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
}

.breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 0.92rem; }

.breadcrumb .crumb {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.breadcrumb .crumb:hover { background: var(--bg-hover); color: var(--text); }
.breadcrumb .crumb.current { color: var(--accent); font-weight: 600; }
.breadcrumb .sep { color: var(--border); }

/* ── listagem ────────────────────────────────────────────────── */

.file-area { padding: 12px 24px 120px; max-width: 1100px; margin: 0 auto; }

.file-list { display: flex; flex-direction: column; gap: 4px; }

.file-row {
  display: grid;
  grid-template-columns: 52px 1fr 110px 160px auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.file-row:hover { background: var(--bg-elev); border-color: var(--border); }

.file-thumb-wrap {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.file-thumb-wrap.is-icon {
  font-size: 1.35rem;
  background: var(--accent-soft);
  border-color: rgba(255, 138, 61, 0.2);
}

.file-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0a0c10;
}

.file-row.is-dir .file-thumb-wrap {
  background: var(--accent-soft);
  border-color: rgba(255, 138, 61, 0.2);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.file-row.is-dir .file-name { cursor: pointer; }
.file-row.is-dir .file-name:hover { color: var(--accent); }

.file-size, .file-date { color: var(--text-dim); font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; }

.file-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.file-row:hover .file-actions { opacity: 1; }
.file-actions .btn-icon.danger:hover { color: var(--danger); }

/* ── preview no hover ────────────────────────────────────────── */

.hover-preview {
  position: fixed;
  z-index: 1200;
  max-width: min(420px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  padding: 8px;
  border-radius: 14px;
  background: rgba(18, 22, 32, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: hover-preview-in 0.14s ease;
}

.hover-preview-media {
  display: block;
  max-width: 100%;
  max-height: min(62vh, 460px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  background: #0a0c10;
}

.hover-preview-caption {
  font-size: 0.8rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px 2px;
}

@keyframes hover-preview-in {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ── estados ─────────────────────────────────────────────────── */

.empty-state { text-align: center; padding: 90px 20px; color: var(--text-dim); }
.empty-icon { font-size: 3rem; margin-bottom: 14px; }
.empty-hint { font-size: 0.85rem; margin-top: 6px; }

.loading-state { display: grid; place-items: center; padding: 90px 0; }

.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── drag & drop ─────────────────────────────────────────────── */

.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 50;
}

.drop-box {
  border: 2px dashed var(--accent);
  border-radius: 20px;
  padding: 60px 80px;
  text-align: center;
  background: var(--accent-soft);
  font-size: 1.1rem;
}
.drop-icon { font-size: 3rem; margin-bottom: 12px; animation: bounce 0.9s ease infinite alternate; }
@keyframes bounce { from { transform: translateY(-6px); } to { transform: translateY(6px); } }

/* ── painel de uploads ───────────────────────────────────────── */

.upload-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 40;
}

.upload-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-hover);
  font-weight: 600;
  font-size: 0.92rem;
}

.upload-items { max-height: 320px; overflow-y: auto; }
.upload-panel.collapsed .upload-items { display: none; }

.upload-item { padding: 12px 16px; border-top: 1px solid var(--border); }

.upload-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.upload-item-name {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.upload-item-status { font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.upload-item.done .upload-item-status { color: var(--success); }
.upload-item.error .upload-item-status { color: var(--danger); }

.progress-track {
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ffb347);
  border-radius: 99px;
  transition: width 0.2s ease;
}
.upload-item.done .progress-fill { background: var(--success); }
.upload-item.error .progress-fill { background: var(--danger); }

/* ── modal ───────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 60;
}

.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  width: 400px;
  max-width: calc(100vw - 40px);
  box-shadow: var(--shadow);
}
.modal h2 { font-size: 1.05rem; margin-bottom: 8px; }
.modal p { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 16px; }

.modal-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 14px;
  margin-bottom: 18px;
  outline: none;
}
.modal-input:focus { border-color: var(--accent); }

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

/* ── toasts ──────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 70;
}

.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  animation: slide-in 0.25s ease;
  max-width: 360px;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── responsivo ──────────────────────────────────────────────── */

@media (max-width: 700px) {
  .file-row { grid-template-columns: 44px 1fr auto; }
  .file-thumb-wrap { width: 40px; height: 40px; border-radius: 8px; }
  .file-date { display: none; }
  .file-actions { opacity: 1; }
  .filter-input { width: 140px; }
}
