// GiftFlow Overview Dashboard Component
.giftflow-overview {
  display: grid;
  grid-template-columns: 1fr 25%;
  gap: 2rem;
  margin-top: 2rem;
  box-sizing: border-box;

  // Main content area (left column)
  &__main {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }

  &__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: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
  }

  &__widget-header-btn {
    // only icon inner
    padding: .5rem;
    background: #f8f9fa;
    border: none;
    background: none;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s ease;
    border: solid 1px #e0e0e0;
    line-height: 0;
    border-radius: .2rem;

    &:hover {
      opacity: 0.8;
    }

    &:active {
      opacity: 0.6;
    }

    &:focus {
      outline: none;
      box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
    }

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

  &__title {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e1e1e;
  }

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

  &__stat-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;

    &:hover {
      background: #fff;
      border-color: black;
      box-shadow: 0 2px 8px rgba(34, 113, 177, 0.1);
    }
  }

  &__stat-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e9ecef;
  }

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

  &__stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e1e1e;
    line-height: 1;
  }

  &__stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    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: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;

    &:hover {
      background: #fff;
      border-color: #e0e0e0;
    }
  }

  &__activity-icon {
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    flex-shrink: 0;
  }

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

  &__activity-text {
    font-size: 0.875rem;
    color: #1e1e1e;
    line-height: 1.4;
    margin-bottom: 0.25rem;
  }

  &__activity-time {
    font-size: 0.75rem;
    color: #6c757d;
  }

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

  &__widget {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
  }

  &__widget-title {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e1e1e;
  }

  // Quick actions
  &__action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  &__action-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    justify-content: space-between;
    padding: .7rem;
    background: black;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;

    &:hover,
    &:focus {
      opacity: .5;
    }

    &:active {
      opacity: .5;
    }

    &:disabled,
    &[aria-disabled="true"] {
      background: #b8c7d9;
      color: #fff;
      cursor: not-allowed;
      opacity: 0.7;
    }
  }

  &__action-icon {
    text-align: center;
    line-height: 0;
  }

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

  &__campaign-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 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: #1e1e1e;
  }

  &__campaign-progress {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2271b1;
  }

  &__progress-bar {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
  }

  &__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2271b1 0%, #165a8f 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, #f0f0f0 25%, #e4e4e4 37%, #f0f0f0 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 {
    
    &__select {
      font-size: 0.95em;
      display: inline;
      padding: .2rem;
      background-color: white;
      margin: 0;
      line-height: normal;
      border: none;
      border-bottom: solid 2px;
      height: auto !important;
      min-height: auto;
      border-radius: 0;

      background-image: url(../../images/chevron-down-icon.svg);
      background-size: 10px;
      background-position: right 0.5em center;
      background-repeat: no-repeat;
      padding-right: 1.5em !important;
    }
  }
}

// Chart loading state
.giftflow-chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: #6b7280;
  
  &__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    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: #6b7280;
  
  &__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
  }
  
  h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #dc2626;
  }
  
  p {
    margin: 0 0 1.5rem 0;
    font-size: 0.875rem;
    max-width: 400px;
    line-height: 1.5;
  }
  
  &__retry {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    
    &:hover {
      background: #2563eb;
    }
    
    &:active {
      background: #1d4ed8;
    }
  }
}

// Chart empty state
.giftflow-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: #6b7280;
  
  &__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
  }
  
  h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
  }
  
  p {
    margin: 0;
    font-size: 0.875rem;
    max-width: 400px;
    line-height: 1.5;
  }
}
