// GiftFlow Overview Dashboard Component (inherits --gfh-* from .giftflow-dashboard-view)
.giftflow-overview {
  display: grid;
  grid-template-columns: 1fr 25%;
  gap: 2rem;
  margin-top: 0;
  box-sizing: border-box;

  // Main content area (left column)
  &__main {
    background: var(--gfh-bg, #fff);
    border: 1px solid var(--gfh-line, #dcdcde);
    border-radius: var(--gfh-radius, 8px);
    padding: 1.5rem;
    box-shadow: var(--gfh-shade, 0 1px 3px rgba(0, 0, 0, 0.06));
  }

  &__widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;

    .giftflow-overview__widget-title {
      margin: 0;
    }
  }

  &__chart {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--gfh-bg-soft, #f6f7f7);
    border: 1px solid var(--gfh-line, #dcdcde);
    border-radius: var(--gfh-radius, 8px);
  }

  &__widget-header-btn {
    padding: 0.5rem;
    cursor: pointer;
    color: var(--gfh-text-muted, #646970);
    transition: color 0.2s var(--gfh-ease, ease), border-color 0.2s var(--gfh-ease, ease);
    border: 1px solid var(--gfh-line, #dcdcde);
    background: var(--gfh-bg, #fff);
    line-height: 0;
    border-radius: var(--gfh-radius-sm, 6px);

    &:hover {
      color: var(--gfh-theme, #2271b1);
      border-color: var(--gfh-line-strong, #c3c4c7);
    }

    &:active {
      opacity: 0.85;
    }

    &:focus {
      outline: none;
      box-shadow: 0 0 0 1px var(--gfh-theme, #2271b1);
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }

  &__title {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gfh-text, #1d2327);
  }

  // Stats section
  &__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
  }

  &__stat-card {
    background: var(--gfh-bg-soft, #f6f7f7);
    border: 1px solid var(--gfh-line, #dcdcde);
    border-radius: var(--gfh-radius, 8px);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition:
      background var(--gfh-dur, 0.2s) var(--gfh-ease, ease),
      border-color var(--gfh-dur, 0.2s) var(--gfh-ease, ease),
      box-shadow var(--gfh-dur, 0.2s) var(--gfh-ease, ease);

    &:hover {
      background: var(--gfh-bg, #fff);
      border-color: color-mix(in srgb, var(--gfh-theme, #2271b1) 35%, var(--gfh-line, #dcdcde));
      box-shadow: var(--gfh-shade-hover, 0 8px 24px rgba(0, 0, 0, 0.08));
    }
  }

  &__stat-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gfh-bg, #fff);
    border-radius: var(--gfh-radius-sm, 6px);
    border: 1px solid var(--gfh-line, #dcdcde);
    color: var(--gfh-theme, #2271b1);

    svg {
      flex-shrink: 0;
    }
  }

  &__stat-content {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  &__stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gfh-text, #1d2327);
    line-height: 1;
  }

  &__stat-label {
    font-size: 0.875rem;
    color: var(--gfh-text-muted, #646970);
    margin-top: 0.25rem;
  }

  // Recent activity section
  &__recent-activity {
    // h4 {
    //   margin: 0 0 1rem 0;
    //   font-size: 1.125rem;
    //   font-weight: 600;
    //   color: #1e1e1e;
    // }
  }

  &__activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  &__activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gfh-bg-soft, #f6f7f7);
    border-radius: var(--gfh-radius-sm, 6px);
    border: 1px solid var(--gfh-line, #dcdcde);
    transition:
      background var(--gfh-dur, 0.2s) var(--gfh-ease, ease),
      border-color var(--gfh-dur, 0.2s) var(--gfh-ease, ease);

    &:hover {
      background: var(--gfh-bg, #fff);
      border-color: var(--gfh-line-strong, #c3c4c7);
    }
  }

  &__activity-icon {
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gfh-bg, #fff);
    border-radius: 4px;
    border: 1px solid var(--gfh-line, #dcdcde);
    flex-shrink: 0;
  }

  &__activity-content {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  &__activity-text {
    font-size: 0.875rem;
    color: var(--gfh-text, #1d2327);
    line-height: 1.4;
    margin-bottom: 0.25rem;
  }

  &__activity-time {
    font-size: 0.75rem;
    color: var(--gfh-text-muted, #646970);
  }

  // Sidebar (right column)
  &__sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  &__widget {
    background: var(--gfh-bg-soft, #f6f7f7);
    border: 1px solid var(--gfh-line, #dcdcde);
    border-radius: var(--gfh-radius, 8px);
    padding: 1.5rem;
  }

  &__widget-title {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gfh-text, #1d2327);
  }

  &__widget--actions {
    background: var(--gfh-bg, #fff);
    box-shadow: var(--gfh-shade, 0 1px 3px rgba(0, 0, 0, 0.06));
  }

  // Quick actions (WordPress .button inside)
  &__action-list {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 10px;

    .button {
      width: 100%;
      display: inline-flex !important;
      align-items: center;
      justify-content: flex-start;
      gap: 8px;
      font-weight: 600;
      text-align: left;
      padding: .5rem 1rem !important;

      @media (max-width: 519px) {
        padding: .2rem .5rem !important;
      }
    }
  }

  &__action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    flex-shrink: 0;
  }

  // Campaign progress
  &__campaign-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  &__campaign-item {
    background: var(--gfh-bg, #fff);
    border: 1px solid var(--gfh-line, #dcdcde);
    border-radius: var(--gfh-radius-sm, 6px);
    padding: 1rem;
  }

  &__campaign-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
  }

  &__campaign-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gfh-text, #1d2327);
  }

  &__campaign-progress {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gfh-theme, #2271b1);
  }

  &__progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gfh-bg-muted, #f0f0f1);
    border-radius: 3px;
    overflow: hidden;
  }

  &__progress-fill {
    height: 100%;
    background: linear-gradient(
      90deg,
      var(--gfh-theme, #2271b1) 0%,
      var(--gfh-theme-2, #135e96) 100%
    );
    border-radius: 3px;
    transition: width 0.3s ease;
  }

  // Responsive design
  @media (max-width: 768px) {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;

    &__stats {
      grid-template-columns: 1fr;
      gap: 0.75rem;
    }

    &__stat-card {
      padding: 0.75rem;
    }

    &__stat-icon {
      width: 32px;
      height: 32px;
      font-size: 1.25rem;
    }

    &__stat-value {
      font-size: 1.125rem;
    }

    &__main,
    &__widget {
      padding: 1rem;
    }

    &__activity-item {
      padding: 0.5rem;
    }

    &__action-link {
      padding: 0.5rem;
    }

    &__campaign-item {
      padding: 0.75rem;
    }
  }

  @media (max-width: 480px) {
    gap: 1rem;
    margin-top: 1rem;

    &__title {
      font-size: 1.25rem;
    }

    &__main,
    &__widget {
      padding: 0.75rem;
    }

    &__stats {
      gap: 0.5rem;
    }

    &__stat-card {
      padding: 0.5rem;
      gap: 0.5rem;
    }

    &__stat-icon {
      width: 28px;
      height: 28px;
      font-size: 1rem;
    }

    &__stat-value {
      font-size: 1rem;
    }

    &__stat-label {
      font-size: 0.75rem;
    }

    &__activity-item {
      padding: 0.5rem;
      gap: 0.5rem;
    }

    &__activity-icon {
      width: 28px;
      height: 28px;
      font-size: 1rem;
    }

    &__activity-text {
      font-size: 0.8rem;
    }

    &__activity-time {
      font-size: 0.7rem;
    }

    &__action-link {
      padding: 0.5rem;
      font-size: 0.8rem;
    }

    &__campaign-item {
      padding: 0.5rem;
    }

    &__campaign-name {
      font-size: 0.8rem;
    }

    &__campaign-progress {
      font-size: 0.7rem;
    }
  }
}

// Skeleton loading styles for overview cards and stats
.giftflow-overview {
  &__stat-card--loading {
    .giftflow-overview__stat-icon,
    .giftflow-overview__stat-value,
    .giftflow-overview__stat-label {
      @extend .skeleton;
    }
  }
}

// Generic skeleton utility
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gfh-bg-muted, #f0f0f1) 25%,
    var(--gfh-line, #dcdcde) 37%,
    var(--gfh-bg-muted, #f0f0f1) 63%
  );
  background-size: 400% 100%;
  animation: giftflow-skeleton-loading 1.4s ease infinite;
  border-radius: 4px;
  min-height: 1em;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

@keyframes giftflow-skeleton-loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

// Chart styles
.giftflow-chart-container {
  width: 100%;

  .giftflow-chart-wrapper {
    position: relative;
    height: 400px;
    margin-bottom: 1rem;
  }

  .giftflow-chart-description {
    font-size: 13px;
    line-height: 1.55;
    color: var(--gfh-text-secondary, #50575e);
    color: black;

    &__select {
      font-size: 0.95em;
      display: inline;
      padding: 0.2rem 1.5em 0.2rem 0.25rem;
      background-color: var(--gfh-bg, #fff);
      margin: 0;
      line-height: normal;
      border: none;
      border-bottom: 2px solid var(--gfh-theme, #2271b1);
      height: auto !important;
      min-height: auto;
      border-radius: 0;
      color: var(--gfh-text, #1d2327);
      cursor: pointer;
      background-image: url(../../images/chevron-down-icon.svg);
      background-size: 10px;
      background-position: right 0.5em center;
      background-repeat: no-repeat;

      &:focus {
        outline: 1px solid var(--gfh-theme, #2271b1);
        outline-offset: 2px;
      }
    }

    &__legend {
      font-weight: 600;

      &--donations {
        color: var(--gfh-chart-donations, #007017);
      }

      &--donors {
        color: var(--gfh-chart-donors, #2271b1);
      }
    }
  }
}

.giftflow-chart-cache-note {
  margin-top: 1rem;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.2rem;
  color: var(--gfh-text-muted, #646970);
}

.giftflow-chart-clear-cache-btn {
  margin-left: auto;
  padding: 0.35em 0.85em;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  border-radius: var(--gfh-radius-sm, 6px);
  border: 1px solid var(--gfh-line, #dcdcde);
  background: var(--gfh-bg-soft, #f6f7f7);
  color: var(--gfh-theme, #2271b1);
  transition:
    background var(--gfh-dur, 0.2s) var(--gfh-ease, ease),
    border-color var(--gfh-dur, 0.2s) var(--gfh-ease, ease);

  &:hover {
    background: var(--gfh-bg-muted, #f0f0f1);
    border-color: var(--gfh-theme, #2271b1);
  }
}

// Chart loading state
.giftflow-chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--gfh-text-muted, #646970);

  &__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gfh-bg-muted, #f0f0f1);
    border-top: 3px solid var(--gfh-theme, #2271b1);
    border-radius: 50%;
    animation: giftflow-chart-spin 1s linear infinite;
    margin-bottom: 1rem;
  }

  p {
    margin: 0;
    font-size: 0.875rem;
  }
}

@keyframes giftflow-chart-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

// Chart error state
.giftflow-chart-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--gfh-text-muted, #646970);

  &__icon {
    margin-bottom: 1rem;
    color: #d63638;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
  }

  h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #d63638;
  }

  p {
    margin: 0 0 1.5rem 0;
    font-size: 0.875rem;
    max-width: 400px;
    line-height: 1.5;
  }

  &__retry {
    background: var(--gfh-theme, #2271b1);
    color: #fff;
    border: none;
    border-radius: var(--gfh-radius-sm, 6px);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition:
      background var(--gfh-dur, 0.2s) var(--gfh-ease, ease),
      transform var(--gfh-dur, 0.2s) var(--gfh-ease, ease);

    &:hover {
      background: var(--gfh-theme-2, #135e96);
    }

    &:active {
      transform: scale(0.98);
    }
  }
}

// Chart empty state
.giftflow-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--gfh-text-muted, #646970);

  &__icon {
    margin-bottom: 1rem;
    color: var(--gfh-text-muted, #646970);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
  }

  h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gfh-text, #1d2327);
  }

  p {
    margin: 0;
    font-size: 0.875rem;
    max-width: 400px;
    line-height: 1.5;
  }
}
