/* Gesturo Admin — dark, minimal, no framework */
:root {
  --bg: #050a12;
  --bg-2: #0a1422;
  --border: #1e2d40;
  --text: #e6edf5;
  --muted: #6a8aa8;
  --dim: #3a5570;
  --accent: #2983eb;
  --accent-hover: #4499f5;
  --danger: #e24b4a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; }
body { display: flex; flex-direction: column; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.muted { color: var(--muted); font-size: 12px; }
.msg { font-size: 13px; padding: 8px 0; min-height: 20px; }
.msg.err { color: var(--danger); }
.msg.ok  { color: #5fcf7f; }

/* LOGIN */
#screen-login { display: flex; align-items: center; justify-content: center; flex: 1; }
.login-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 36px 32px; width: 360px; max-width: 92vw; }
.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.login-card p { margin-bottom: 18px; }
#login-form { display: flex; flex-direction: column; gap: 10px; }
#login-form input { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 11px 14px; font-size: 14px; outline: none; }
#login-form input:focus { border-color: var(--accent); }
#login-form button { background: var(--accent); border: none; border-radius: 8px; color: #fff; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; }
#login-form button:hover { background: var(--accent-hover); }
#login-form button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ADMIN */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.brand { font-size: 16px; font-weight: 600; }
.user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.user button { background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); padding: 6px 12px; font-size: 12px; cursor: pointer; }
.user button:hover { color: var(--text); border-color: var(--accent); }

.toolbar { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.nav-arrows { display: flex; gap: 4px; margin-right: 8px; }
.nav-btn { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); width: 34px; height: 34px; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.nav-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.roots { display: flex; gap: 6px; }
.root-btn { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; color: var(--muted); padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.root-btn:hover { color: var(--text); border-color: var(--accent); }
.root-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.add-btn { background: var(--accent); border: none; border-radius: 6px; color: #fff; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.add-btn:hover { background: var(--accent-hover); }

/* Context menu */
.ctx-menu { position: fixed; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px; min-width: 160px; z-index: 150; box-shadow: 0 8px 24px rgba(0,0,0,0.6); }
.ctx-menu.hidden { display: none; }
.ctx-item { display: block; width: 100%; text-align: left; background: transparent; border: none; color: var(--text); padding: 9px 12px; font-size: 13px; cursor: pointer; border-radius: 4px; }
.ctx-item:hover { background: var(--accent); color: #fff; }
.ctx-danger { color: var(--danger); }
.ctx-danger:hover { background: var(--danger); color: #fff; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 4px; padding: 12px 24px; border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.breadcrumb .crumb { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 4px; font-size: 13px; }
.breadcrumb .crumb:hover { color: var(--text); background: var(--bg-2); }
.breadcrumb .crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.breadcrumb .crumb.current:hover { background: transparent; }
.breadcrumb .sep { color: var(--dim); padding: 0 2px; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 16px 24px; }
.grid-item { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; aspect-ratio: 1; position: relative; cursor: pointer; transition: transform 0.1s, border-color 0.1s; }
.grid-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.grid-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid-item .label { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.85)); color: #fff; font-size: 10px; padding: 14px 8px 6px; word-break: break-all; }
.grid-item.folder { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 10px; background: linear-gradient(180deg, #0d1828 0%, #0a1422 100%); border-color: #2a3a52; }
.grid-item.folder:hover { background: linear-gradient(180deg, #142238 0%, #0f1a2a 100%); border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(41, 131, 235, 0.2); }
.grid-item.folder .icon { font-size: 56px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.grid-item.folder .name { color: var(--text); font-size: 13px; font-weight: 600; text-align: center; word-break: break-word; }
.grid-item.folder .hint { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0; transition: opacity 0.15s; }
.grid-item.folder:hover .hint { opacity: 1; }
.grid-item.folder.drop-hover { background: linear-gradient(180deg, #1c3556 0%, #15243d 100%); border-color: var(--accent); transform: scale(1.04); box-shadow: 0 0 0 3px rgba(41, 131, 235, 0.4); }
.breadcrumb .crumb.drop-hover { background: var(--accent); color: #fff; }
#grid-msg { padding: 14px 24px; }

/* Drop zone overlay */
.grid-wrap { position: relative; min-height: 200px; }
.drop-overlay { position: absolute; inset: 0; background: rgba(5,10,18,0.92); border: 3px dashed var(--accent); border-radius: 12px; margin: 16px 24px; display: none; align-items: center; justify-content: center; pointer-events: none; z-index: 30; }
.drop-overlay.visible { display: flex; }
.drop-card { text-align: center; }
.drop-icon { font-size: 64px; line-height: 1; color: var(--accent); margin-bottom: 14px; }
.drop-text { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.drop-prefix { font-size: 12px; color: var(--muted); font-family: monospace; }

/* Upload progress bar (sticky) */
.upload-bar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-2); border-top: 1px solid var(--accent); padding: 12px 24px; z-index: 60; }
.upload-bar.hidden { display: none; }
.upload-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
#upload-status { color: var(--text); font-weight: 500; }
.upload-progress { background: var(--bg); border-radius: 4px; height: 6px; overflow: hidden; }
#upload-progress-fill { background: var(--accent); height: 100%; width: 0%; transition: width 0.2s; }

/* Selection state on grid items */
.grid-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.grid-item .check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: rgba(5,10,18,0.85); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; color: transparent; font-size: 14px; font-weight: 700; }
.grid-item.selected .check { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Action bar (sticky at bottom) */
.action-bar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-2); border-top: 1px solid var(--border); padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; z-index: 50; box-shadow: 0 -8px 24px rgba(0,0,0,0.4); }
.action-bar.hidden { display: none; }
#selection-count { font-size: 13px; color: var(--text); font-weight: 500; }
.action-bar-buttons { display: flex; gap: 8px; }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: var(--danger); border: none; border-radius: 6px; color: #fff; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-danger:hover { background: #f15c5b; }
.btn-ghost { background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); padding: 8px 16px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { color: var(--text); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 100; display: flex; align-items: center; justify-content: center; }
.lightbox.hidden { display: none; }
.lightbox img { max-width: 95vw; max-height: 95vh; object-fit: contain; }
.lightbox-close { position: absolute; top: 20px; right: 24px; background: transparent; border: none; color: #fff; font-size: 38px; line-height: 1; cursor: pointer; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-backdrop.hidden { display: none; }
.modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 440px; max-width: 92vw; }
.modal h2 { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.modal p { color: var(--muted); margin-bottom: 14px; line-height: 1.5; }
.modal #confirm-extra input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 10px 12px; font-size: 13px; outline: none; margin-bottom: 14px; }
.modal-buttons { display: flex; gap: 8px; justify-content: flex-end; }
