body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    background: #181818;
    color: #fff;
    background: linear-gradient(120deg, #222 80%, #e63946 100%);

}

.section {
    background: #181818;
    border-radius: 18px;
    box-shadow: 0 4px 24px #0004;
    padding: 48px 32px;
    margin: 48px auto;
    max-width: 1100px;
}

.section h2 {
    color: #e63946;
    text-align: center;
    font-size: 2em;
    margin-bottom: 32px;
    letter-spacing: 1px;
}


.back-link {
    text-align: left;
    margin: 20px 0 0 0;
    display: block;
    color: #e63946;
    text-decoration: none;
    font-weight: bold;
}

.flip-card {
  background-color: transparent;
  width: 300px;
  height: 200px;
  perspective: 1000px;
  border: #e63946;
  display: flex;
  justify-content: center;
  margin: 0;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
  width: 380px;
  max-width: calc(100% - 40px);
}

/* optional: keep flip on hover */
.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: linear-gradient(135deg, #232526 60%, #1f1f1f 100%);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flip-card-front {
  color: white;
  transform: rotateY(0deg);
  z-index: 2;
}
.flip-card-front img{
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
}

.flip-card-back {
  background-color: #2980b9;
  color: white;
  transform: rotateY(180deg);
}

/* header row: image left, text right */
.rep-header {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* circular image */
.rep-img {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e63946;
    box-shadow: 0 6px 18px rgba(230,57,70,0.18);
    flex: 0 0 76px;
}

/* info area */
.rep-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 1 auto;    /* اجازه می‌دهد بخش info فضای باقی‌مانده را بگیرد */
    min-width: 0;      /* اجازه می‌دهد محتوا داخل flexbox کوچک شود (برای شکستن درست متن) */
    overflow: visible; /* قبلاً ممکن بود hidden باشد؛ حالا اجازه‌ی نمایش کامل را می‌دهد */
}

.rep-name {
    font-size: 1.12rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    white-space: normal;    /* اجازه‌ی چندخطی شدن نام */
    text-overflow: unset;
    overflow: visible;
    word-break: break-word; /* اگر خیلی طولانی بود، در نقطه مناسب بشکند */
}

.rep-country {
    margin-top: 6px;
    color: #e63946;
    font-weight: 600;
    font-size: 0.95rem;
}

/* caption under the header row */
.rep-caption {
    color: #d0d0d0;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
    margin-top: 6px;
}

/* back side layout */
.rep-back-content {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 10px;
}

.rep-back-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid #e63946;
}

/* responsive: stack image above text on narrow screens */
@media (max-width: 540px) {
    .flip-card-inner { width: 100%; }
    .rep-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .rep-info { align-items: center; }
    .rep-name { white-space: normal; }
}

/* small visual tweak to ensure nav etc. not overlapped */
.flip-card { z-index: 1; }

.reps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    align-items: start;
    margin-top: 18px;
}

/* ensure card content scales to grid cell */
.flip-card {
    perspective: 1000px;
    margin: 0;
}

.flip-card-inner {
    width: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
    min-height: 180px;
}

/* front/back fit container */
.flip-card-front,
.flip-card-back {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

/* make image and header adapt */
.rep-header { gap: 12px; align-items: center; }
.rep-img { width: 76px; height: 76px; flex: 0 0 76px; }

/* smaller screens tweaks */
@media (max-width: 520px) {
    .reps-grid { gap: 14px; }
    .rep-img { width: 68px; height: 68px; flex: 0 0 68px; }
    .rep-name { font-size: 1rem; }
    .rep-caption { font-size: 0.95rem; }
}