/* =========================
   Global
========================= */

:root {
  --brand: #2f6bff;
  --brand-dark: #1f52d6;
  --bg: #f6f8fb;
  --text: #1f2937;
  --radius: 16px;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--brand);
}

a:hover {
  color: var(--brand-dark);
}

.main-container {
  min-height: 80vh;
}

.container {
  max-width: 980px;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* =========================
   Generic cards & buttons
========================= */

.card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.btn {
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

/* =========================
   Brand / auth
========================= */

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.card-auth {
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

.auth-title {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  color: rgba(0, 0, 0, 0.6);
}

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  border-radius: 14px;
}

.btn-brand:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

/* =========================
   Forms
========================= */

.form-control,
.form-select {
  border-radius: 12px;
  padding: 12px 14px;
}

.form-label {
  font-weight: 600;
}

/* =========================
   Hero
========================= */

.hero {
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  color: white;
  border-radius: 18px;
  padding: 24px 20px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.2);
}

.hero h1 {
  font-size: 1.9rem;
  margin-bottom: 0.5rem;
}

.hero p {
  margin-bottom: 0.75rem;
}

/* =========================
   Category badge
========================= */

.badge-category {
  background-color: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.15s ease;
}

.badge-category:hover {
  background-color: #dbeafe;
}

/* =========================
   Homepage ad cards
========================= */

.ad-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: top;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

/* =========================
   My ads cards
========================= */

.ad-card {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.ad-image-wrapper {
  position: relative;
  overflow: hidden;
}

.ad-image {
  width: 100%;
  height: 155px;
  object-fit: cover;
  display: block;
}

.ad-title {
  font-size: 0.95rem;
  line-height: 1.3;
  min-height: 2.4rem;
  margin-bottom: 0.25rem;
}

.ad-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ad-card:hover .ad-actions {
  opacity: 1;
}

.ad-actions a,
.ad-actions button {
  background: rgba(255, 255, 255, 0.92);
  border: 0;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.ad-actions form {
  margin: 0;
}

.ad-actions a:hover,
.ad-actions button:hover {
  transform: scale(1.08);
}

/* =========================
   Ad page thumbnails
========================= */

.ad-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}

.ad-thumb:hover {
  border-color: #2563eb;
}

.ad-thumb-small {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

/* =========================
   Chat
========================= */

.chat-box {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  max-height: 400px;
  overflow-y: auto;
}

.chat-message {
  display: flex;
  margin-bottom: 8px;
}

.chat-message-me {
  justify-content: flex-end;
}

.chat-message-other {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 14px;
  background-color: #f3f4f6;
}

.chat-message-me .chat-bubble {
  background-color: #dbeafe;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  margin-bottom: 4px;
  color: #6b7280;
}

.chat-sender {
  font-weight: 600;
}

.chat-text {
  font-size: 0.9rem;
}

.bubble-me {
  background-color: #0d6efd;
  color: #ffffff;
  border-bottom-right-radius: 0.2rem;
  position: relative;
}

.bubble-me::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 0;
  width: 12px;
  height: 12px;
  background: #0d6efd;
  border-bottom-right-radius: 10px;
  transform: translateY(1px) rotate(-45deg);
}

.bubble-them {
  background-color: #e5e5ea;
  color: #000;
  border-bottom-left-radius: 0.2rem;
  position: relative;
}

.bubble-them::after {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 0;
  width: 12px;
  height: 12px;
  background: #e5e5ea;
  border-bottom-left-radius: 10px;
  transform: translateY(1px) rotate(45deg);
}

.sender-label {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.7;
}

.bubble-me .sender-label {
  color: #ffffff !important;
  text-align: right;
}

.bubble-them .sender-label {
  color: #555;
}

.message-row {
  display: flex;
  margin-bottom: 0.5rem;
  animation: messageFadeIn 0.25s ease-out;
}

.message-time {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  opacity: 0.75;
  text-align: right;
}

@keyframes messageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   Utility
========================= */

.text-truncate {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   Mobile
========================= */

@media (max-width: 576px) {
  .main-container {
    padding: 0 10px;
  }

  h1 {
    font-size: 1.35rem;
  }

  .hero {
    padding: 18px 14px;
  }

  .card {
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  }

  .navbar-brand {
    font-weight: 800;
  }

  .navbar .btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .ad-image {
    height: 135px;
  }

  .chat-input-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }
}

.home-title {
  font-size: 2rem;
  line-height: 1.2;
}

@media (max-width: 991.98px) {
  .navbar .navbar-text {
    width: 100%;
    text-align: center;
    margin-top: 0.25rem;
  }
}

@media (max-width: 767.98px) {
  .home-title {
    font-size: 1.45rem;
  }

  .container.mb-5 {
    margin-bottom: 2rem !important;
  }

  .p-md-5 {
    padding: 1.25rem !important;
  }

  .card-img-top.ad-card-img {
    height: 170px;
    object-fit: cover;
  }

  .card-body.p-2 {
    padding: 0.75rem !important;
  }

  .text-truncate {
    font-size: 0.95rem;
  }

  .navbar .btn {
    width: 100%;
  }
}

.mobile-navbar .navbar-brand {
  font-size: 1.9rem;
}

.mobile-navbar .navbar-toggler {
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.lang-switch-mobile {
  padding: 0.4rem 0;
}

.lang-switch-mobile a {
  font-size: 1.1rem;
}

@media (max-width: 991.98px) {
  .mobile-navbar .navbar-collapse {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 14px;
  }

  .mobile-navbar .btn {
    width: 100%;
    min-height: 44px;
  }

  .mobile-navbar .navbar-text {
    width: 100%;
  }
}
.card-img-top.ad-card-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

@media (max-width: 767.98px) {
  .card-img-top.ad-card-img {
    height: 160px;
  }

  .card {
    border-radius: 18px;
    overflow: hidden;
  }

  .card-body.p-2 {
    padding: 0.85rem !important;
  }

  .card .fw-bold.text-primary {
    font-size: 1rem;
  }

  .card .text-truncate {
    font-size: 0.95rem;
    font-weight: 600;
  }

  .card .small.text-muted {
    font-size: 0.82rem;
  }
}
/* FORM MOBILE UX */
@media (max-width: 767.98px) {
  .form-control {
    height: 52px;
    font-size: 1rem;
    border-radius: 14px;
  }

  .form-select {
    height: 52px;
    font-size: 1rem;
    border-radius: 14px;
  }

  .btn {
    min-height: 52px;
    font-size: 1.05rem;
    border-radius: 14px;
  }

  .form-label {
    font-size: 0.95rem;
    margin-bottom: 6px;
  }
}
/* ===== Cartes annonces mobile PRO ===== */
@media (max-width: 767.98px) {
  .row.g-2 {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }

  .card {
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  }

  @media (max-width: 767.98px) {
    .card-img-top.ad-card-img {
      width: 100%;
      height: 180px;
      object-fit: contain;
      object-position: center;
      display: block;
      background: #fff;
      padding: 10px;
    }
  }

  .card-body.p-2 {
    padding: 0.8rem !important;
  }

  .card .fw-bold.text-primary {
    font-size: 1.05rem;
    line-height: 1.1;
    margin-bottom: 0.35rem !important;
  }

  .card .text-truncate {
    font-size: 0.96rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.2rem;
  }

  .card .small.text-muted {
    font-size: 0.82rem;
    line-height: 1.2;
  }
}
@media (max-width: 767.98px) {
  .card-title-mobile {
    font-size: 0.96rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.25;
    min-height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* ===== Détail annonce mobile PRO ===== */
.ad-back-link {
  font-size: 1rem;
  text-decoration: none;
}

.ad-main-image-wrap {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.ad-main-image {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #fff;
}

.ad-thumbs-row {
  margin-bottom: 1rem;
}

.ad-thumb-item {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  border-width: 2px;
}

.ad-info-card {
  background: #fff;
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.ad-title-detail {
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: #1f2937;
}

.ad-price-detail {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 1rem;
}

.ad-meta-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ad-meta-item {
  font-size: 0.96rem;
}

.ad-description-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.ad-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: #111827;
}

.ad-actions-stack .btn {
  min-height: 50px;
  border-radius: 14px;
}

@media (max-width: 767.98px) {
  .ad-back-link {
    font-size: 1.05rem;
    margin-bottom: 1rem !important;
  }

  .ad-main-image {
    max-height: 360px;
  }

  .ad-thumb-item {
    width: 72px;
    height: 72px;
    border-radius: 12px;
  }

  .ad-info-card {
    margin-top: 0.75rem;
    padding: 1rem;
    border-radius: 18px;
  }

  .ad-title-detail {
    font-size: 1.65rem;
    line-height: 1.15;
  }

  .ad-price-detail {
    font-size: 1.9rem;
    margin-bottom: 0.9rem;
  }

  .ad-meta-item {
    font-size: 0.95rem;
  }

  .ad-description-block p {
    font-size: 0.98rem;
    line-height: 1.5;
  }
}
/* ===== NAVBAR MOBILE PRO ===== */
.mobile-navbar-pro {
  background: linear-gradient(135deg, #3b82f6 0%, #4338ca 100%);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.18);
}

.mobile-navbar-pro .navbar-brand {
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.mobile-navbar-pro .navbar-toggler {
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.mobile-navbar-pro .navbar-toggler:focus {
  box-shadow: none;
}

.mobile-lang-switch {
  padding: 0.35rem 0;
}

.mobile-lang-switch a {
  font-size: 1.1rem;
}

.mobile-user-email {
  opacity: 0.95;
}

@media (max-width: 991.98px) {
  .mobile-navbar-pro .navbar-collapse {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
  }

  .mobile-navbar-pro .btn {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
  }

  .mobile-navbar-pro .navbar-text {
    width: 100%;
    text-align: center;
    margin-top: 0.4rem;
  }

  .mobile-lang-switch {
    justify-content: center;
    margin-bottom: 0.25rem;
  }
}
/* ===== Sticky CTA mobile annonce ===== */
.mobile-sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid #e5e7eb;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08);
}

.mobile-sticky-cta-inner {
  display: flex;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}

.mobile-sticky-cta .btn {
  min-height: 48px;
  border-radius: 14px;
  font-weight: 600;
}

@media (max-width: 767.98px) {
  body {
    padding-bottom: 92px;
  }
}
/* ===== 5 colonnes desktop ===== */
@media (min-width: 1200px) {
  .col-xl-5col {
    width: 20%;
    flex: 0 0 20%;
  }
}
.ad-card-img {
  height: 160px;
  object-fit: cover;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}
/* ===== Fix logo position RTL ===== */
html[dir="rtl"] .navbar .container {
  flex-direction: row !important;
}

.navbar-brand {
  order: 0;
}
/* ===== Force logo Intercoin à gauche même en arabe ===== */
.navbar-main-wrap {
  display: flex;
  align-items: center;
}

.navbar-brand-fixed {
/* margin-right: auto;*/
  margin-left: 0;
}

html[dir="rtl"] .navbar-brand-fixed,
body[dir="rtl"] .navbar-brand-fixed {
  margin-right: auto;
  margin-left: 0;
}

.navbar-toggler {
  margin-left: 0;
}

html[dir="rtl"] .navbar-collapse,
body[dir="rtl"] .navbar-collapse {
  text-align: right;
}

/* ===== Navbar toujours en LTR ===== */
.navbar-shell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  direction: ltr;
}

.navbar-brand-fixed {
  margin-right: auto;
  margin-left: 0;
}

.navbar-toggler {
  margin-left: 0;
}

.navbar-shell .navbar-collapse {
  width: 100%;
}

@media (min-width: 992px) {
  .navbar-shell {
    flex-wrap: nowrap;
  }

  .navbar-shell .navbar-collapse {
    width: auto;
    flex-grow: 1;
  }

  .navbar-actions {
    margin-left: auto !important;
  }
}
/* 🌍 LANG BAR */

.top-lang-bar a {
  text-decoration: none;
  font-size: 1.1rem;
}

.mobile-navbar-pro {
  background: linear-gradient(135deg, #3b82f6 0%, #4338ca 100%);
}

.profile-avatar-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.profile-avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #ffffff;
  color: #3b82f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.profile-mini-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
}

.profile-mini-email {
  font-size: 0.95rem;
  color: #111827;
}

@media (max-width: 767.98px) {
  .profile-mini-panel {
    flex-direction: column;
    align-items: flex-start;
  }
}
.mobile-navbar-pro {
  background: linear-gradient(135deg, #3b82f6 0%, #4338ca 100%);
}


.profile-menu-wrap {
  display: flex;
  align-items: center;
}

.profile-avatar-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.profile-avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #ffffff;
  color: #3b82f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.profile-mini-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
}

.profile-mini-email {
  font-size: 0.95rem;
  color: #111827;
}

@media (max-width: 767.98px) {
  .profile-mini-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar-lang-switch {
    width: 100%;
    justify-content: center;
    margin-bottom: 0.25rem;
  }
}