/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN PANEL — styles.css
   Design system mirrors irakli.uk exactly.
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Variables (matches gui/styles.css) ───────────────────────────────────── */
:root {
  --bg:       #0b0b0b;
  --surface:  #111111;
  --surface2: #0d0d0d;
  --border:   #1e1e1e;
  --border2:  #2a2a2a;
  --text:     #e8e8e8;
  --muted:    #777777;
  --dim:      #3a3a3a;
  --blue:     #1793d1;
  --green:    #3da65c;
  --red:      #ff4444;
  --yellow:   #d4a03a;
  --mono:     'IBM Plex Mono', 'Courier New', monospace;
  --display:  'Syne', sans-serif;
  --transition: all 0.18s ease;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
html { -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  line-height: 1.5;
}

/* Grid overlay — same as main site */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 52px 52px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ── Mac window ───────────────────────────────────────────────────────────── */
.mac-window {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border2);
}

/* ── Titlebar ─────────────────────────────────────────────────────────────── */
.mac-titlebar {
  background: #161616;
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 34px;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

.mac-buttons { display: flex; gap: 7px; align-items: center; }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: filter .15s;
  position: relative;
}
.dot.red    { background: #d45452; }
.dot.yellow { background: #d4a03a; }
.dot.green  { background: #3da65c; }
.dot:hover  { filter: brightness(1.2); }

.mac-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.logout-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: var(--transition);
}
.logout-btn:hover { color: var(--red); border-color: var(--red); }

/* ── Body layout ──────────────────────────────────────────────────────────── */
.mac-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--surface2);
  border-right: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-label {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.sidebar-sublabel {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.sidebar nav {
  padding: 10px 0;
  flex: 1;
}

.sidebar-section-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 10px 18px 4px;
}

.sidebar nav ul { padding: 0; }

.sidebar nav ul li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.03em;
  transition: var(--transition);
  border-left: 2px solid transparent;
  cursor: pointer;
}
.sidebar nav ul li a:hover {
  color: var(--text);
  background: rgba(255,255,255,.03);
}
.sidebar nav ul li a.active {
  color: var(--text);
  border-left-color: var(--blue);
  background: rgba(23,147,209,.06);
  padding-left: 20px;
}
.sidebar nav ul li a.active .prefix { color: var(--blue); opacity: 1; }

.prefix {
  font-size: 10px;
  color: var(--blue);
  opacity: 0.5;
  min-width: 18px;
  transition: opacity .18s;
}
.sidebar nav ul li a:hover .prefix { opacity: 0.85; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 18px;
}

/* ── Content area ─────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 0 36px 36px;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── Section headers (sticky) ─────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 22px 0 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  position: relative;
}

.section-subtitle {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.02em;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 7px 16px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: #1580bc; }

.btn-danger {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}
.btn-danger:hover { background: rgba(255,68,68,.12); }

.btn-ghost {
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }

.btn-sm { padding: 4px 10px; font-size: 10px; }

/* ── Cards / lists ────────────────────────────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  transition: border-color .18s, box-shadow .18s;
}
.card:hover {
  border-color: var(--border2);
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}

.card-info { flex: 1; min-width: 0; }
.card-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.card-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  letter-spacing: 0.02em;
}
.card-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: 1px solid transparent;
}
.badge-blue   { background: rgba(23,147,209,.1);  border-color: rgba(23,147,209,.3);  color: var(--blue);   }
.badge-green  { background: rgba(61,166,92,.1);   border-color: rgba(61,166,92,.3);   color: var(--green);  }
.badge-yellow { background: rgba(212,160,58,.1);  border-color: rgba(212,160,58,.3);  color: var(--yellow); }
.badge-red    { background: rgba(255,68,68,.1);   border-color: rgba(255,68,68,.3);   color: var(--red);    }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border2);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 9px 16px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

label, .form-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 5px;
}

input[type="text"],
input[type="url"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  outline: none;
  transition: border-color .18s;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
}
select { cursor: pointer; }
textarea { min-height: 80px; line-height: 1.5; }

input::placeholder, textarea::placeholder { color: var(--dim); }

.form-section-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--blue);
  margin: 22px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border2);
  position: relative;
}
.form-section-title::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 24px; height: 1px;
  background: var(--blue);
}

/* ── Dynamic list ─────────────────────────────────────────────────────────── */
.dyn-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.dyn-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.dyn-item > input, .dyn-item > textarea { flex: 1; }

.dyn-item .remove-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
  width: 32px;
  height: 32px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.dyn-item .remove-btn:hover { background: rgba(255,68,68,.1); border-color: var(--red); color: var(--red); }

.add-item-btn {
  background: none;
  border: 1px dashed var(--border2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 7px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}
.add-item-btn:hover { color: var(--text); border-color: var(--muted); }

/* ── Entry cards ──────────────────────────────────────────────────────────── */
.entry-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 16px;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
  transition: border-color .18s;
}
.entry-card:focus-within { border-color: rgba(23,147,209,.4); }

.entry-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--dim);
}

.row-controls { display: flex; gap: 4px; align-items: center; }

.reorder-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 11px;
  width: 24px;
  height: 24px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  padding: 0;
}
.reorder-btn:hover { color: var(--text); border-color: var(--muted); }

/* ── File input ───────────────────────────────────────────────────────────── */
input[type="file"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  transition: border-color .18s;
}
input[type="file"]:hover { border-color: var(--blue); }
input[type="file"]::file-selector-button {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  cursor: pointer;
  margin-right: 10px;
  transition: var(--transition);
}
input[type="file"]::file-selector-button:hover { border-color: var(--blue); color: var(--blue); }

/* ── Upload preview ───────────────────────────────────────────────────────── */
.upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--green);
}
.upload-preview img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 3px;
}

/* ── Portfolio sub-tabs ───────────────────────────────────────────────────── */
.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 22px;
}

.sub-tab-btn {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 3px;
  cursor: pointer;
  transition: var(--transition);
}
.sub-tab-btn:hover { color: var(--text); border-color: var(--muted); }
.sub-tab-btn.active {
  color: var(--blue);
  border-color: var(--blue);
  background: rgba(23,147,209,.08);
}

.sub-pane { display: none; }
.sub-pane.active { display: block; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 6px;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.8);
}
.modal.wide { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  transition: color .15s;
}
.modal-close:hover { color: var(--red); }

.modal-body { flex: 1; overflow-y: auto; padding: 20px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border2);
  flex-shrink: 0;
}

/* ── Confirm dialog ───────────────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.confirm-overlay.open { display: flex; }

.confirm-dialog {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 24px 24px 18px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 80px rgba(0,0,0,.8);
}

.confirm-msg {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
  word-break: break-word;
}

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

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 300;
  pointer-events: none;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red);   }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--dim);
  padding: 48px 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ── Image grid ───────────────────────────────────────────────────────────── */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.img-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 10px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color .18s;
}
.img-card:hover { border-color: var(--muted); }

.img-thumb {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 2px;
}

.img-name {
  font-size: 10px;
  color: var(--muted);
  word-break: break-all;
  text-align: center;
  line-height: 1.4;
}

/* ── Rich text editor ─────────────────────────────────────────────────────── */
.rte-container {
  border: 1px solid var(--border2);
  border-radius: 3px;
  overflow: hidden;
}

.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
  flex-wrap: wrap;
}

.rte-format-select {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
}
.rte-format-select:focus { border-color: var(--blue); }

.rte-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  line-height: 1;
}
.rte-btn:hover { background: var(--border2); border-color: var(--border2); }

.rte-sep {
  width: 1px;
  height: 16px;
  background: var(--border2);
  margin: 0 4px;
  flex-shrink: 0;
}

.rte-body {
  padding: 10px 12px;
  min-height: 120px;
  max-height: 360px;
  overflow-y: auto;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  background: var(--surface2);
  outline: none;
}
.rte-body:focus { box-shadow: inset 0 0 0 1px var(--blue); }
.rte-body ul, .rte-body ol { padding-left: 20px; }
.rte-body b, .rte-body strong { color: #fff; }

/* ── Color picker (tag rows) ──────────────────────────────────────────────── */
input[type="color"].tag-color-pick {
  -webkit-appearance: none;
  padding: 2px;
  cursor: pointer;
}
input[type="color"].tag-color-pick::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].tag-color-pick::-webkit-color-swatch { border: none; border-radius: 2px; }

/* ── Scrollbar (global) ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
