/* ==========================
   Campaign Metrics Styling
   ========================== */

.cm-card {
  width: 100%;
  max-width: none;
  margin: 0 0 24px 0;
  padding: 32px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #eef1f4;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  font-family: 'Inter', 'Segoe UI', sans-serif;
  color: #1a1a1a;
  transition: all .25s ease;
}

.cm-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.cm-main {
  text-align: left;
}

.cm-raised {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--cm-primary-dark, #083d77);
  margin-bottom: 6px;
  line-height: 1.2;
}

.cm-sub {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 14px;
}

.cm-progress-wrap {
  background: #e5e7eb;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.cm-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 6px;

  /* Gradient uses dynamic primary colour */
  background: linear-gradient(
    90deg,
    var(--cm-primary-light, #3b82f6),
    var(--cm-primary, #1e3a8a)
  );

  transition: width 1s ease-in-out;
}

.cm-footer {
  font-size: 0.95rem;
  color: #374151;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cm-number-primary {
  color: var(--cm-primary-dark);
  font-weight: 700;
}

.cm-percent-primary {
  color: var(--cm-primary);
  font-weight: 600;
}

/* ==========================
   Mobile Responsiveness
   ========================== */

@media (max-width: 480px) {
  .cm-card {
    padding: 20px;
    border-radius: 14px;
  }

  .cm-raised {
    font-size: 1.8rem;
  }

  .cm-sub {
    font-size: 0.95rem;
  }

  .cm-progress-wrap {
    height: 8px;
  }

  .cm-footer {
    font-size: 0.9rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .cm-footer span {
    float: none !important;
  }
}

/* Small tablets and larger phones */
@media (max-width: 768px) {
  .cm-card {
    padding: 24px;
  }

  .cm-raised {
    font-size: 2rem;
  }
}

/* ==========================
   Recent Donations Styling
   ========================== */

.cm-recent-box {
    width: 100%;
    max-width: none;
    padding: 24px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #eef1f4;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #1a1a1a;
}


.cm-recent-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.cm-recent-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cm-primary-dark);
  margin-bottom: 16px;
  text-align: center;
}

.cm-recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Each donor row */
.cm-recent-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #eef1f4;
}

.cm-recent-item:last-child {
  border-bottom: none;
}

.cm-recent-name {
  font-weight: 600;
  color: #374151;
}

.cm-recent-amount {
  font-weight: 700;
  color: var(--cm-primary-dark);
}

.cm-recent-box {
    max-height: 340px; /* match donation progress card's height */
    overflow-y: auto;
    padding-right: 12px; /* prevent text cut-off */
}

/* Date under name */
.cm-recent-date {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 2px;
}

.cm-recent-note {
  display: block;
  font-size: 0.85rem;
  color: #334155; 
  margin-top: 8px;
  padding: 10px 14px;

  /* Background bubble */
  background: #f8fafc;
  border-radius: 10px;
  line-height: 1.5;

  /* Accent bar */
  border-left: 4px solid var(--cm-primary-light, #3b82f6);

  /* Truncation */
  max-height: 3.3em;
  overflow: hidden;
  text-overflow: ellipsis;

  /* Shadow */
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);

  /* Smooth transitions */
  transition: all 0.3s ease;
}

.cm-recent-note:hover {
  max-height: 300px; /* expands to show full message */
  background: #eef2f7;
}



.cm-recent-box::-webkit-scrollbar {
    width: 6px;
}
.cm-recent-box::-webkit-scrollbar-thumb {
    background: var(--cm-primary-light);
    border-radius: 4px;
}
.cm-recent-box::-webkit-scrollbar-track {
    background: #f0f0f0;
}

/* ==========================
   Top Donors Styling (Improved)
   ========================== */

.cm-topdonors-box {
    width: 100%;
    padding: 24px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #eef1f4;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    font-family: 'Inter', 'Segoe UI', sans-serif;

    /* Match Recent Donations height */
    max-height: 340px;
    overflow-y: auto;
    position: relative;

    /* dynamic colours */
    color: #1a1a1a;
}

.cm-topdonors-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

/* Title */
.cm-topdonors-title {
    font-weight: 700;
    color: var(--cm-primary-dark);
    margin-bottom: 16px;
    font-size: 1.2rem;
    text-align: center;
}

/* Donor list container */
.cm-topdonors-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Single donor line */
.cm-topdonors-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eef1f4;
    padding-bottom: 10px;
}

.cm-topdonors-item:last-child {
    border-bottom: none;
}

/* Name + contribution count */
.cm-topdonors-name {
    font-weight: 600;
    color: #374151;
}

.cm-topdonors-sub {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Amount on the right */
.cm-topdonors-amount {
    color: var(--cm-primary-dark);
    font-weight: 700;
    white-space: nowrap;
}

/* Scrollbar styling */
.cm-topdonors-box::-webkit-scrollbar {
    width: 6px;
}

.cm-topdonors-box::-webkit-scrollbar-thumb {
    background: var(--cm-primary-light);
    border-radius: 4px;
}

.cm-topdonors-box::-webkit-scrollbar-track {
    background: #f0f0f0;
}

/* ==========================
   Card Load Animation
   ========================== */

.cm-animate {
    opacity: 0;
    transform: translateY(15px);
    animation: cmFadeUp 0.6s ease-out forwards;
}

@keyframes cmFadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Mobile responsiveness ===== */

@media (max-width: 480px) {
  .cm-recent-box,
  .cm-topdonors-box {
    padding: 20px;
    border-radius: 14px;
  }

  .cm-recent-title,
  .cm-topdonors-title {
    font-size: 1.05rem;
    margin-bottom: 12px;
  }

  .cm-recent-item,
  .cm-topdonors-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .cm-recent-amount,
  .cm-topdonors-amount {
    font-size: 1rem;
  }
}

