/* Listings pages styles */

.listings-main {
  padding: 0;
}

.listings-main .listings-header {
  margin-bottom: 20px;
}

.listings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.listings-header h1 {
  margin: 0;
}

.listings-page-title {
  margin: 0 0 20px 0;
}

.btn-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  font-size: 1rem;
  background: #00274C;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
}

.btn-create:hover {
  opacity: 0.9;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.listing-card {
  width: 100%;
  max-width: 340px;
  border: 1px solid #e2e4e8;
  border-radius: 12px;
  padding: 16px;
  background: white;
  box-shadow: 0 2px 12px rgba(0, 39, 76, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  min-width: 0;              
  overflow-wrap: anywhere;  
  box-sizing: border-box;  
  display: flex;
  flex-direction: column;
}

.listing-card:hover {
  box-shadow: 0 8px 24px rgba(0, 39, 76, 0.12);
  transform: translateY(-2px);
  border-color: #c5d0dc;
}

.listing-card-image-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #f0f2f5;
}

.listing-card h3 {
  margin: 0 0 8px 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.listing-card-title {
  color: #111;
  text-decoration: none;
  font-weight: 500;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.listing-card-title:hover {
  text-decoration: underline;
}

.listing-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.listing-card-title-row h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.listing-card-btn {
  flex-shrink: 0;
  margin-left: auto;
  padding: 6px;
  background: #00274C;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.listing-card-btn:hover {
  opacity: 0.9;
}

.listing-card-price {
  margin: 0 0 8px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #00274C;
}

.listing-card-location {
  display: inline-block;
  color: #555;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.listing-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #eee;
  margin-top: auto; /* push actions to bottom of the card */
}

.listing-card-actions form {
  margin: 0;
}

.listing-card-actions .btn-edit-sm,
.listing-card-actions .btn-delete-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.listing-card-actions .btn-delete-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.listing-card-meta {
  margin: 0 0 6px 0;
  color: #555;
  font-size: 0.9rem;
}

.listing-card-desc {
  margin: 0;
  color: #444;
  font-size: 0.9rem;
}

.listings-empty {
  margin: 0;
  color: #555;
}

/* Show page */
.listings-show-main {
  padding: 24px 20px;
  max-width: 720px;
  margin: 0 auto;
}

.listings-back-link {
  margin: 0 0 20px 0;
}

.listings-back-link-a {
  color: #555;
  text-decoration: none;
  font-size: 0.95rem;
}

.listings-back-link-a:hover {
  color: #00274C;
  text-decoration: underline;
}

.listing-detail {
  border: 1px solid #e2e4e8;
  border-radius: 16px;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 20px rgba(0, 39, 76, 0.08);
}

.listing-detail-image-wrap {
  aspect-ratio: 16 / 10;
  max-height: 420px;
  overflow: hidden;
  background: #f0f2f5;
}

.listing-detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-detail-image-placeholder {
  width: 100%;
  height: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 1.1rem;
  background: #e8eaee;
}

.listing-detail-content {
  padding: 24px 24px 28px;
}

.listing-detail-title {
  margin: 0 0 12px 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: #111;
  line-height: 1.3;
}

.listing-detail-price {
  margin: 0 0 16px 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #00274C;
}

.listing-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.listing-detail-tag {
  display: inline-block;
  padding: 6px 12px;
  background: #f0f2f5;
  color: #444;
  font-size: 0.9rem;
  border-radius: 8px;
}

.listing-detail-tag-location {
  background: #e8f0f8;
  color: #00274C;
}

.listing-detail-tag-condition {
  background: #fff3cd;
  color: #8a5a00;
}

.listing-detail-section-title {
  margin: 0 0 10px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.listing-detail-body {
  margin: 0 0 24px 0;
  color: #444;
  line-height: 1.6;
  font-size: 1rem;
}

.listing-detail-body p {
  margin: 0 0 10px 0;
}

.listing-detail-body p:last-child {
  margin-bottom: 0;
}

.listing-actions {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.listing-actions-owner {
  padding-top: 16px;
  border-top: 1px solid #e2e4e8;
}

.btn-message-seller {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #00274C;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-report-seller {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #C0392B;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-message-seller:hover {
  background: #001a33;
  transform: translateY(-1px);
}

/* IF MOBILE */
@media (max-width: 600px) {
    .listings-grid,
    .home-listings-grid {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .listing-card {
        width: 100%;
    }

    .listings-show-main {
        padding: 16px 12px;
    }

    .listing-detail-image-wrap {
        max-height: 260px;
    }

    .listing-detail-content {
        padding: 18px 16px 22px;
    }

    .listing-detail-title {
        font-size: 1.4rem;
    }

    .listing-detail-price {
        font-size: 1.3rem;
    }

    .listing-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .listing-form {
        max-width: 100%;
        box-sizing: border-box;
    }

    .form-actions {
        flex-wrap: wrap;
    }
}

.btn-edit {
  padding: 8px 14px;
  border: 1px solid #00274C;
  color: #00274C;
  border-radius: 6px;
  text-decoration: none;
}

.btn-edit:hover {
  background: #f0f4f8;
}

.btn-edit-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-delete {
  padding: 8px 14px;
  border: 1px solid #c00;
  color: #c00;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font-size: 14px;
}

.btn-delete:hover {
  background: #fee;
}

.btn-delete-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Form */
.listing-form {
  max-width: 520px;
  margin: 0 auto 32px;
  padding: 20px 18px 24px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e4e8;
  box-shadow: 0 4px 18px rgba(0, 39, 76, 0.08);
  box-sizing: border-box;
}

.form-errors {
  margin-bottom: 16px;
  padding: 12px;
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 6px;
}

.form-errors p {
  margin: 0 0 8px 0;
  font-weight: 600;
}

.form-errors ul {
  margin: 0;
  padding-left: 20px;
}

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

.form-group-other {
  margin-top: 8px;
}

.is-hidden {
  display: none;
}

.listing-form-section-heading {
  margin: 16px 0 8px 0;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
}

.form-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccd0d5;
  border-radius: 6px;
  font-family: inherit;
  font-size: inherit;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: #00274C;
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 39, 76, 0.12);
}

.field_with_errors .form-input {
  border-color: #dc3545;
  box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.15);
}

.form-input-with-prefix {
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-input-prefix {
  padding: 10px 8px;
  border: 1px solid #ccd0d5;
  border-radius: 6px 0 0 6px;
  border-right: none;
  background: #f5f6f8;
  color: #555;
  font-size: 0.95rem;
}

.form-input-with-prefix .form-input {
  border-radius: 0 6px 6px 0;
}

.form-group-select {
  margin-bottom: 16px;
}

.form-hint {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: #666;
}

.required-asterisk {
  color: #dc3545;
}

.current-image-preview img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.listing-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-card-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100px;
  background: #e8eaee;
  color: #666;
  text-decoration: none;
  border-radius: 8px;
  box-sizing: border-box;
}

.listing-card-thumb-placeholder:hover {
  background: #dde0e6;
  color: #444;
}

.listing-card-no-image {
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  gap: 12px;
}

.btn-submit {
  padding: 12px 20px;
  background: #00274C;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 1rem;
  transition: background 0.2s ease;
}

.btn-submit:hover {
  background: #001a33;
}

.btn-cancel {
  padding: 12px 20px;
  border: 1px solid #e2e4e8;
  border-radius: 10px;
  text-decoration: none;
  color: #333;
  font-family: inherit;
  background: white;
  transition: background 0.2s ease;
}

.btn-cancel:hover {
  background: #f8f9fa;
}
