/* ===== Persian font (see README for why this specific font was chosen) ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

/* ===== Basic reset and layout ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  direction: rtl;
}

body {
  font-family: 'Noto Naskh Arabic', Tahoma, Arial, sans-serif;
  background-color: #f7f7f8;
  color: #1a1a1a;
  line-height: 1.8;
  direction: rtl;
  text-align: right;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== Header / nav ===== */
header {
  background-color: #1a3c5e;
  color: white;
  padding: 16px 0;
}

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

header h1 {
  font-size: 22px;
}

header nav a {
  color: white;
  text-decoration: none;
  margin-right: 20px;
  font-size: 15px;
}

header nav a:hover {
  text-decoration: underline;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Auth / login ===== */
#authStatus {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout-btn {
  background: transparent;
  border: 1px solid white;
  color: white;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.15);
}

.login-required-notice {
  background: #fff8e6;
  border: 1px solid #f0d98c;
  color: #7a5c00;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
}

/* ===== Search bar ===== */
.search-bar {
  display: flex;
  gap: 10px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.search-bar input[type="text"],
.search-bar select {
  padding: 10px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: 6px;
  flex: 1;
  min-width: 150px;
}

.search-bar button {
  padding: 10px 20px;
  background-color: #1a3c5e;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
}

.search-bar button:hover {
  background-color: #14304a;
}

/* ===== Listing cards ===== */
.listing-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 14px;
}

.listing-card h3 {
  font-size: 18px;
  margin-bottom: 6px;
  color: #1a3c5e;
}

.listing-title-link {
  color: inherit;
  text-decoration: none;
}

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

.listing-card .meta {
  font-size: 13px;
  color: #777;
  margin-bottom: 8px;
}

.listing-card .price {
  font-weight: bold;
  color: #1a7a3c;
  font-size: 16px;
  margin-bottom: 8px;
}

.listing-card .description {
  font-size: 15px;
  margin-bottom: 10px;
}

.listing-card .contact {
  font-size: 14px;
  background: #f0f4f8;
  padding: 8px;
  border-radius: 6px;
  display: inline-block;
}

.listing-card .contact.contact-locked {
  background: #fff8e6;
  color: #7a5c00;
  font-style: italic;
}

/* ===== Contact reveal CTA + modal ===== */
.contact-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1a3c5e, #2a5a8c);
  color: white;
  padding: 9px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(26, 60, 94, 0.25);
}

.contact-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(26, 60, 94, 0.35);
}

.contact-cta-icon {
  font-size: 14px;
}

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

.contact-modal-box {
  background: white;
  border-radius: 14px;
  padding: 32px 28px;
  width: 90vw;
  max-width: 380px;
  text-align: center;
  position: relative;
  animation: contactModalPop 0.18s ease-out;
}

@keyframes contactModalPop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.contact-modal-close {
  position: absolute;
  top: 10px;
  left: 14px;
  background: transparent;
  border: none;
  font-size: 26px;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

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

.contact-reveal-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

.contact-modal-box h3 {
  color: #1a3c5e;
  margin-bottom: 10px;
  font-size: 18px;
}

.contact-modal-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

.contact-modal-error {
  color: #b02a2a;
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 10px;
}

.contact-reveal-value {
  background: #e3f5e9;
  color: #1a7a3c;
  border: 1px solid #b6e6c4;
  border-radius: 8px;
  padding: 14px;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 18px;
  word-break: break-all;
}

#contactPhoneInput {
  text-align: center;
  letter-spacing: 1px;
  direction: ltr;
}

.empty-state {
  text-align: center;
  color: #888;
  padding: 40px 0;
}

/* ===== Photos ===== */
.photo-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.photo-thumb {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 10px;
  padding-bottom: 4px;
}

.photo-thumb-small {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  flex-shrink: 0;
}

/* Single cover photo shown under the listing title, click to open the album */
.photo-cover {
  cursor: pointer;
  margin-bottom: 10px;
}

.photo-cover-img {
  width: 100%;
  max-width: 320px;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  display: block;
}

/* ===== Lightbox / album viewer ===== */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: min(1500px, 90vw);
  max-height: min(1024px, 85vh);
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  left: 20px;
  background: transparent;
  border: none;
  color: white;
  font-size: 36px;
  cursor: pointer;
  line-height: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev {
  right: 20px;
}

.lightbox-next {
  left: 20px;
}

.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 14px;
  border-radius: 20px;
}

/* ===== Forms ===== */
.form-box {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
}

.edit-form-box {
  background: #f7f9fb;
  border: 1px solid #d5dde5;
  border-radius: 8px;
  padding: 18px;
  margin-top: 14px;
}

.edit-photo-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.edit-photo-item {
  position: relative;
  display: inline-block;
}

.edit-photo-remove {
  position: absolute;
  top: -8px;
  left: -8px;
  background: #b02a2a;
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.edit-photo-remove:hover {
  background: #8a1f1f;
}

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

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
}

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

.form-hint {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.submit-btn {
  background-color: #1a7a3c;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
}

.submit-btn:hover {
  background-color: #145c2d;
}

.message-box {
  padding: 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  display: none;
}

.message-box.success {
  background-color: #e3f5e9;
  color: #1a7a3c;
  border: 1px solid #b6e6c4;
}

.message-box.error {
  background-color: #fdeaea;
  color: #b02a2a;
  border: 1px solid #f3b6b6;
}

/* ===== Valuation calculator ===== */
.valuation-result {
  margin-top: 24px;
  padding: 20px;
  background: #f0f4f8;
  border-radius: 8px;
  display: none;
}

.valuation-result h3 {
  color: #1a3c5e;
  margin-bottom: 10px;
}

.valuation-range {
  font-size: 24px;
  font-weight: bold;
  color: #1a7a3c;
  margin: 10px 0;
}

.valuation-note {
  font-size: 13px;
  color: #666;
  margin-top: 10px;
}

footer {
  text-align: center;
  padding: 30px 0;
  color: #999;
  font-size: 13px;
}

/* ===== Settings page ===== */
.settings-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.settings-row input {
  padding: 9px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.settings-remove-btn {
  background: #b02a2a;
  color: white;
  border: none;
  border-radius: 6px;
  width: 34px;
  height: 34px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.settings-remove-btn:hover {
  background: #8a1f1f;
}

.settings-field-box {
  background: #f7f9fb;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}

.settings-field-box input[type="text"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

/* ===== Schematic flowchart ===== */
.flowchart-container {
  background: #f7f9fb;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
}

.flow-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.flow-box {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  text-align: center;
  min-width: 140px;
  border: 2px solid;
}

.flow-input {
  background: #e3f0fc;
  border-color: #1a3c5e;
  color: #1a3c5e;
}

.flow-method {
  background: #fff8e6;
  border-color: #c9930a;
  color: #7a5c00;
}

.flow-bonus {
  background: #f0e6fa;
  border-color: #7a3fc9;
  color: #4a1f7a;
}

.flow-result {
  background: #e3f5e9;
  border-color: #1a7a3c;
  color: #14532a;
  font-weight: bold;
}

.flow-arrow {
  text-align: center;
  font-size: 22px;
  color: #999;
  margin: 6px 0;
}

/* ===== Leads page ===== */
.leads-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.leads-stat {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 16px 22px;
  text-align: center;
  flex: 1;
  min-width: 130px;
}

.leads-stat-number {
  display: block;
  font-size: 26px;
  font-weight: bold;
  color: #1a3c5e;
}

.leads-stat-label {
  display: block;
  font-size: 13px;
  color: #777;
  margin-top: 4px;
}

.leads-table-scroll {
  overflow-x: auto;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.leads-table th {
  background: #1a3c5e;
  color: white;
  text-align: right;
  padding: 12px 14px;
  white-space: nowrap;
}

.leads-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

.leads-table tr:last-child td {
  border-bottom: none;
}

.leads-table tr:hover td {
  background: #f7f9fb;
}

.leads-link {
  color: #1a3c5e;
  text-decoration: none;
}

.leads-link:hover {
  text-decoration: underline;
}

.leads-phone {
  direction: ltr;
  display: inline-block;
}

.leads-date {
  color: #888;
  font-size: 13px;
}

/* ===== Mobile optimization =====
   Applies to every page that loads this stylesheet (homepage, submit
   form, valuation calculator, admin panel), since they all share it. */
@media (max-width: 640px) {

  .container {
    padding: 14px;
  }

  /* Header: stack the title above the nav/login area instead of
     squeezing everything onto one line */
  header .container {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  header h1 {
    font-size: 19px;
    text-align: center;
  }

  .header-right {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  header nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
  }

  header nav a {
    margin-right: 0;
    padding: 6px 10px;
    font-size: 14px;
  }

  #authStatus {
    justify-content: center;
  }

  .google-signin-box {
    display: flex;
    justify-content: center;
  }

  /* Search bar: stack instead of cramming input + dropdown + button
     into one row */
  .search-bar {
    flex-direction: column;
    margin: 16px 0;
  }

  .search-bar input[type="text"],
  .search-bar select,
  .search-bar button {
    width: 100%;
  }

  /* Listing cards: slightly tighter padding, smaller title so long
     Persian business names wrap cleanly instead of overflowing */
  .listing-card {
    padding: 14px;
  }

  .listing-card h3 {
    font-size: 16px;
  }

  /* Cover photo: let it use the full card width rather than capping
     at 320px, which looks small on a typical phone screen */
  .photo-cover-img {
    max-width: 100%;
    height: 200px;
  }

  /* Forms: reduce outer padding so more of the screen is usable */
  .form-box {
    padding: 16px;
  }

  /* Lightbox: use more of the small screen, and bring the nav
     buttons in from the edges so they don't overlap the image */
  .lightbox-image {
    max-width: 95vw;
    max-height: 75vh;
    width: auto;
    height: auto;
  }

  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .lightbox-prev {
    right: 8px;
  }

  .lightbox-next {
    left: 8px;
  }

  .lightbox-close {
    top: 12px;
    left: 12px;
    font-size: 30px;
  }

  .lightbox-counter {
    bottom: 12px;
    font-size: 13px;
  }

  /* Valuation calculator numbers can get long; keep them from
     forcing horizontal scroll on narrow screens */
  .valuation-range {
    font-size: 20px;
    word-break: break-word;
  }
}

