/* ===== Admin panel styles ===== */
[hidden] { display: none !important; }   /* .login and .app set display: grid, which would otherwise beat the hidden attribute */
:root {
  --bg: #0b0b12;
  --panel: #12121c;
  --panel2: #181826;
  --line: rgba(255,255,255,0.09);
  --text: #f0f0f6;
  --muted: #8b8b9e;
  --accent: #00f0ff;
  --accent2: #ff2ee6;
  --danger: #ff4d5e;
  --radius: 12px;
  --font: "Inter", system-ui, sans-serif;
  --display: "Space Grotesk", var(--font);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
::selection { background: var(--accent); color: #000; }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.65rem 1.3rem; border-radius: 99px; font-weight: 600; font-size: 0.9rem;
  transition: filter 0.2s, box-shadow 0.2s;
}
.btn-primary { background: linear-gradient(100deg, var(--accent), var(--accent2)); color: #05050a; }
.btn-primary:hover { box-shadow: 0 0 24px rgba(0, 240, 255, 0.35); }
.btn-ghost { border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-danger { background: rgba(255, 77, 94, 0.12); color: var(--danger); border: 1px solid rgba(255, 77, 94, 0.4); }
.btn-danger:hover { background: rgba(255, 77, 94, 0.22); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.mini-btn {
  font-size: 0.78rem; padding: 0.3rem 0.8rem; border-radius: 99px;
  border: 1px solid var(--line); color: var(--muted); transition: all 0.2s;
}
.mini-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); }
.icon-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ===== login ===== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 2.6rem 2.2rem; text-align: center;
  display: flex; flex-direction: column; gap: 1rem;
}
.login-mark { width: 54px; margin: 0 auto 0.4rem; }
.login-card h1 { font-family: var(--display); font-size: 1.5rem; }
.login-sub { color: var(--muted); font-size: 0.9rem; margin-top: -0.6rem; }
.login-card input {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.85rem 1rem; outline: none; text-align: center;
}
.login-card input:focus { border-color: var(--accent); }
.login-error { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; }

/* ===== layout ===== */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line); padding: 1.6rem 1rem;
  display: flex; flex-direction: column; gap: 1.6rem;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  font-family: var(--display); font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; font-size: 0.9rem; padding: 0 0.8rem;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.sidebar-foot { display: flex; flex-direction: column; gap: 0.3rem; }
.side-link {
  text-align: left; padding: 0.7rem 0.9rem; border-radius: 10px;
  color: var(--muted); font-size: 0.92rem; text-decoration: none; display: block;
  transition: all 0.2s;
}
.side-link:hover { color: var(--text); background: var(--panel); }
.side-link.is-active { color: var(--text); background: var(--panel2); box-shadow: inset 2px 0 0 var(--accent); }

.main { padding: 2.2rem clamp(1.2rem, 3.5vw, 3rem); max-width: 1000px; }
.main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.main-head h2 { font-family: var(--display); font-size: 1.7rem; }
.head-sub { color: var(--muted); font-size: 0.88rem; }
.empty { color: var(--muted); text-align: center; padding: 3rem; }

/* ===== project list ===== */
.plist { display: flex; flex-direction: column; gap: 0.7rem; }
.prow {
  display: flex; align-items: center; gap: 1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.7rem 1rem;
  transition: border-color 0.2s, opacity 0.2s, transform 0.2s;
}
.prow.dragging { opacity: 0.4; }
.prow.drag-over { border-color: var(--accent); }
.prow-handle { cursor: grab; color: var(--muted); font-size: 1.1rem; letter-spacing: -2px; user-select: none; }
.prow-thumb {
  width: 74px; height: 48px; border-radius: 8px; object-fit: cover;
  background: var(--panel2); border: 1px solid var(--line); flex: none;
}
.prow-info { flex: 1; min-width: 0; }
.prow-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-meta { font-size: 0.78rem; color: var(--muted); }
.chip {
  font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.2rem 0.6rem; border-radius: 99px; border: 1px solid var(--line);
}
.chip.physical { color: var(--accent2); border-color: rgba(255, 46, 230, 0.4); }
.chip.software { color: var(--accent); border-color: rgba(0, 240, 255, 0.4); }
.chip.featured { color: #ffd84d; border-color: rgba(255, 216, 77, 0.4); }

.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; z-index: 2; margin: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 99px; background: var(--panel2);
  border: 1px solid var(--line); transition: background 0.2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--muted); transition: all 0.2s;
}
.switch input:checked + .track { background: rgba(0, 240, 255, 0.25); border-color: var(--accent); }
.switch input:checked + .track::after { left: 20px; background: var(--accent); }

.prow-actions { display: flex; gap: 0.4rem; }
.prow-actions .mini-btn { white-space: nowrap; }

/* ===== forms ===== */
.form { display: flex; flex-direction: column; gap: 1.1rem; }
.form label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.form label small { color: var(--muted); font-weight: 400; }
.form input, .form textarea, .form select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.7rem 0.9rem; outline: none; color: var(--text); width: 100%;
  transition: border-color 0.2s;
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--accent); }
.form input[type="color"] { padding: 0.2rem; height: 44px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
textarea { resize: vertical; }

.dyn-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.dyn-head { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; color: var(--muted); font-weight: 500; margin-bottom: 0.7rem; }
.dyn-row { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 0.6rem; margin-bottom: 0.6rem; }
.dyn-row input { padding: 0.55rem 0.8rem; }
.dyn-row .icon-btn { width: 32px; height: 32px; font-size: 0.8rem; align-self: center; }

/* ===== uploads ===== */
.upload-block { display: flex; flex-direction: column; gap: 0.6rem; }
.upload-label { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.cover-drop {
  position: relative; border: 1.5px dashed var(--line); border-radius: var(--radius);
  aspect-ratio: 16/7; display: grid; place-items: center; cursor: pointer; overflow: hidden;
  color: var(--muted); font-size: 0.88rem; transition: border-color 0.2s;
}
.cover-drop:hover, .cover-drop.over { border-color: var(--accent); color: var(--text); }
.cover-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-drop img + #coverHint { position: relative; z-index: 2; background: rgba(0,0,0,0.55); padding: 0.3rem 0.8rem; border-radius: 8px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.6rem; }
.gallery-item { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.gallery-item img, .gallery-item video { width: 100%; height: 100%; object-fit: cover; }
.gallery-item button {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 0.7rem;
}
.gallery-item button:hover { background: var(--danger); }

.check-row { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.check { flex-direction: row !important; align-items: center; gap: 0.5rem !important; color: var(--text) !important; }
.check input { width: auto !important; accent-color: var(--accent); }

/* ===== drawer ===== */
.drawer-wrap { position: fixed; inset: 0; z-index: 50; }
.drawer-bg { position: absolute; inset: 0; background: rgba(5,5,10,0.6); backdrop-filter: blur(3px); }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 100%);
  background: var(--bg); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  animation: slideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.3rem 1.6rem; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { font-family: var(--display); font-size: 1.2rem; }
.drawer-body { padding: 1.6rem; overflow-y: auto; flex: 1; }
.drawer-foot {
  display: flex; gap: 0.7rem; align-items: center;
  padding-top: 1.2rem; border-top: 1px solid var(--line); margin-top: 0.4rem;
  position: sticky; bottom: 0; background: var(--bg); padding-bottom: 0.2rem;
}
.spacer { flex: 1; }

/* ===== toast ===== */
.toast {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translate(-50%, 150%);
  z-index: 100; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 0.8rem 1.3rem; font-size: 0.9rem;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.55);
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); color: var(--danger); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 0.8rem 1rem; }
  .sidebar-nav { flex-direction: row; }
  .sidebar-foot { flex-direction: row; margin-left: auto; }
  .sidebar-brand { display: none; }
}

/* Hebrew fields: a collapsible block, right-to-left */
.he-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; display: grid; gap: 0.9rem; }
.he-block summary { cursor: pointer; font-weight: 600; }
.he-block[open] summary { margin-bottom: 0.2rem; }
.stat-row { grid-template-columns: 0.8fr 1.4fr 1.2fr auto; }
