* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Arial, sans-serif;
}

body {
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* HEADER */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo {
  font-size: 28px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.3s, opacity 0.3s;
  user-select: none;
}

.logo:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.left-buttons {
  display: flex;
  gap: 10px;
}

/* MAIN ACTIONS */
.main-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 30px 0;
  padding: 0 20px;
}

/* BUTTONS */
.action-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn.red {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

.action-btn.blue {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

.action-btn.blue.active {
  background: linear-gradient(135deg, #1abc9c, #16a085);
  box-shadow: 0 4px 12px rgba(26, 188, 156, 0.3);
}

.action-btn.orange {
  background: linear-gradient(135deg, #e67e22, #d35400);
  color: white;
}

.action-btn.gray {
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  color: white;
}

.action-btn.active {
  box-shadow: inset 0 0 0 2px white;
}

.small-btn {
  padding: 6px 12px;
  background: #ecf0f1;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.small-btn:hover {
  background: #d5dbdb;
}

.small-btn.red {
  background: #fadbd8;
  border-color: #f1948a;
  color: #c0392b;
}

.small-btn.red:hover {
  background: #f5b7b1;
  transform: translateY(-1px);
}

.small-btn.green {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.small-btn.green:hover {
  background: #c3e6cb;
}

/* SECTIONS */
section {
  background: white;
  border-radius: 10px;
  padding: 25px;
  margin: 20px auto;
  max-width: 1000px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

#mainPage h2 {
  text-align: center;
  color: #2c3e50;
  margin: 20px 0 30px 0;
  font-size: 24px;
}

h2 {
  color: #2c3e50;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #3498db;
}

/* FILTERS */
.filter-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-row select, .filter-row input {
  flex: 1;
  min-width: 200px;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.filter-row select:focus, .filter-row input:focus {
  border-color: #3498db;
  outline: none;
}

.checkbox-group {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.range-block, .single-block {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.range-title {
  font-weight: 600;
  margin-bottom: 10px;
  color: #2c3e50;
}

.range-inputs {
  display: flex;
  gap: 15px;
}

.range-inputs input {
  flex: 1;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.single-block label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #2c3e50;
}

.single-block input, .single-block textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  resize: vertical;
}

/* PHOTO UPLOAD */
.photo-box {
  margin: 25px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #bdc3c7;
}

.photo-label {
  display: inline-block;
  padding: 15px 25px;
  background: #3498db;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}

.photo-label:hover {
  background: #2980b9;
}

.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding: 15px;
  background: white;
  border-radius: 6px;
  min-height: 100px;
}

.photo-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #ddd;
  transition: transform 0.3s;
  cursor: pointer;
}

.photo-preview img:hover {
  transform: scale(1.05);
}

/* LISTINGS */
.listings-container {
  margin-top: 25px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.listing {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
}

.listing:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.listing strong {
  color: #2c3e50;
  font-size: 18px;
  display: block;
  margin-bottom: 10px;
}

.listing img {
  max-width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
  margin: 10px 0;
}

.listing-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.favorite-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #eee;
  flex-wrap: wrap;
}

.favorite-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #e74c3c;
  background: white;
  cursor: pointer;
  position: relative;
  transition: all 0.3s;
  flex-shrink: 0;
}

.favorite-btn:hover {
  transform: scale(1.1);
}

.favorite-btn.active {
  background: #e74c3c;
}

.favorite-btn.active::after {
  content: '♥';
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
}

.favorite-text {
  flex-grow: 1;
  min-width: 120px;
}

.messages-counter {
  color: #3498db;
  font-size: 14px;
  white-space: nowrap;
  background: #f0f8ff;
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid #d6eaf8;
}

/* PANELS */
.panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  z-index: 1000;
  min-width: 400px;
  max-width: 90%;
}

.panel h3 {
  color: #2c3e50;
  margin-bottom: 20px;
  text-align: center;
}

.panel form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.panel label {
  font-weight: 600;
  color: #2c3e50;
}

.panel input {
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.panel textarea {
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  resize: vertical;
  min-height: 100px;
}

.closeBtn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 32px;
  height: 32px;
  border: none;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.closeBtn:hover {
  background: #c0392b;
}

/* CHAT */
.chat-messages {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 15px;
  background: #f8f9fa;
}

.chat-messages div {
  padding: 10px 15px;
  margin-bottom: 10px;
  background: white;
  border-radius: 6px;
  border-left: 4px solid #3498db;
}

/* POPUPS */
.offer-popup {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 1001;
  max-height: 150px;
  overflow-y: auto;
  min-width: 250px;
}

.offer-popup input {
  width: 100%;
  padding: 8px;
  margin: 8px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.offers-tooltip {
  position: absolute;
  background: #fff8e1;
  border: 1px solid #ffd54f;
  padding: 12px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1002;
  max-height: 150px;
  overflow-y: auto;
  min-width: 250px;
  font-size: 14px;
}

/* PHOTO MODAL */
.photo-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.photo-modal img {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  border-radius: 8px;
}

.photo-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 16px;
  border-radius: 20px;
}

/* UTILITY */
.hidden {
  display: none !important;
}

.error {
  color: #e74c3c;
  font-size: 14px;
  margin-top: 5px;
}

.success {
  color: #27ae60;
  font-size: 14px;
  margin-top: 5px;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #7f8c8d;
}

#rememberMe {
  accent-color: #3498db;
  width: 16px;
  height: 16px;
}

/* LANGUAGE SWITCHER */
.lang-switcher {
  display: flex;
  gap: 5px;
  margin-right: 20px;
}

.lang-btn {
  background: transparent;
  border: 1px solid white;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
}

.lang-btn:hover {
  background: rgba(255,255,255,0.2);
}

.lang-btn.active {
  background: white;
  color: #2c3e50;
}

/* Блоки подтверждения (SMS/email) */
#smsVerification, #emailVerification {
  margin-top: 20px;
  padding: 20px;
  background: #f0f8ff;
  border-radius: 8px;
  border: 1px solid #b8e0ff;
  text-align: center;
}

#smsVerification input, #emailVerification input {
  width: 150px;
  text-align: center;
  font-size: 24px;
  letter-spacing: 8px;
  margin: 15px auto;
  display: block;
}

#smsVerification button, #emailVerification button {
  margin: 5px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }

  .left-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }

  .main-actions {
    flex-direction: column;
    align-items: center;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-row select, .filter-row input {
    min-width: 100%;
  }

  .panel {
    min-width: 90%;
    padding: 20px;
  }

  .listings-container {
    grid-template-columns: 1fr;
  }
  
  .photo-modal img {
    max-width: 95%;
    max-height: 70%;
  }
  
  .favorite-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}