* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: #0f1117;
  color: #e8f0fe;
  height: 100vh;
  overflow: hidden;
}

/* ===================== HEADER ===================== */

header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.logo {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span { color: #ff6b6b; }

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ===================== BUTTONS ===================== */

.btn {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}

.btn-ghost {
  background: rgba(255,255,255,0.08);
  color: #e8f0fe;
  border: 1px solid rgba(255,255,255,0.12);
}

.btn-ghost:hover { background: rgba(255,255,255,0.14); }

.btn-primary {
  background: #ff6b6b;
  color: #fff;
}

.btn-primary:hover { background: #ff5252; transform: translateY(-1px); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-lost {
  width: 100%;
  padding: 7px;
  border-radius: 8px;
  background: rgba(255,165,0,0.15);
  color: #ffa500;
  border: 1px solid rgba(255,165,0,0.3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  margin-bottom: 6px;
}

.btn-lost:hover {
  background: rgba(255,165,0,0.25);
}

.btn-mate {
  width: 100%;
  padding: 7px;
  border-radius: 8px;
  background: rgba(255,105,180,0.15);
  color: #ff69b4;
  border: 1px solid rgba(255,105,180,0.3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  margin-bottom: 6px;
}

.btn-mate:hover { background: rgba(255,105,180,0.25); }

/* ===================== MAP ===================== */

#map {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
}

/* ===================== MARKER ===================== */
/* Кластер — основной кружок */
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: rgb(75 133 243 / 0.8) !important;
  color: #fff !important;
  font-family: 'Montserrat', sans-serif !important;
  font-weight: 700 !important;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgb(52 204 244) !important;
}

/* ===================== SEARCH ===================== */

.search-panel {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(15, 17, 23, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 30px;
  padding: 8px 12px 8px 18px;
  width: 520px;
  max-width: calc(100vw - 32px);
}

.search-panel input {
  background: none;
  border: none;
  outline: none;
  color: #e8f0fe;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  flex: 1;
}

.search-panel input::placeholder { color: rgba(232,240,254,0.4); }

/* ===================== FILTERS ===================== */

.filters {
  position: fixed;
  top: 130px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(15,17,23,0.8);
  backdrop-filter: blur(8px);
  color: rgba(232,240,254,0.7);
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}

.filter-btn:hover,
.filter-btn.active {
  background: #ff6b6b;
  border-color: #ff6b6b;
  color: #fff;
}

/* ===================== STATS ===================== */

.stats-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  gap: 1px;
  background: rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}

.stat {
  padding: 10px 20px;
  text-align: center;
  background: rgba(15,17,23,0.85);
  backdrop-filter: blur(8px);
}

.stat-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.stat-label {
  font-size: 11px;
  color: rgba(232,240,254,0.5);
  margin-top: 2px;
}

/* ===================== POPUP ===================== */

.pet-popup {
  background: #1a1d27;
  border-radius: 12px;
  overflow: hidden;
  min-width: 200px;
}

.pet-popup img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.pet-popup-body { padding: 12px; }

.pet-popup-name {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  margin-bottom: 4px;
}

.pet-popup-info {
  font-size: 12px;
  color: rgba(232,240,254,0.6);
  margin-bottom: 4px;
}

.pet-popup-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 4px;
  margin-bottom: 8px;
}

.tag-cat  { background: rgba(255,107,107,0.2); color: #ff6b6b; }
.tag-dog  { background: rgba(78,205,196,0.2);  color: #4ecdc4; }
.tag-lost { background: rgba(255,165,0,0.2);   color: #ffa500; }
.tag-mate { background: rgba(255,105,180,0.2); color: #ff69b4; }

.btn-contact {
  width: 100%;
  padding: 7px;
  border-radius: 8px;
  background: #ff6b6b;
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

/* ===================== SIDEBAR ===================== */

.sidebar {
  position: fixed;
  right: -360px;
  top: 0;
  bottom: 0;
  width: 360px;
  z-index: 600;
  background: #13151f;
  border-left: 1px solid rgba(255,255,255,0.08);
  transition: right 0.3s ease;
  padding: 70px 20px 20px;
  overflow-y: auto;
}

.sidebar.open { right: 0; }

.sidebar-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.close-sidebar {
  position: absolute;
  top: 76px;
  right: 20px;
  background: rgba(255,255,255,0.08);
  border: none;
  color: #e8f0fe;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===================== FORMS ===================== */

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 11px;
  color: rgba(232,240,254,0.5);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #e8f0fe;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus { border-color: #ff6b6b; }

.form-group select option { background: #1a1d27; }

.form-error {
  font-size: 12px;
  color: #ff6b6b;
  margin-top: 12px;
  text-align: center;
}

.form-success {
  font-size: 12px;
  color: #4ecdc4;
  margin-top: 12px;
  text-align: center;
}

/* ===================== AUTH MODAL ===================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 700;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #13151f;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 28px;
  width: 360px;
  max-width: calc(100vw - 32px);
}

.modal-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
}

.modal-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: rgba(232,240,254,0.5);
}

.modal-switch a {
  color: #ff6b6b;
  cursor: pointer;
  text-decoration: none;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  color: rgba(232,240,254,0.5);
  font-size: 20px;
  cursor: pointer;
  margin-top: -4px;
}

/* ===================== LEAFLET OVERRIDES ===================== */

.leaflet-popup-content-wrapper {
  background: #1a1d27 !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-radius: 12px !important;
  padding: 0 !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-tip { background: #1a1d27 !important; }
.leaflet-popup-content { margin: 0 !important; }


/* ===================== CHAT ROOMS ================ */
.chat-page {
      max-width: 720px;
      margin: 0 auto;
      padding: 80px 16px 40px;
    }

.rooms {
      display: flex;
      gap: 8px;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }

.room-btn {
      padding: 8px 16px;
      border-radius: 20px;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      border: 1px solid rgba(255,255,255,0.15);
      background: rgba(255,255,255,0.05);
      color: rgba(232,240,254,0.7);
      font-family: 'Inter', sans-serif;
      transition: all 0.15s;
    }

.room-btn.active,
.room-btn:hover {
      background: #ff6b6b;
      border-color: #ff6b6b;
      color: #fff;
    }

.chat-box {
      background: #13151f;
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 16px;
      padding: 16px;
      min-height: 400px;
      max-height: 500px;
      overflow-y: auto;
      margin-bottom: 12px;
      display: flex;
      flex-direction: column;
    }

.chat-empty {
      text-align: center;
      color: rgba(232,240,254,0.3);
      font-size: 14px;
      padding: 40px 0;
    }

.message {
      margin-bottom: 12px;
      display: flex;
      gap: 10px;
      align-items: flex-start;
    }

.message-avatar {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: rgba(255,107,107,0.2);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      flex-shrink: 0;
      color: #ff6b6b;
      font-weight: 700;
      font-family: 'Montserrat', sans-serif;
    }

.message-body { flex: 1; }

.message-header {
      display: flex;
      align-items: baseline;
      gap: 8px;
      margin-bottom: 4px;
    }

.message-name {
      font-size: 13px;
      font-weight: 600;
      color: #fff;
    }

.message-time {
      font-size: 11px;
      color: rgba(232,240,254,0.3);
    }

.message-text {
      font-size: 14px;
      color: rgba(232,240,254,0.85);
      line-height: 1.5;
      word-break: break-word;
    }

.message.own .message-avatar {
      background: rgba(78,205,196,0.2);
      color: #4ecdc4;
      order: 2;
    }

.message.own .message-body { order: 1; text-align: right; }
.message.own .message-header { flex-direction: row-reverse; }

.chat-input-area {
      display: flex;
      gap: 8px;
    }

.chat-input {
      flex: 1;
      padding: 12px 16px;
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 12px;
      color: #e8f0fe;
      font-size: 14px;
      font-family: 'Inter', sans-serif;
      outline: none;
      transition: border-color 0.15s;
    }

.chat-input:focus { border-color: #ff6b6b; }
.chat-input::placeholder { color: rgba(232,240,254,0.3); }

.chat-send {
      padding: 12px 20px;
      border-radius: 12px;
      background: #ff6b6b;
      color: #fff;
      border: none;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      font-family: 'Inter', sans-serif;
      transition: background 0.15s;
    }

.chat-send:hover { background: #ff5252; }
    .chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.not-auth-msg {
      text-align: center;
      color: rgba(232,240,254,0.4);
      font-size: 14px;
      padding: 12px;
    }

.not-auth-msg a {
      color: #ff6b6b;
      cursor: pointer;
      text-decoration: none;
    }



/* ===================== СТРАНИЦА ПИТОМЦА ===================== */

.pet-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 80px 16px 40px;
}

.pet-card-big {
  background: #13151f;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  overflow: hidden;
}

.pet-card-big img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.pet-card-big-placeholder {
  width: 100%;
  height: 280px;
  background: rgba(255,107,107,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
}

.pet-card-big-body { padding: 24px; }

.pet-card-big-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.pet-card-big-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.status-lost { background: rgba(255,165,0,0.2); color: #ffa500; }
.status-mate { background: rgba(255,105,180,0.2); color: #ff69b4; }
.status-active { background: rgba(78,205,196,0.2); color: #4ecdc4; }

.pet-info-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  color: rgba(232,240,254,0.7);
}

.pet-info-label {
  color: rgba(232,240,254,0.4);
  min-width: 80px;
}

.contact-block {
  margin-top: 20px;
  padding: 16px;
  background: rgba(255,107,107,0.08);
  border: 1px solid rgba(255,107,107,0.2);
  border-radius: 12px;
}

.contact-title {
  font-size: 12px;
  color: rgba(232,240,254,0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.contact-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.contact-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  margin-bottom: 8px;
  cursor: pointer;
  border: none;
}

.contact-phone {
  background: rgba(255,255,255,0.08);
  color: #e8f0fe;
}

.contact-telegram {
  background: rgba(0,136,204,0.15);
  color: #29b6f6;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(232,240,254,0.5);
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 20px;
}

.back-link:hover { color: #fff; }

.loading {
  text-align: center;
  color: rgba(232,240,254,0.3);
  padding: 60px 0;
  font-size: 16px;
}

.error {
  text-align: center;
  color: #ff5252;
  padding: 60px 0;
  font-size: 16px;
}


/* ===================== МОБИЛЬНАЯ НАВИГАЦИЯ ===================== */
@media (max-width: 768px) {

  /* Хедер */
  header {
    padding: 10px 16px;
    justify-content: space-between;
  }

  .logo { font-size: 16px; }

  /* Скрываем десктопные кнопки */
  #btn-add-pet,
  #btn-login,
  #btn-profile,
  #btn-logout {
    display: none !important;
  }

  /* Скрываем поиск и фильтры сверху */
  .search-panel { display: none; }
  .filters { display: none; }

  /* Нижняя навигация */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 600;
    background: rgba(15,17,23,0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 8px 0 20px;
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: rgba(232,240,254,0.5);
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: color 0.15s;
  }

  .mobile-nav-btn:active { color: #ff6b6b; }
  .mobile-nav-btn.active { color: #ff6b6b; }

  .mobile-nav-icon {
    font-size: 22px;
    line-height: 1;
  }

  /* Статистика */
  .stats-bar {
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
  }

  .stat {
    padding: 6px 12px;
  }

  .stat-num {
    font-size: 14px;
  }

  .stat-label {
    font-size: 10px;
  }

  /* Поиск снизу */
  .mobile-search {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    z-index: 550;
    background: rgba(15,17,23,0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 16px;
  }

  .mobile-search.open { display: block; }

  .mobile-search input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    color: #e8f0fe;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    outline: none;
  }

  /* Фильтры снизу */
  .mobile-filters {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    z-index: 550;
    background: rgba(15,17,23,0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 16px;
  }

  .mobile-filters.open { display: block; }

  .mobile-filters .filter-btn {
    display: inline-block;
    margin: 4px;
    padding: 8px 16px;
    font-size: 14px;
  }

  /* Геолокация */
  #btn-locate {
    bottom: 90px;
    top: 10px;
  }
}

/* Скрываем мобильную навигацию на десктопе */
.mobile-nav {
  display: none;
}