/* ============================================================
   Alshdokhi Family Plugin — Front-end Styles
   Site colors: Purple #41358C  |  Navy #191436
   ============================================================ */

:root {
  --af-primary:   #41358C;
  --af-primary-l: #5a4ab8;
  --af-navy:      #191436;
  --af-gold:      #c9a84c;
  --af-male:      #2e6fad;
  --af-female:    #b5507a;
  --af-grey:      #888;
  --af-radius:    10px;
  --af-shadow:    0 2px 12px rgba(0,0,0,.12);
}

/* ── Shared ─────────────────────────────────────────────── */
.alshdokhi-empty {
  text-align: center;
  color: var(--af-grey);
  padding: 2rem;
  font-size: 1rem;
  direction: rtl;
}

/* ============================================================
   FAMILY TREE
   ============================================================ */
.alshdokhi-tree-wrap {
  overflow-x: auto;
  padding: 1rem 0;
  direction: rtl;
}

.alshdokhi-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.aft-root {
  padding-right: 0 !important;
}

.aft-node {
  position: relative;
  padding-right: 2rem;
  margin-top: .5rem;
}

/* vertical line */
.aft-node::before {
  content: '';
  position: absolute;
  right: .75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #d0c8f0;
}
.aft-node:last-child::before { height: 1.6rem; }

/* horizontal branch */
.aft-node::after {
  content: '';
  position: absolute;
  right: .75rem;
  top: 1.6rem;
  width: 1.25rem;
  height: 2px;
  background: #d0c8f0;
}

.aft-root > .aft-node { padding-right: 0; }
.aft-root > .aft-node::before,
.aft-root > .aft-node::after { display: none; }

/* card */
.aft-card {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  background: #fff;
  border: 2px solid #e0dbf5;
  border-radius: var(--af-radius);
  padding: .45rem .7rem .45rem .5rem;
  box-shadow: var(--af-shadow);
  cursor: default;
  position: relative;
  transition: border-color .2s, box-shadow .2s;
  max-width: 280px;
}
.aft-card:hover { border-color: var(--af-primary); box-shadow: 0 4px 18px rgba(65,53,140,.2); }

.aft-male   > .aft-card { border-right: 4px solid var(--af-male); }
.aft-female > .aft-card { border-right: 4px solid var(--af-female); }
.aft-deceased > .aft-card { opacity: .7; filter: grayscale(.4); }

.aft-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.aft-no-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aft-no-photo.aft-male   { background: #d6e8fa; }
.aft-no-photo.aft-female { background: #fce4ef; }
.aft-no-photo svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.aft-male   .aft-no-photo svg { color: var(--af-male); }
.aft-female .aft-no-photo svg { color: var(--af-female); }

.aft-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.aft-name {
  font-weight: 700;
  font-size: .9rem;
  color: var(--af-navy);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aft-name:hover { color: var(--af-primary); }
.aft-role {
  font-size: .72rem;
  background: var(--af-primary);
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  width: fit-content;
}
.aft-rip {
  font-size: .7rem;
  color: var(--af-grey);
  font-style: italic;
}

.aft-toggle {
  margin-right: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--af-primary);
  font-size: 1rem;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform .25s;
}
.aft-toggle[aria-expanded="false"] { transform: rotate(-90deg); }

.aft-children {
  padding-right: 1rem;
  margin-top: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.aft-children.aft-collapsed { display: none; }

/* ============================================================
   BOX MANAGEMENT
   ============================================================ */
.alshdokhi-box-mgmt {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  direction: rtl;
  padding: 1rem 0;
}

.abm-card {
  background: #fff;
  border-radius: var(--af-radius);
  box-shadow: var(--af-shadow);
  padding: 1.5rem 1rem;
  text-align: center;
  width: 180px;
  flex-shrink: 0;
  border-top: 4px solid var(--af-primary);
  transition: transform .2s, box-shadow .2s;
}
.abm-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(65,53,140,.18); }

.abm-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto .75rem;
  display: block;
  border: 3px solid var(--af-primary);
}
.abm-no-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #e8e4f8;
  margin: 0 auto .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--af-primary);
}
.abm-no-photo svg {
  width: 48px; height: 48px;
  fill: none; stroke: var(--af-primary);
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.abm-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--af-navy);
  margin: 0 0 .35rem;
}
.abm-role {
  display: inline-block;
  font-size: .78rem;
  background: var(--af-primary);
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
}

/* ============================================================
   NEWS & EVENTS GRID
   ============================================================ */
.alshdokhi-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  direction: rtl;
  padding: 1rem 0;
}

.an-card {
  background: #fff;
  border-radius: var(--af-radius);
  box-shadow: var(--af-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.an-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.15); }

.an-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.an-no-thumb {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #e8e4f8 0%, #d0c8f0 100%);
}

.an-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
}

.an-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 8px;
  width: fit-content;
}
.an-badge-news         { background: #e8f4ff; color: #1a6fa8; }
.an-badge-event        { background: #fff3e0; color: #b85c00; }
.an-badge-announcement { background: #fce4ef; color: #b5507a; }

.an-title { font-size: 1rem; font-weight: 700; margin: 0; color: var(--af-navy); }
.an-title a { text-decoration: none; color: inherit; }
.an-title a:hover { color: var(--af-primary); }

.an-excerpt { font-size: .85rem; color: #555; margin: 0; line-height: 1.55; }
.an-date    { font-size: .75rem; color: var(--af-grey); margin-top: auto; }

/* ============================================================
   PROGRAMS GRID
   ============================================================ */
.alshdokhi-programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  direction: rtl;
  padding: 1rem 0;
}

.ap-card {
  background: #fff;
  border-radius: var(--af-radius);
  box-shadow: var(--af-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.ap-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.15); }

.ap-thumb    { width: 100%; height: 180px; object-fit: cover; }
.ap-no-thumb { width: 100%; height: 180px; background: linear-gradient(135deg, #e8e4f8, #bfb5e0); }

.ap-body  { padding: 1rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.ap-tags  { display: flex; gap: .4rem; flex-wrap: wrap; }

.ap-type {
  font-size: .72rem; background: #e8e4f8;
  color: var(--af-primary); border-radius: 4px; padding: 2px 8px;
}
.ap-status             { font-size: .72rem; border-radius: 4px; padding: 2px 8px; }
.ap-status-upcoming    { background: #fff8e1; color: #b07800; }
.ap-status-active      { background: #e6f9ec; color: #1a7a38; }
.ap-status-ended       { background: #f5f5f5; color: #888; }

.ap-title   { font-size: 1rem; font-weight: 700; margin: 0; color: var(--af-navy); }
.ap-title a { text-decoration: none; color: inherit; }
.ap-title a:hover { color: var(--af-primary); }

.ap-excerpt { font-size: .85rem; color: #555; margin: 0; line-height: 1.55; }

.ap-register {
  display: inline-block;
  margin-top: auto;
  background: var(--af-primary);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  padding: .45rem 1rem;
  font-size: .85rem;
  font-weight: 700;
  text-align: center;
  transition: background .2s;
}
.ap-register:hover { background: var(--af-primary-l); color: #fff; }

/* ============================================================
   MEDIA CENTER GRID
   ============================================================ */
.alshdokhi-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  direction: rtl;
  padding: 1rem 0;
}

.amc-card {
  background: #fff;
  border-radius: var(--af-radius);
  box-shadow: var(--af-shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.amc-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.15); }

.amc-link { display: block; position: relative; overflow: hidden; }

.amc-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}
.amc-card:hover .amc-thumb { transform: scale(1.05); }

.amc-no-thumb {
  width: 100%;
  height: 160px;
  background: #e8e4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.amc-overlay {
  position: absolute;
  inset: 0;
  background: rgba(65,53,140,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .25s;
  font-size: 2.5rem;
  color: #fff;
}
.amc-card:hover .amc-overlay { opacity: 1; }

.amc-info  { padding: .6rem .75rem .75rem; }
.amc-title { font-size: .88rem; font-weight: 700; color: var(--af-navy); margin: 0 0 .2rem; }
.amc-date  { font-size: .72rem; color: var(--af-grey); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .alshdokhi-news-grid,
  .alshdokhi-programs-grid { grid-template-columns: 1fr; }
  .alshdokhi-media-grid    { grid-template-columns: repeat(2, 1fr); }
  .abm-card { width: 140px; }
  .abm-photo, .abm-no-photo { width: 80px; height: 80px; }
}
