/* =====================
   TOKENS
   ===================== */
:root {
  --accent: #6c3fe8;
  --accent-2: #9d6ef8;
  --accent-soft: #ede9fe;
  --bg: #f4f4f7;
  --surface: #ffffff;
  --border: #e2e0ec;
  --text: #1c1917;
  --text-2: #57534e;
  --text-3: #a8a29e;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.12);
  --sidebar-w: 220px;
  --topbar-h: 60px;
  --font: 'Inter', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* =====================
   TOPBAR
   ===================== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  z-index: 100; box-shadow: var(--shadow);
}
.topbar-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  letter-spacing: -0.02em; margin-right: auto;
}
.logo-dot { width: 9px; height: 9px; background: var(--accent); border-radius: 50%; display: inline-block; }
.logo-accent { color: var(--accent); }
.topbar-badge {
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 50px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.topbar-actions { display: flex; gap: 8px; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 500;
  border: 1.5px solid var(--border); background: transparent; cursor: pointer;
  color: var(--text-2); transition: all 0.18s; white-space: nowrap;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-danger-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 500;
  border: 1.5px solid var(--border); background: transparent; cursor: pointer;
  color: var(--text-3); transition: all 0.18s;
}
.btn-danger-outline:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

/* =====================
   LAYOUT
   ===================== */
.admin-layout {
  display: flex; margin-top: var(--topbar-h); min-height: calc(100vh - var(--topbar-h));
}

/* =====================
   SIDEBAR
   ===================== */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 12px; position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.sidebar-section { margin-bottom: 24px; }
.sidebar-label {
  font-size: 0.7rem; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0 12px; margin-bottom: 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg); color: var(--text); }
.sidebar-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* =====================
   MAIN CONTENT
   ===================== */
.admin-main {
  flex: 1; padding: 32px; max-width: 900px;
}
.admin-section { display: none; }
.admin-section.active { display: block; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.section-title {
  font-family: var(--font-display); font-size: 1.4rem;
  font-weight: 700; color: var(--text);
}
.section-sub { font-size: 0.875rem; color: var(--text-3); margin-top: 2px; }

/* =====================
   CARDS / PANELS
   ===================== */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.panel-title {
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
}
.panel-title span { color: var(--accent); }

/* =====================
   FORMS
   ===================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.form-group .hint { font-size: 0.75rem; color: var(--text-3); margin-top: 3px; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group input[type="color"],
.form-group textarea,
.form-group select {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  font-size: 0.875rem; font-family: var(--font); color: var(--text);
  transition: border-color 0.2s; outline: none; resize: vertical;
}
.form-group input[type="color"] { padding: 4px 8px; height: 38px; cursor: pointer; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,63,232,0.1); }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-3); }

/* =====================
   CHECKBOXES (TECH TAGS)
   ===================== */
.tech-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.tech-check {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 50px; padding: 5px 12px;
  cursor: pointer; transition: all 0.15s; user-select: none;
  font-size: 0.8rem; font-weight: 500; color: var(--text-2);
}
.tech-check:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tech-check input { display: none; }
.tech-check.checked {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--accent); font-weight: 600;
}

/* =====================
   BUTTONS
   ===================== */
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: 8px; font-size: 0.875rem;
  font-weight: 600; font-family: var(--font);
  background: var(--accent); color: #fff; border: none;
  cursor: pointer; transition: all 0.18s; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(108,63,232,0.28);
}
.btn-primary:hover { background: #5830d0; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn-ghost-sm {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 6px; font-size: 0.8rem;
  font-weight: 500; border: 1.5px solid var(--border);
  background: transparent; cursor: pointer; color: var(--text-2);
  transition: all 0.15s; font-family: var(--font);
}
.btn-ghost-sm:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-delete-sm {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 6px; font-size: 0.8rem;
  font-weight: 500; border: 1.5px solid var(--border);
  background: transparent; cursor: pointer; color: var(--text-3);
  transition: all 0.15s; font-family: var(--font);
}
.btn-delete-sm:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

/* =====================
   ITEM LIST (projects/services)
   ===================== */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 18px;
  box-shadow: var(--shadow);
}
.item-color {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.item-icon {
  width: 36px; height: 36px; background: var(--accent-soft);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}
.item-icon svg { width: 18px; height: 18px; }
.item-info { flex: 1; min-width: 0; }
.item-info strong { display: block; font-size: 0.9rem; font-weight: 600; color: var(--text); }
.item-info span { font-size: 0.78rem; color: var(--text-3); }
.item-badge {
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.7rem; font-weight: 700; padding: 2px 8px;
  border-radius: 50px; text-transform: uppercase; letter-spacing: 0.06em;
  flex-shrink: 0;
}
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-3);
  font-size: 0.9rem;
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.4; }

/* =====================
   IMAGE UPLOAD
   ===================== */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 24px; text-align: center; cursor: pointer;
  transition: all 0.2s; position: relative; background: var(--bg);
}
.upload-area:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-area-text { font-size: 0.85rem; color: var(--text-3); }
.upload-area-text strong { display: block; color: var(--text-2); margin-bottom: 4px; font-size: 0.9rem; }
.upload-preview {
  margin-top: 12px; position: relative; display: inline-block;
}
.upload-preview img {
  width: 100%; max-height: 160px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.upload-preview .remove-img {
  position: absolute; top: -8px; right: -8px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--red); color: #fff; border: none; cursor: pointer;
  font-size: 14px; line-height: 24px; text-align: center; font-weight: 700;
}

/* =====================
   MULTI-IMAGE GRID
   ===================== */
.images-upload-grid {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px;
}
.img-thumb {
  position: relative; width: 100px; height: 76px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1.5px solid var(--border); flex-shrink: 0;
  background: var(--bg);
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb-remove {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.65); color: #fff; border: none;
  cursor: pointer; font-size: 11px; line-height: 20px;
  text-align: center; font-weight: 700; padding: 0;
  transition: background 0.15s;
}
.img-thumb-remove:hover { background: var(--red); }

/* =====================
   MODAL
   ===================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 200; display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px; overflow-y: auto;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 640px; box-shadow: var(--shadow-md);
  transform: translateY(16px); transition: transform 0.25s;
  margin-bottom: 40px;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px; border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; background: var(--bg);
  border: none; cursor: pointer; font-size: 18px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* =====================
   TOAST NOTIFICATIONS
   ===================== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 300;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--text); color: #fff; border-radius: 10px;
  padding: 12px 18px; font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-md); max-width: 340px;
  animation: slideIn 0.25s ease;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
@keyframes slideIn { from { transform: translateX(110%); } to { transform: translateX(0); } }

/* =====================
   LOGIN PAGE
   ===================== */
.login-body {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f4f3ff 0%, #ede9fe 100%);
}
.login-wrap {
  background: var(--surface); border-radius: var(--radius);
  padding: 48px 40px; width: 100%; max-width: 360px;
  box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.login-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  margin-bottom: 28px;
}
.login-title {
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 700;
  margin-bottom: 24px; color: var(--text);
}
.login-badge {
  background: var(--accent); color: #fff;
  font-size: 0.65rem; font-weight: 700; padding: 2px 8px;
  border-radius: 50px; margin-left: 4px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-back {
  display: block; text-align: center; margin-top: 20px;
  font-size: 0.85rem; color: var(--text-3); transition: color 0.2s;
}
.login-back:hover { color: var(--accent); }

/* =====================
   ALERTS
   ===================== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; margin-bottom: 16px;
}
.alert--error { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.alert--success { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }

/* =====================
   SAVE BAR
   ===================== */
.save-bar {
  position: sticky; bottom: 0; margin: 0 -32px -32px;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 16px 32px; display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; z-index: 10; box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.save-bar-note { font-size: 0.8rem; color: var(--text-3); margin-right: auto; }

/* =====================
   DIVIDER
   ===================== */
.divider {
  height: 1px; background: var(--border); margin: 24px 0;
}
.panel-subtitle {
  font-size: 0.8rem; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 14px;
}

/* =====================
   FILE EXPLORER
   ===================== */
.explorer-toolbar {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg); border-radius: var(--radius) var(--radius) 0 0;
}
.explorer-breadcrumb {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  font-size: 0.82rem; min-height: 24px;
}
.explorer-breadcrumb button {
  background: none; border: none; cursor: pointer; padding: 3px 7px;
  border-radius: 5px; color: var(--accent); font-size: 0.82rem;
  font-weight: 600; font-family: var(--font); transition: background 0.15s;
}
.explorer-breadcrumb button:hover { background: var(--accent-soft); }
.bc-sep { color: var(--text-3); padding: 0 2px; }
.explorer-list { padding: 8px; min-height: 100px; }
.explorer-loading {
  padding: 40px; text-align: center; color: var(--text-3); font-size: 0.875rem;
}
.explorer-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.explorer-row:hover { background: var(--bg); }
.explorer-row--file { opacity: 0.8; }
.explorer-icon {
  width: 34px; height: 34px; display: flex; align-items: center;
  justify-content: center; border-radius: 8px; flex-shrink: 0;
  background: var(--bg); color: var(--text-3);
}
.explorer-icon--dir { background: var(--accent-soft); color: var(--accent); }
.explorer-name { flex: 1; min-width: 0; overflow: hidden; }
.explorer-folder-btn {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: 0.9rem; font-weight: 600; color: var(--text);
  font-family: var(--font); text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; max-width: 100%; transition: color 0.15s;
}
.explorer-folder-btn:hover { color: var(--accent); }
.explorer-file-link {
  font-size: 0.9rem; font-weight: 500; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; text-decoration: none; transition: color 0.15s;
}
.explorer-file-link:hover { color: var(--accent); }
.explorer-file-plain {
  font-size: 0.9rem; color: var(--text-2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.explorer-meta { font-size: 0.75rem; color: var(--text-3); flex-shrink: 0; white-space: nowrap; }
.explorer-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* =====================
   HAMBURGER
   ===================== */
.btn-hamburger {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  background: transparent; border: 1.5px solid var(--border);
  cursor: pointer; color: var(--text-2); flex-shrink: 0;
  transition: all 0.15s;
}
.btn-hamburger:hover { background: var(--bg); color: var(--text); }

/* =====================
   SIDEBAR OVERLAY (mobile)
   ===================== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; top: var(--topbar-h);
  background: rgba(0,0,0,0.4); z-index: 140; backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 768px) {
  .btn-hamburger { display: flex; }

  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    z-index: 150; transform: translateX(-100%);
    transition: transform 0.25s ease; box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }

  .admin-main { padding: 20px 16px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .login-wrap { padding: 32px 24px; margin: 16px; }
}
