@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400..800&display=swap');

:root {
  --navy: #14213d;
  --navy-dark: #0b1526;
  --navy-light: #1e3358;
  --gold: #c9a24b;
  --gold-light: #e0c179;
  --bg: #f5f6f8;
  --text: #232a35;
  --text-muted: #6b7280;
  --border: #e3e6ec;
  --danger: #c0392b;
  --danger-dark: #96291d;
  --gray: #6b7684;
  --gray-dark: #545e6a;
}

* { box-sizing: border-box; }

body {
  font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
  font-weight: 520;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ===== SHAPKA ===== */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.topbar .brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.topbar .nav-links a {
  color: #b8c2d6;
  margin-left: 20px;
  font-size: 14px;
  font-weight: 650;
  transition: color .15s ease;
}
.topbar .nav-links a:hover { color: var(--gold-light); }

.nav-dropdown { position: relative; display: inline-block; margin-left: 20px; }
.nav-dropdown-toggle {
  color: #b8c2d6;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: color .15s ease;
  user-select: none;
}
.nav-dropdown.open .nav-dropdown-toggle,
.nav-dropdown:focus-within .nav-dropdown-toggle { color: var(--gold-light); }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  background: var(--navy);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 190px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.3);
  z-index: 50;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  margin-left: 0;
  padding: 9px 16px;
  color: #b8c2d6;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: rgba(255,255,255,0.08); color: var(--gold-light); }

.dashboard-hero {
  min-height: calc(100vh - 64px);
  background-color: #eaf2fb;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 40px;
  position: relative;
}
.dashboard-logo-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 6.4vh;
  padding-bottom: 6.4vh;
}
.dashboard-logo {
  width: 488px;
  height: 488px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(20,33,61,0.18);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 330px);
  gap: 24px;
  max-width: 1038px;
  position: relative;
}
.tile {
  background-size: cover;
  background-position: center;
  border-radius: 14px;
  padding: 30px 16px;
  min-height: 195px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  box-shadow: 0 8px 24px rgba(20,33,61,0.18);
  transition: transform .18s ease, box-shadow .18s ease;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  border: 1px solid transparent;
  border-top: 3px solid var(--gold);
}
.tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 30px rgba(20,33,61,0.28);
}

.container { max-width: 1200px; margin: 28px auto; padding: 0 20px; }
h1 { font-size: 24px; font-weight: 800; margin-bottom: 18px; color: var(--navy); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy-dark) 0%, var(--navy) 55%, var(--navy-light) 100%);
}
.login-box {
  background: #fff;
  padding: 40px 36px;
  border-radius: 14px;
  width: 340px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  border-top: 4px solid var(--gold);
}
.login-box h2 {
  margin-top: 0;
  text-align: center;
  color: var(--navy);
  font-weight: 800;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin: 12px 0 5px;
  font-weight: 780;
}
input[type=text], input[type=password], input[type=number], input[type=url],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=text]:focus, input[type=password]:focus, input[type=number]:focus,
input[type=url]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,75,0.15);
}
textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 800;
  font-family: inherit;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--navy-light); }
.btn:active { transform: translateY(1px); }
.btn.gray { background: var(--gray); }
.btn.gray:hover { background: var(--gray-dark); }
.btn.red { background: var(--danger); }
.btn.red:hover { background: var(--danger-dark); }
.btn.small { padding: 6px 14px; font-size: 12px; }

.filters {
  background: #fff;
  padding: 18px;
  border-radius: 12px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 16px;
  align-items: end;
  border: 1px solid var(--border);
}
.filters .full-row { grid-column: 1 / -1; text-align: right; }

table.list {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(20,33,61,0.06);
  border: 1px solid var(--border);
}
table.list th, table.list td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
table.list th {
  background: var(--navy);
  font-weight: 800;
  color: #fff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover { background: #f7f8fb; }
table.list tr.clickable-row { cursor: pointer; }
table.list tr.clickable-row:hover { background: #fbf7ec; }
.sort-link { cursor: pointer; white-space: nowrap; }
.sort-link:hover { text-decoration: underline; color: var(--gold-light); }
.actions-cell a, .actions-cell button { margin-right: 6px; font-size: 28px; line-height: 1; vertical-align: middle; }

.user-actions a, .user-actions .link-btn { margin-right: 10px; font-size: 13px; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--navy);
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--gold); }

.top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

/* Журнал дій: підсвітка невдалих спроб входу */
table.list tr.log-row-warn td { background: #fdecea; }
table.list tr.log-row-warn:hover td { background: #fbe0dc; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 26px;
  box-shadow: 0 2px 10px rgba(20,33,61,0.06);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px 24px;
  margin-bottom: 22px;
}
.card-grid .field-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 800;
}
.card-grid .field-value { font-size: 16px; font-weight: 800; color: var(--text); margin-top: 2px; }
.photos-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.photos-grid img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: transform .15s ease;
}
.photos-grid img:hover { transform: scale(1.03); }

/* Редагування фото об'єкта: мініатюри з позначкою на видалення */
.edit-photos { gap: 16px; }
.edit-photo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 780;
  color: var(--text-muted);
}
.edit-photo img {
  width: 150px;
  height: 112px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  outline: 3px solid transparent;
  outline-offset: 1px;
  transition: opacity .15s ease, filter .15s ease, outline-color .15s ease;
}
.edit-photo-del { display: inline-flex; align-items: center; gap: 5px; }
.edit-photo-del input { width: 15px; height: 15px; cursor: pointer; }
.edit-photo:has(input:checked) { color: var(--danger); }
.edit-photo:has(input:checked) img { opacity: .4; filter: grayscale(1); outline-color: var(--danger); }

/* Нові фото, які будуть додані після збереження */
.edit-photo.new-photo { color: #1a7a34; }
.edit-photo.new-photo img { outline-color: #1a7a34; }
.new-photo-remove {
  background: none;
  border: none;
  padding: 2px 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  color: #1a7a34;
  text-decoration: underline;
  cursor: pointer;
}
.new-photo-remove:hover { color: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 20px;
}
.form-grid .span-2 { grid-column: 1 / -1; }

@media (max-width: 720px) {
  .tiles { grid-template-columns: repeat(2, 1fr); max-width: 720px; }
  .form-grid { grid-template-columns: 1fr; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; }
}

/* Поля введення теж жирніші (інакше лишаються 400) */
input, select, textarea { font-weight: 520; }
