@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #f0f0ee; color: #111; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }

:root {
  --sidebar: 240px;
  --accent: #111;
  --red: #e53e3e;
  --green: #38a169;
  --orange: #f97316;
  --border: #e2e2e0;
  --card-bg: #ffffff;
  --transition: 0.2s ease;
}

/* ── Layout ─────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar); background: #111; color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
}
.sidebar__logo {
  padding: 28px 24px 24px;
  font-size: 11px; font-weight: 700; letter-spacing: 3px;
  color: rgba(255,255,255,0.4); text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar__logo strong { display: block; font-size: 20px; color: #fff; letter-spacing: 1px; margin-bottom: 4px; }
.sidebar__nav { flex: 1; padding: 20px 0; }
.sidebar__link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.6);
  transition: color var(--transition), background var(--transition);
}
.sidebar__link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar__link.active { color: #fff; background: rgba(255,255,255,0.07); border-left: 3px solid var(--orange); padding-left: 21px; }
.sidebar__link-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar__group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(255,255,255,0.3); padding: 20px 24px 6px;
}
.sidebar__footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar__logout {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: rgba(255,255,255,0.45);
  transition: color var(--transition);
}
.sidebar__logout:hover { color: #fff; }

/* ── Main content ───────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar); flex: 1;
  padding: 40px 48px; max-width: 1200px;
}

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 32px;
}
.page-title { font-size: 24px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: rgba(0,0,0,0.45); margin-top: 4px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  border-radius: 6px; transition: all var(--transition); cursor: pointer;
}
.btn-primary { background: #111; color: #fff; }
.btn-primary:hover { background: #333; }
.btn-secondary { background: #fff; color: #111; border: 1px solid var(--border); }
.btn-secondary:hover { background: #f5f5f5; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c53030; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: 6px; border: 1px solid var(--border); background: #fff; display:inline-flex; align-items:center; justify-content:center; }
.btn-icon:hover { background: #f5f5f5; }

/* ── Lucide icons ───────────────────────────────────────────── */
i[data-lucide] { display: inline-block; vertical-align: middle; width: 16px; height: 16px; stroke-width: 1.75; }
.sidebar__link-icon i[data-lucide] { width: 15px; height: 15px; }
.btn-icon i[data-lucide] { width: 15px; height: 15px; }
.order-btn i[data-lucide] { width: 13px; height: 13px; }
.cv-section-block__chevron i[data-lucide] { width: 15px; height: 15px; }
.empty-state__icon i[data-lucide] { width: 40px; height: 40px; stroke-width: 1.25; opacity: 0.3; }

/* ── Visibility toggle button ───────────────────────────────── */
.vis-btn {
  width: 28px; height: 28px; border: 1px solid rgba(0,0,0,0.15); border-radius: 6px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: rgba(0,0,0,0.25); padding: 0; transition: all 0.15s;
}
.vis-btn.is-on { background: #111; border-color: #111; color: #fff; }
.vis-btn:hover:not(.is-on) { background: #f0f0ee; border-color: rgba(0,0,0,0.3); color: rgba(0,0,0,0.7); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card-bg); border-radius: 10px;
  border: 1px solid var(--border); overflow: hidden;
}
.card__body { padding: 24px; }
.card__footer {
  padding: 16px 24px; background: #f9f9f7;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 12px;
}

/* ── Stats row ──────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: #fff; border-radius: 10px; border: 1px solid var(--border);
  padding: 24px; display: flex; flex-direction: column; gap: 8px;
}
.stat-card__label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: rgba(0,0,0,0.4); }
.stat-card__value { font-size: 36px; font-weight: 700; line-height: 1; color: var(--orange); }
.stat-card__sub { font-size: 12px; color: rgba(0,0,0,0.4); }

/* ── Project table ──────────────────────────────────────────── */
.project-table { width: 100%; border-collapse: collapse; }
.project-table th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--border); background: #fafaf8;
}
.project-table td { padding: 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.project-table tr:last-child td { border-bottom: none; }
.project-table tr:hover td { background: #fafaf8; }

.project-thumb {
  width: 72px; height: 48px; object-fit: cover;
  border-radius: 4px; background: #e0e0de;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #ccc; overflow: hidden; flex-shrink: 0;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-name-cell { display: flex; align-items: center; gap: 16px; }
.project-name { font-weight: 600; font-size: 14px; }
.project-id-text { font-size: 11px; color: rgba(0,0,0,0.35); margin-top: 2px; }

.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 100px; font-size: 11px; font-weight: 600;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray  { background: #f1f1ef; color: #666; }

/* toggle */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; width: 40px; height: 22px;
  display: inline-block;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__track {
  position: absolute; inset: 0; border-radius: 100px;
  background: #ddd; cursor: pointer;
  transition: background var(--transition);
}
.toggle input:checked + .toggle__track { background: #111; }
.toggle__track::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle__track::after { transform: translateX(18px); }
.toggle-label { font-size: 12px; color: rgba(0,0,0,0.5); }

/* actions */
.table-actions { display: flex; align-items: center; gap: 8px; }

/* ── Form ───────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; color: #111; }
.form-hint { font-size: 11px; color: rgba(0,0,0,0.4); margin-top: 2px; }
.form-control {
  padding: 10px 14px; font-size: 14px; color: #111;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { border-color: #111; box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
textarea.form-control { resize: vertical; min-height: 120px; line-height: 1.6; }
select.form-control { cursor: pointer; }

/* image upload */
.upload-zone {
  display: block;
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 32px; text-align: center; cursor: pointer;
  background: #fafaf8;
  transition: border-color var(--transition), background var(--transition);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: #111; background: #f0f0ee; }
.upload-zone__icon { font-size: 32px; margin-bottom: 8px; opacity: 0.4; }
.upload-zone__text { font-size: 13px; color: rgba(0,0,0,0.5); }
.upload-zone__text strong { color: #111; }

.preview-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.preview-item {
  position: relative; width: 120px; height: 80px;
  border-radius: 6px; overflow: hidden; background: #e0e0de;
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item__remove {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity var(--transition);
}
.preview-item:hover .preview-item__remove { opacity: 1; }

/* ── Alert ──────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px; border-radius: 8px; font-size: 13px;
  margin-bottom: 24px; display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Login ──────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #111;
}
.login-box {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 12px; overflow: hidden;
}
.login-box__header {
  background: #111; color: #fff;
  padding: 32px; text-align: center;
}
.login-box__logo {
  font-size: 32px; font-weight: 900; letter-spacing: 2px;
  font-family: 'Inter', sans-serif;
  display: inline-block; border: 3px solid #fff;
  padding: 6px 14px; margin-bottom: 12px;
}
.login-box__logo-img { max-height: 52px; max-width: 180px; width: auto; height: auto; object-fit: contain; display: block; margin: 0 auto 12px; filter: brightness(0) invert(1); }
.login-box__subtitle { font-size: 12px; color: rgba(255,255,255,0.5); letter-spacing: 2px; text-transform: uppercase; }
.login-box__body { padding: 32px; display: flex; flex-direction: column; gap: 20px; }
.login-submit {
  width: 100%; padding: 14px; background: #111; color: #fff;
  font-size: 14px; font-weight: 600; border-radius: 6px;
  transition: background var(--transition);
}
.login-submit:hover { background: #333; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 64px 24px;
  color: rgba(0,0,0,0.35); font-size: 14px;
}
.empty-state__icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state__title { font-weight: 600; color: #111; margin-bottom: 8px; }

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: rgba(0,0,0,0.4); margin-bottom: 24px; }
.breadcrumb a { color: rgba(0,0,0,0.4); transition: color var(--transition); }
.breadcrumb a:hover { color: #111; }
.breadcrumb__sep { opacity: 0.3; }

/* ── Burger button (hidden on desktop) ──────────────────────── */
.sidebar-burger {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 110;
  width: 40px; height: 40px;
  background: #111; border-radius: 8px;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer;
}
.sidebar-burger span {
  display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 105;
  background: rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.sidebar-overlay.is-open { opacity: 1; pointer-events: auto; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  body { overflow-x: hidden; }

  .sidebar-burger { display: flex; }
  .sidebar-overlay { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    z-index: 108;
  }
  .sidebar.is-open { transform: translateX(0); }

  .admin-layout { display: block; }

  .admin-main {
    margin-left: 0;
    padding: 72px 16px 48px;
    max-width: 100%;
  }

  .page-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .stats-row { grid-template-columns: 1fr; gap: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group--full { grid-column: 1; }

  .card { border-radius: 8px; overflow-x: auto; }

  .project-table { min-width: 0; }
  .project-table thead th:nth-child(3),
  .project-table tbody td:nth-child(3) { display: none; }

  .project-name-cell { gap: 10px; }
  .project-id-text { display: none; }
}

@media (max-width: 520px) {
  .admin-main { padding: 72px 12px 48px; }
  .project-table thead th:nth-child(2),
  .project-table tbody td:nth-child(2) { display: none; }
  .project-thumb { width: 48px; height: 32px; }
  .table-actions { gap: 4px; }
}

/* ── Confirm modal ──────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5); align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 10px; padding: 32px;
  max-width: 400px; width: 90%;
}
.modal__title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.modal__text { font-size: 14px; color: rgba(0,0,0,0.55); margin-bottom: 24px; line-height: 1.5; }
.modal__actions { display: flex; justify-content: flex-end; gap: 12px; }
