/* ─── GAUTH admin components ───────────────────────────────
   Admin dashboard, editor and file manager. Uses the same
   shell, tokens and bevels as the public site.
   --------------------------------------------------------- */

.admin-user {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ─── Admin layout ─────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .admin-layout { grid-template-columns: 1fr; }
}

.admin-posts,
.admin-files {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0;
}

.admin-posts h2,
.admin-files h2 {
  margin: 0;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(#f2f2f2, #dedede);
  border: 0;
  border-bottom: 1px solid var(--line);
}

.admin-files-link {
  margin-left: 12px;
  font-size: 11px;
  font-weight: 400;
}

/* ─── Admin table ──────────────────────────────────────── */
.admin-table {
  margin: 0;
  font-size: 12px;
}

.admin-table th { font-size: 11px; }

.row-draft td { color: #6b6b6b; }

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ─── Admin buttons ────────────────────────────────────── */
.admin-btn {
  display: inline-block;
  padding: 3px 12px;
  min-height: 26px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--chrome);
  border: 1px solid var(--line);
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
}

.admin-btn:hover,
.admin-btn:focus {
  background: #e4e4e4;
  color: var(--ink);
}

.admin-btn:active { box-shadow: inset 1px 1px 0 var(--lo); }

.admin-btn-sm {
  display: inline-block;
  padding: 1px 8px;
  min-height: 22px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--chrome);
  border: 1px solid var(--line);
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
}

.admin-btn-sm:hover,
.admin-btn-sm:focus { background: #e4e4e4; color: var(--ink); }

.admin-btn-sm:active { box-shadow: inset 1px 1px 0 var(--lo); }

.admin-btn-primary { font-weight: 700; }

.admin-btn-danger { color: #8a0000; }

.admin-btn-danger:hover,
.admin-btn-danger:focus { background: #eee1e1; color: #8a0000; }

/* ─── File upload form ─────────────────────────────────── */
.file-upload-form {
  margin: 0;
  padding: 8px;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: inset 1px 1px 0 var(--lo);
}

.admin-files .file-upload-form { margin: 8px; }

.file-upload-form label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
}

.file-upload-form input {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 2px;
  font-size: 12px;
}

.file-upload-form input[type=file] { padding: 2px; }

/* ─── File browser ─────────────────────────────────────── */
.file-browser {
  max-height: 400px;
  overflow-y: auto;
  padding: 4px 8px;
}

.file-folder { margin: 0 0 8px; }

.file-folder h3,
.file-folder h4 {
  margin: 0 0 4px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  background: none;
  border: 0;
}

.file-folder ul {
  margin: 0;
  padding: 0 0 0 12px;
  list-style: none;
}

.file-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
  flex-wrap: nowrap;
}

.file-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-item-name { word-break: break-all; }

.file-item-name a {
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 11px;
}

.file-meta {
  color: #6b6b6b;
  font-size: 10px;
}

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* ─── Small icon buttons ───────────────────────────────── */
.copy-address-btn,
.file-rename-btn,
.file-delete-btn,
.file-rename-save,
.file-rename-cancel {
  padding: 2px 5px;
  min-height: 20px;
  font-size: 12px;
  line-height: 1;
  color: var(--ink);
  background: var(--chrome);
  border: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
}

.copy-address-btn:active,
.file-rename-btn:active,
.file-delete-btn:active,
.file-rename-save:active,
.file-rename-cancel:active { box-shadow: inset 1px 1px 0 var(--lo); }

.copy-address-btn:hover,
.file-rename-btn:hover { background: #e4e4e4; }

.file-delete-btn:hover { background: #eee1e1; }

.file-rename-save:hover { background: #e3e9dd; }

.file-rename-cancel { color: #8a0000; }

.file-rename-cancel:hover { background: #eee1e1; }

/* ─── Inline rename ────────────────────────────────────── */
.file-rename-row { margin-top: 2px; }

.rename-form {
  display: flex;
  align-items: center;
  gap: 2px;
}

.file-rename-input {
  width: 180px;
  padding: 2px 4px;
  font-size: 11px;
  font-family: "Lucida Console", "Courier New", monospace;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: inset 1px 1px 0 var(--lo);
}

/* ─── Collapsible folder headers ───────────────────────── */
.file-folder-collapsible { margin: 0 0 4px; }

.file-folder-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 700;
  background: var(--chrome);
  border: 1px solid var(--line);
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
  cursor: pointer;
  user-select: none;
}

.file-folder-header:hover { background: #e4e4e4; }

.folder-toggle {
  display: inline-block;
  width: 12px;
  font-size: 10px;
}

.folder-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 400;
  color: #6b6b6b;
}

/* ─── Editor layout ────────────────────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .editor-layout { grid-template-columns: 1fr; }
}

.editor-form {
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.editor-fields {
  margin: 0 0 10px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.editor-fields legend {
  padding: 0 4px;
  font-size: 12px;
  font-weight: 700;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}

.field-row label {
  flex: 1;
  min-width: 160px;
  font-size: 12px;
}

.field-row input {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 2px;
  font-size: 12px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  flex: 0 !important;
  min-width: auto !important;
  padding-top: 18px;
}

.checkbox-label input[type=checkbox] {
  width: auto;
  margin: 0;
}

.editor-label {
  display: block;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.editor-label textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 3px;
  padding: 6px;
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  tab-size: 2;
}

.editor-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* ─── Editor sidebar ───────────────────────────────────── */
.editor-sidebar {
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 0;
  background: var(--chrome);
  border: 1px solid var(--line);
  font-size: 12px;
}

.editor-sidebar h3 {
  margin: 0;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(#f2f2f2, #dedede);
  border: 0;
  border-bottom: 1px solid var(--line);
}

.editor-sidebar .file-folder { padding: 4px 8px; }

.insert-file-btn {
  display: block;
  width: 100%;
  padding: 2px 6px;
  text-align: left;
  font-size: 11px;
  font-family: "Lucida Console", "Courier New", monospace;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
  cursor: pointer;
}

.insert-file-btn:hover,
.insert-file-btn:focus {
  background: #000080;
  color: #fff;
}

.editor-shortcuts {
  margin-top: 4px;
  padding: 8px;
  font-size: 11px;
  line-height: 1.8;
  border-top: 1px solid var(--line);
}

.editor-shortcuts h3 {
  margin: 0 0 6px;
  padding: 0;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: none;
  border: 0;
}

.editor-shortcuts code { font-size: 11px; }

/* ─── File manager ─────────────────────────────────────── */
.file-manager {
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.upload-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.upload-row label {
  flex: 1;
  min-width: 120px;
  margin: 0;
}

.upload-row button { flex-shrink: 0; }

/* ─── Breadcrumbs ──────────────────────────────────────── */
.file-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--chrome);
  border: 1px solid var(--line);
}

.file-breadcrumbs a {
  font-weight: 700;
  text-decoration: none;
}

.breadcrumb-sep {
  color: #6b6b6b;
  font-weight: 700;
}

.breadcrumb-current { font-weight: 700; }

/* ─── File grid ────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.file-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 140px;
  padding: 8px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
}

.file-card-folder { cursor: pointer; }

.file-card-folder:hover,
.file-card-folder:focus {
  background: #000080;
  color: #fff;
}

.file-card-folder:hover .file-card-name,
.file-card-folder:hover .file-card-meta { color: #fff; }

.file-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100px;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b6b6b;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: inset 1px 1px 0 var(--lo);
}

.file-card-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100px;
  margin-bottom: 4px;
  overflow: hidden;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: inset 1px 1px 0 var(--lo);
}

.file-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.file-card-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.file-card-meta {
  font-size: 10px;
  color: #6b6b6b;
}

.file-card-actions {
  display: flex;
  gap: 2px;
  margin-top: auto;
  padding-top: 4px;
  opacity: 0;
  transition: opacity .1s;
}

.file-card:hover .file-card-actions { opacity: 1; }

.file-card-rename {
  width: 100%;
  margin-top: 4px;
}

.file-card-rename .rename-form {
  display: flex;
  justify-content: center;
  gap: 2px;
}

.file-card-rename .file-rename-input {
  width: 120px;
  padding: 2px 3px;
  font-size: 10px;
}

/* ─── Login / register hint ────────────────────────────── */
.login-hint {
  margin: 0 0 12px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.5;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: inset 1px 1px 0 var(--lo);
}

.login-hint code { font-size: 11px; }

.login-register {
  margin: 12px 0 0;
  font-size: 12px;
}

/* ─── Responsive file grid ─────────────────────────────── */
@media (max-width: 600px) {
  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 4px;
  }

  .file-card {
    min-height: 110px;
    padding: 4px;
  }

  .file-card-icon { height: 70px; }
  .file-card-preview { height: 70px; }
  .file-card-actions { opacity: 1; }
}
