/* ==========================================================================
   Listing Page Styles (listing.css)
   RTL • Bootstrap 5 compatible • Clean, cohesive visual language
   ========================================================================== */

/* -------------------- Theme tokens -------------------- */
:root{
  --app-font: "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --app-accent: #0d9488;             /* teal-600 */
  --app-accent-2: #14b8a6;           /* teal-500 */
  --app-bg: #f8f9fa;
  --card-bg: #ffffff;
  --soft-bg: #fbfbfb;
  --border: #e9ecef;
  --muted: #6c757d;
  --radius: .6rem;
  --shadow-sm: 0 2px 10px rgba(0,0,0,.06);
  --shadow-md: 0 6px 24px rgba(0,0,0,.08);
}

/* -------------------- Base -------------------- */
body{
  font-family: var(--app-font);
  background: var(--app-bg);
  color:#212529;
  padding-bottom: calc(64px + env(safe-area-inset-bottom,0));
}

/* -------------------- Header -------------------- */
.app-header-classic{
  position: sticky; top: 0; z-index: 1020;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: .9rem 1rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.app-header-classic h1{
  margin: 0; font-weight: 800; font-size: 1.25rem; letter-spacing: .2px;
}
#shareBtnIcon{
  position:absolute; left:1rem; top:.7rem;
  width:2.25rem; height:2.25rem; border-radius:50%;
  display:grid; place-items:center;
  border: 1px solid var(--border);
  background:#fff; color:#344054;
  transition: transform .15s ease, background .2s ease, color .2s ease;
}
#shareBtnIcon:hover{ transform: translateY(-1px); background: var(--soft-bg); color:#111; }
.header-rating-display{
  display:flex; align-items:center; justify-content:center; gap:.35rem;
}
.header-rating-display .rating-icon{ font-size: .95rem; }

/* -------------------- Containers / Cards -------------------- */
.main-content-area .listing-main-image{
  max-height: 460px; object-fit: cover;
  border-radius: var(--radius);
  border:1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.app-box{
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.app-box .card-header{
  background: var(--soft-bg);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  display:flex; align-items:center; gap:.5rem;
}

/* -------------------- Gallery -------------------- */
.listing-gallery .gallery-scroll-container{
  display: flex; gap: .8rem; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: .25rem;
}
.listing-gallery .gallery-scroll-container::-webkit-scrollbar{ height: 8px; }
.listing-gallery .gallery-scroll-container::-webkit-scrollbar-thumb{
  background: #d0d5dd; border-radius: 999px;
}
.gallery-thumbnail{
  min-width: 150px; max-width: 200px; aspect-ratio: 1/1; scroll-snap-align: start;
  border:1px solid var(--border); border-radius: .55rem; overflow: hidden; cursor: zoom-in;
  box-shadow: var(--shadow-sm); background:#fff;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.gallery-thumbnail:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color:#dfe3e8; }
.gallery-thumbnail img{ width: 100%; height: 100%; object-fit: cover; display:block; }

/* Collapse chevron rotation for upload box trigger */
.upload-gallery-box .card-header a .gallery-toggle-icon{ transition: transform .2s ease; }
.upload-gallery-box .card-header a.collapsed .gallery-toggle-icon{ transform: rotate(180deg); }

/* -------------------- Menu / Services -------------------- */
.menu-section .menu-category + .menu-category{ border-top:1px dashed var(--border); }
.menu-section .menu-category .category-header{
  background: var(--soft-bg); padding:.65rem .95rem; font-weight:700;
  border-top: 1px solid var(--border);
}
.menu-section .menu-item{
  padding:.7rem .95rem; transition: background .15s ease;
}
.menu-section .menu-item:hover{ background:#fafafa; }
.menu-section .menu-icon{
  width: 40px; height: 40px; object-fit: cover; border:1px solid var(--border);
}
.menu-item-name{ font-weight:600; color:#101828; }
.menu-item-price{
  background: #fff; border: 1px solid var(--border); padding:.2rem .5rem;
  border-radius: .45rem; min-width: 4.25rem; text-align:center; font-weight:700;
}

/* -------------------- Ratings / Comments -------------------- */
.rating-stats-box{ background:#fcfcfd !important; }
.rating-stats-box .progress{ background:#eee; }
.rating-stats-box .progress-bar{ background: #fbbf24; } /* amber-400 */

.filter-btns .btn{ margin-inline:.15rem; }
.filter-btns .btn.active{ box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }

.comment-card{
  border:1px solid var(--border);
  border-radius: .6rem;
  padding: .9rem;
  margin-bottom: .8rem;
  box-shadow: var(--shadow-sm);
}
.comment-card .reply-box{
  background: #f7faf9;
  border: 1px dashed #cce7e3;
  border-radius: .5rem;
}

/* Admin / owner action strip */
.comment-card .btn.btn-sm{ padding:.2rem .5rem; }

/* -------------------- Rating form (stars) -------------------- */
.star-rating-input .star{
  font-size: 1.65rem; line-height: 1; cursor: pointer; user-select: none;
  transition: transform .08s ease;
  display:inline-block; margin-inline: .05rem;
}
.star-rating-input .star:focus-visible{ outline: 2px solid var(--app-accent); outline-offset: 2px; border-radius:.2rem; }
.star-rating-input .star:hover{ transform: scale(1.08); }

/* -------------------- Keywords / Owner link -------------------- */
.keywords-section .badge{ font-weight:600; }
.owner-login-link a:hover{ color: var(--app-accent); }

/* -------------------- Bottom App Nav -------------------- */
.app-nav{
  position: fixed; right:0; left:0; bottom:0; z-index:1030;
  background: #ffffff; border-top:1px solid var(--border);
  display:flex; justify-content:space-around; gap:.2rem;
  padding: .35rem calc(.6rem + env(safe-area-inset-left,0)) calc(.35rem + env(safe-area-inset-bottom,0)) calc(.6rem + env(safe-area-inset-right,0));
  box-shadow: 0 -4px 18px rgba(16,24,40,.06);
}
.app-nav a{
  text-decoration:none; color:#475467; font-size:.86rem; line-height:1.1;
  display:flex; flex-direction:column; align-items:center; gap:.2rem; padding:.25rem .5rem;
  transition: color .15s ease, transform .15s ease;
}
.app-nav a i{ font-size: 1.05rem; }
.app-nav a:hover{ color:#111827; transform: translateY(-1px); }
.app-nav a.active{ color: var(--app-accent); }

/* -------------------- Utilities -------------------- */
.text-truncate{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* -------------------- Responsive -------------------- */
@media (min-width: 992px){
  .main-content-area{ max-width: 960px; }
}
@media (max-width: 575.98px){
  .app-header-classic h1{ font-size: 1.05rem; }
  .main-content-area .listing-main-image{ max-height: 320px; }
  .menu-section .menu-icon{ width:36px; height:36px; }
}

/* -------------------- Focus / A11y -------------------- */
a:focus-visible, button:focus-visible, .gallery-thumbnail:focus-visible{
  outline: 2px solid var(--app-accent-2);
  outline-offset: 2px;
  border-radius: .4rem;
}

/* -------------------- Dark Mode (prefers-color-scheme) -------------------- */
@media (prefers-color-scheme: dark){
  :root{
    --app-bg: #0b1220;
    --card-bg: #0f172a;
    --soft-bg: #0b1220;
    --border: #1e293b;
    --muted: #94a3b8;
    --shadow-sm: 0 2px 10px rgba(0,0,0,.35);
    --shadow-md: 0 6px 24px rgba(0,0,0,.45);
  }
  body{ color:#e5e7eb; }
  .app-header-classic{ background: var(--card-bg); border-color: var(--border); }
  #shareBtnIcon{ background: var(--card-bg); border-color: var(--border); color:#e5e7eb; }
  #shareBtnIcon:hover{ background:#1f2937; color:#fff; }
  .main-content-area .listing-main-image{ border-color: var(--border); }
  .app-box{ background: var(--card-bg); border-color: var(--border); }
  .app-box .card-header{ background: #0c152a; border-color: var(--border); }
  .menu-section .menu-item:hover{ background: #0c152a; }
  .menu-section .menu-icon{ border-color: var(--border); }
  .menu-item-name{ color:#f1f5f9; }
  .menu-item-price{ background: #0b1220; border-color: var(--border); color:#e5e7eb; }
  .listing-gallery .gallery-scroll-container::-webkit-scrollbar-thumb{ background:#334155; }
  .gallery-thumbnail{ background:#0b1220; border-color: var(--border); }
  .comment-card{ border-color: var(--border); background:#0f172a; }
  .comment-card .reply-box{ background:#0b1220; border-color:#113a36; }
  .rating-stats-box{ background:#0b1220 !important; }
  .app-nav{ background:#0b1220; border-color: var(--border); }
  .app-nav a{ color:#cbd5e1; }
  .app-nav a.active{ color: var(--app-accent-2); }
}

/* -------------------- Print -------------------- */
@media print{
  .app-nav, #shareBtnIcon, .upload-gallery-box{ display:none !important; }
  body{ padding:0; }
  .app-header-classic{ position:static; box-shadow:none; }
}
