/* LOCAL MARKET - COMPLETE NEWSPAPER STYLING */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #b8b8b4;
  color: #202020;
  font-family: Georgia, "Times New Roman", serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* NEWSPAPER HEADER */

.masthead {
  background: #deded8;
  text-align: center;
  padding: 18px 12px;
  border-bottom: 5px double #222;
}

.masthead h1 {
  font-size: clamp(38px, 8vw, 90px);
  font-weight: 900;
  letter-spacing: -2px;
  margin: 5px 0;
  line-height: 1;
}

.masthead p {
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 3px;
}

.edition {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 2px;
}

/* TOP TOOLBAR */

.toolbar {
  background: #d5d5cf;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  justify-content: center;
  border-bottom: 2px solid #222;
}

.toolbar input,
.toolbar select {
  background: #f2f2ed;
  border: 1px solid #444;
  padding: 12px;
  min-width: 0;
}

.toolbar input {
  flex: 1;
  min-width: 180px;
  max-width: 500px;
}

.toolbar button,
.page-controls button {
  background: #252525;
  color: white;
  border: 1px solid #111;
  padding: 12px 18px;
  font-weight: bold;
}

button:hover {
  opacity: 0.85;
}

/* TWO-PAGE NEWSPAPER */

main {
  max-width: 1500px;
  margin: auto;
  padding: 18px 12px;
}

.newspaper-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #e3e2dc;
  border: 1px solid #777;
  box-shadow: 5px 5px 12px #777;
  min-height: 650px;
  overflow: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.newspaper-spread.turning {
  transform: translateX(-15px);
  opacity: 0.35;
}

.newspaper-page {
  padding: 22px;
  min-width: 0;
}

#leftPage {
  border-right: 3px double #777;
  box-shadow: inset -8px 0 12px -12px #333;
}

#rightPage {
  box-shadow: inset 8px 0 12px -12px #333;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 4px double #222;
  border-bottom: 4px double #222;
  margin-bottom: 12px;
  padding: 8px 0;
}

.page-heading h2 {
  font-size: 22px;
  margin: 0;
}

.page-heading span {
  font-size: 14px;
  font-weight: bold;
}

/* CLASSIFIED LISTINGS */

.listing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.listing {
  padding: 10px;
  border-right: 1px solid #777;
  border-bottom: 1px solid #777;
  min-width: 0;
}

.listing:nth-child(2n) {
  border-right: none;
}

.listing img {
  width: 100%;
  height: 95px;
  object-fit: cover;
  filter: grayscale(35%);
  border: 1px solid #777;
}

.listing h3 {
  font-size: 16px;
  margin: 7px 0 4px;
  overflow-wrap: anywhere;
}

.listing .price {
  font-weight: bold;
  font-size: 17px;
}

.listing .description {
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.listing .category {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 1px;
}

.listing .timer {
  font-size: 11px;
  font-weight: bold;
  margin-top: 8px;
  border-top: 1px dotted #777;
  padding-top: 5px;
}

.listing .status {
  font-size: 11px;
  font-weight: bold;
  margin-top: 5px;
  text-transform: uppercase;
}

/* PAGE NAVIGATION */

.page-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 20px 5px;
}

.page-controls button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#pageIndicator {
  font-weight: bold;
  font-size: 14px;
  text-align: center;
}

/* FOOTER */

footer {
  background: #d5d5cf;
  border-top: 4px double #222;
  text-align: center;
  padding: 18px;
  font-size: 12px;
  font-weight: bold;
}

/* ALL POPUP WINDOWS */

.account-dialog {
  width: min(500px, calc(100% - 24px));
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  background: #e3e2dc;
  color: #202020;
  border: 3px double #222;
  box-shadow: 5px 5px 18px #333;
  font-family: Georgia, "Times New Roman", serif;
}

.account-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 4px double #222;
  border-bottom: 4px double #222;
  padding: 8px 0;
  margin-bottom: 15px;
}

.dialog-heading h2 {
  font-size: 22px;
  margin: 0;
}

.close-dialog {
  background: transparent;
  color: #222;
  border: none;
  font-size: 30px;
  padding: 0 6px;
  line-height: 1;
}

.account-dialog label {
  display: block;
  font-weight: bold;
  font-size: 14px;
  margin: 15px 0 6px;
}

.account-dialog input,
.account-dialog select,
.account-dialog textarea {
  display: block;
  width: 100%;
  padding: 12px;
  background: #f7f6f0;
  color: #222;
  border: 1px solid #555;
  font-size: 16px;
}

.account-dialog textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.4;
}

.account-dialog input[type="file"] {
  padding: 10px;
  font-size: 13px;
}

.privacy-note {
  font-size: 12px;
  line-height: 1.5;
  color: #444;
  margin: 14px 0;
}

.account-submit {
  display: block;
  width: 100%;
  background: #252525;
  color: white;
  border: 1px solid #111;
  padding: 13px;
  font-weight: bold;
  margin-top: 18px;
}

#registerMessage,
#signInMessage,
#postMessage {
  font-size: 13px;
  font-weight: bold;
  line-height: 1.5;
}

/* MY ADS MANAGEMENT */

#myAdsDialog {
  width: min(650px, calc(100% - 24px));
}

.my-ad-card {
  border: 1px solid #777;
  padding: 14px;
  margin: 12px 0;
  background: #eeede7;
}

.my-ad-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.my-ad-card p {
  font-size: 13px;
  line-height: 1.4;
}

.my-ad-card .ad-status {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.my-ad-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.my-ad-actions button {
  background: #252525;
  color: white;
  border: 1px solid #111;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: bold;
}

.my-ad-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* TABLETS */

@media (max-width: 1000px) {
  .newspaper-page {
    padding: 12px;
  }

  .listing {
    padding: 7px;
  }

  .listing h3 {
    font-size: 14px;
  }
}

/* PHONES */

@media (max-width: 700px) {
  .masthead h1 {
    font-size: 42px;
  }

  .masthead p {
    letter-spacing: 1px;
    font-size: 11px;
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
    max-width: none;
  }

  main {
    padding: 10px 5px;
  }

  .newspaper-spread {
    display: block;
    min-height: 500px;
  }

  .newspaper-page {
    padding: 12px;
  }

  #leftPage {
    border-right: none;
    box-shadow: none;
  }

  #rightPage {
    display: none;
  }

  .listing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .listing img {
    height: 85px;
  }

  .page-controls {
    gap: 8px;
  }

  .page-controls button {
    padding: 10px;
    font-size: 12px;
  }

  .account-dialog {
    padding: 16px;
  }

  .dialog-heading h2 {
    font-size: 19px;
  }
}

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

  .listing {
    border-right: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .newspaper-spread {
    transition: none;
  }
}
/* EDIT AD CHECKBOX */

#editForm input[type="checkbox"] {
  display: inline-block;
  width: auto;
  margin-right: 8px;
  vertical-align: middle;
}

#editForm label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

#editMessage {
  font-size: 13px;
  font-weight: bold;
  line-height: 1.5;
}
/* TERMS OF USE AGREEMENT */

.terms-agreement {
  margin: 16px 0;
  padding: 12px;
  background: #e3e2dc;
  border: 1px solid #777;
}

.terms-agreement label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.6;
  color: #222;
  cursor: pointer;
}

.terms-agreement input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: #333;
}

.terms-agreement a {
  color: #222;
  font-weight: bold;
  text-decoration: underline;
}
/* PENDING PICKUP NEWSPAPER STAMP */

.listing.pending-pickup {
  position: relative;
}

.pending-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  border: 3px solid #a52323;
  color: #a52323;
  background: rgba(235, 233, 225, 0.88);
  padding: 6px 10px;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;
  text-align: center;
  z-index: 2;
  pointer-events: none;
  max-width: 85%;
  box-sizing: border-box;
}
.contact {
  font-size: 13px;
  margin-top: 5px;
  color: #333;
  font-weight: bold;
}

.contact a {
  color: #222;
  text-decoration: underline;
  font-weight: normal;
}

.contact a:hover {
  color: #777;
}
.report-ad {
  display: block;
  background: none;
  border: none;
  padding: 0;
  margin-top: 8px;
  color: #666;
  font-family: inherit;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
  text-align: left;
}

.report-ad:hover {
  color: #a00000;
}
