/* ============================================================
   listings.css — Bedder Management Listings & Pre-Screening
   ============================================================ */

/* ---------- Layout ---------- */
.listings-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 20px;
}

.listings-header {
  text-align: center;
  margin-bottom: 40px;
}

.listings-header h1 {
  font-size: 2rem;
  color: var(--navy, #1a2744);
  margin-bottom: 8px;
}

.listings-header p {
  color: var(--text-light, #5a5a5a);
  font-size: 1.05rem;
}

/* ---------- Card Grid ---------- */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

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

@media (max-width: 600px) {
  .listings-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Listing Card ---------- */
.listing-card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.listing-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
  transform: translateY(-2px);
}

.listing-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: #eee;
}

.listing-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.listing-card-address {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy, #1a2744);
  margin: 0 0 4px;
}

.listing-card-city {
  font-size: 0.9rem;
  color: var(--text-light, #5a5a5a);
  margin: 0 0 10px;
}

.listing-card-details {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-light, #5a5a5a);
  margin-bottom: 12px;
}

.listing-card-rent {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold, #c8a45a);
  margin-top: auto;
  margin-bottom: 12px;
}

.listing-card-btn {
  display: inline-block;
  text-align: center;
  padding: 10px 0;
  width: 100%;
  background: var(--accent-gold, #c8a45a);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.listing-card-btn:hover {
  background: var(--accent-hover, #b8933f);
}

/* ---------- Loading / Empty States ---------- */
.listings-loading,
.listings-empty,
.listings-error {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light, #5a5a5a);
  font-size: 1.1rem;
}

.listings-error {
  color: #c0392b;
}

/* ============================================================
   Detail Overlay / Modal
   ============================================================ */
.listing-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px 16px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.listing-modal {
  background: #fff;
  border-radius: 6px;
  max-width: 900px;
  width: 100%;
  margin: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.listing-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: #999;
  z-index: 2;
  line-height: 1;
  transition: color 0.15s;
}

.listing-modal-close:hover {
  color: #333;
}

/* ---------- Gallery ---------- */
.listing-gallery {
  position: relative;
  background: #1a1a1a;
}

/* Main image viewport — relative container for overlay arrows */
.listing-gallery-viewport {
  position: relative;
  background: #1a1a1a;
}

.listing-gallery-main {
  width: 100%;
  height: 400px;
  object-fit: contain;
  display: block;
  background: #1a1a1a;
}

@media (max-width: 600px) {
  .listing-gallery-main {
    height: 260px;
  }
}

/* Prev/Next arrows on main gallery image */
.gallery-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  font-size: 1.6rem;
  padding: 12px 10px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  z-index: 3;
  line-height: 1;
  border-radius: 4px;
}

.gallery-nav-arrow:hover {
  background: rgba(0, 0, 0, 0.75);
}

.gallery-nav-prev {
  left: 8px;
}

.gallery-nav-next {
  right: 8px;
}

/* Thumbnail strip with scroll arrows */
.listing-gallery-thumbs-wrap {
  display: flex;
  align-items: center;
  background: #111;
  padding: 0 4px;
}

.listing-gallery-thumbs {
  display: flex;
  gap: 4px;
  padding: 8px 4px;
  overflow-x: auto;
  flex: 1;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.listing-gallery-thumbs::-webkit-scrollbar {
  display: none;
}

.thumb-scroll-arrow {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  font-size: 0.9rem;
  padding: 8px 6px;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 3px;
  transition: background 0.2s;
  line-height: 1;
  z-index: 2;
}

.thumb-scroll-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
}

.listing-gallery-thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.5;
  border: 2px solid transparent;
  transition: opacity 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.listing-gallery-thumb:hover,
.listing-gallery-thumb.active {
  opacity: 1;
  border-color: var(--accent-gold, #c8a45a);
}

.listing-no-images {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  color: #999;
  font-size: 1rem;
}

/* ---------- Detail Content ---------- */
.listing-detail {
  padding: 28px 32px 32px;
}

@media (max-width: 600px) {
  .listing-detail {
    padding: 20px 16px 24px;
  }
}

.listing-detail h2 {
  font-size: 1.5rem;
  color: var(--navy, #1a2744);
  margin: 0 0 4px;
}

.listing-detail-address {
  color: var(--text-light, #5a5a5a);
  margin: 0 0 16px;
  font-size: 0.95rem;
}

.listing-detail-stats {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.listing-stat {
  font-size: 0.9rem;
  color: var(--text-light, #5a5a5a);
}

.listing-stat strong {
  color: var(--text, #2c2c2c);
}

.listing-detail-rent {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-gold, #c8a45a);
}

.listing-description {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text, #2c2c2c);
  margin-bottom: 24px;
  white-space: pre-line;
}

/* ---------- Features ---------- */
.listing-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.listing-feature-tag {
  background: #f0f0f0;
  color: var(--text-light, #5a5a5a);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 4px;
}

/* ============================================================
   Rental Criteria
   ============================================================ */
.rental-criteria {
  margin-bottom: 32px;
}

.rental-criteria h3 {
  font-size: 1.2rem;
  color: var(--navy, #1a2744);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-gold, #c8a45a);
}

.criteria-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .criteria-grid {
    grid-template-columns: 1fr;
  }
}

.criteria-section {
  background: #fafafa;
  border-radius: 6px;
  padding: 16px;
}

.criteria-section h4 {
  font-size: 0.95rem;
  color: var(--navy, #1a2744);
  margin: 0 0 10px;
}

.criteria-section ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--text-light, #5a5a5a);
  line-height: 1.7;
}

/* ============================================================
   Pre-Screening Form
   ============================================================ */
.prescreen-form-wrapper {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid #eee;
}

.prescreen-form-wrapper h3 {
  font-size: 1.2rem;
  color: var(--navy, #1a2744);
  margin: 0 0 4px;
}

.prescreen-form-wrapper > p {
  color: var(--text-light, #5a5a5a);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.prescreen-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .prescreen-form {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #2c2c2c);
  margin-bottom: 6px;
}

.form-group label .required {
  color: #c0392b;
}

.form-group input,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s;
  color: var(--text, #2c2c2c);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-gold, #c8a45a);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* File upload styling */
.file-upload-area {
  border: 2px dashed #ddd;
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.file-upload-area:hover {
  border-color: var(--accent-gold, #c8a45a);
  background: #fffcf5;
}

.file-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-area span {
  font-size: 0.85rem;
  color: var(--text-light, #5a5a5a);
}

.file-upload-area .upload-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 6px;
}

.file-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.file-preview-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  background: #f0f0f0;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-light, #5a5a5a);
}

/* Self-tour section */
.self-tour-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
}

.self-tour-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-gold, #c8a45a);
}

.self-tour-toggle label {
  font-size: 0.9rem;
  color: var(--text, #2c2c2c);
  cursor: pointer;
}

.dl-upload-section {
  grid-column: 1 / -1;
  animation: fadeIn 0.2s ease;
}

/* Submit button */
.prescreen-submit {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.prescreen-submit button {
  width: 100%;
  padding: 14px;
  background: var(--accent-gold, #c8a45a);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.prescreen-submit button:hover {
  background: var(--accent-hover, #b8933f);
}

.prescreen-submit button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Success message */
.prescreen-success {
  text-align: center;
  padding: 32px 16px;
}

.prescreen-success .check-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.prescreen-success h4 {
  color: var(--navy, #1a2744);
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.prescreen-success p {
  color: var(--text-light, #5a5a5a);
  font-size: 0.9rem;
  margin: 0;
}

/* Validation errors */
.form-error {
  font-size: 0.8rem;
  color: #c0392b;
  margin-top: 4px;
}

/* Honeypot (hidden) */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}

/* ============================================================
   Lightbox — Fullscreen Image Viewer
   ============================================================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: lightboxFadeIn 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  display: block;
  transition: opacity 0.15s ease;
  border-radius: 2px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 10001;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.15s;
  padding: 4px 8px;
}

.lightbox-close:hover {
  opacity: 1;
  transform: scale(1.1);
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  padding: 20px 16px;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
  z-index: 10001;
  line-height: 1;
}

.lightbox-arrow:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.lightbox-arrow-left {
  left: 0;
  border-radius: 0 4px 4px 0;
}

.lightbox-arrow-right {
  right: 0;
  border-radius: 4px 0 0 4px;
}

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 14px;
  border-radius: 20px;
  z-index: 10001;
  pointer-events: none;
}

/* Mobile adjustments for lightbox */
@media (max-width: 600px) {
  .lightbox-image {
    max-width: 95vw;
    max-height: 80vh;
  }

  .lightbox-close {
    top: 10px;
    right: 12px;
    font-size: 2rem;
  }

  .lightbox-arrow {
    font-size: 1.8rem;
    padding: 16px 12px;
  }

  .lightbox-counter {
    bottom: 14px;
    font-size: 0.85rem;
  }
}

/* Multi-file upload: remove button */
.file-preview-remove {
  background: none;
  border: none;
  color: #c00;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.file-preview-remove:hover {
  color: #900;
}
.file-preview-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* ---------- Apply Anyway Note ---------- */
.apply-anyway-note {
  background: #eef6fb;
  border-left: 4px solid #5b9bd5;
  border-radius: 4px;
  padding: 14px 18px;
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 0.92rem;
  color: #2c5a7a;
  line-height: 1.5;
}

.apply-anyway-note strong {
  color: #1a3d5c;
}

/* Credit score input fields */
.credit-score-inputs .credit-score-fields {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}
.credit-score-inputs .credit-score-field {
  flex: 1;
}
.credit-score-inputs .credit-score-field label {
  display: block;
  font-size: 0.85em;
  color: #666;
  margin-bottom: 4px;
  font-weight: 500;
}
.credit-score-inputs .credit-score-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1em;
  box-sizing: border-box;
}
.credit-score-inputs .credit-score-field input:focus {
  outline: none;
  border-color: #4a90d9;
  box-shadow: 0 0 0 2px rgba(74,144,217,0.15);
}
.credit-score-inputs .hint {
  font-weight: 400;
  color: #999;
  font-size: 0.85em;
}
