@import './modules/variables';

@import './modules/loading';
@import './modules/donation-list';
@import './modules/comment-list';
@import './modules/comment-form';
@import './modules/donation-button';
@import './modules/share';
@import './modules/modal';
@import './modules/campaign-single-images';
@import './modules/shortcode-campaign-grid';

// donor account style
@import './modules/donor-account';

// giftflow-table style
@import './modules/giftflow-table';

// gfw-pagination style
@import './modules/giftflow-pagination'; 

// monofont global class name
.gfw-monofont {
  font-family: $font-family-monospace;
}

.__hidden-fieldset {
  display: none;
}

.gfw-elem-loading-spinner {
  cursor: not-allowed;
  pointer-events: none;
  overflow: hidden;
  position: relative;

  &:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    z-index: 1;
  }

  &::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.5em;
    height: 1.5em;
    transform: translate(-50%, -50%);
    border: 0.2em solid #ccc;
    border-top: 0.2em solid $primary-color;
    border-radius: 50%;
    animation: gfw-spin 1s linear infinite;
    z-index: 2;
    // just above overlay
  }

  @keyframes gfw-spin {
    0%   { transform: translate(-50%, -50%) rotate(0deg);}
    100% { transform: translate(-50%, -50%) rotate(360deg);}
  }
}

.gfw-tag-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.4;
  
  &.status-active {
    background-color: #e6f7e6;
    color: #2e7d32;
  } 
  
  &.status-completed {
    background-color: #e3f2fd;
    color: #1565c0;
  }
  
  &.status-pending {
    background-color: #fff8e1;
    color: #f57c00;
  }

  &.status-closed {
    background-color: #f5f5f5;
    color: #757575;
  }
  
  &.status-unknown {
    background-color: #f5f5f5;
    color: $text-light;
  }
}

// Current user info box (dashboard-style account tag: avatar, name, email, donor profile link)
.giftflow-user-info {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 1rem 1.25rem;
  padding: 1rem 1.25rem;
  background: $background-color;
  border: 1px solid $border-color;
  border-radius: $border-radius;
  box-sizing: border-box;

  @media (max-width: 768px) {
    width: 100%;
    padding: 1rem;
    gap: 0.875rem 1rem;
    flex-wrap: wrap;
  }

  @media (max-width: 480px) {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.75rem;
  }

  .giftflow-user-avatar {
    flex-shrink: 0;
    display: inline-block;
    border-radius: 50%;
    overflow: hidden;
    line-height: 0;
    border: 1px solid $border-color;

    img {
      width: 48px;
      height: 48px;
      display: block;
      object-fit: cover;
    }

    @media (max-width: 480px) {
      img {
        width: 40px;
        height: 40px;
      }
    }
  }

  .giftflow-user-name {
    font-weight: 600;
    font-size: 1rem;
    color: $text-color;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    @media (max-width: 480px) {
      font-size: 0.95rem;
    }
  }

  .giftflow-user-email {
    font-size: 0.9em;
    color: $text-light;
    word-break: break-word;

    @media (max-width: 480px) {
      font-size: 0.85em;
    }
  }

  .giftflow-my-donor-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: white;
    border: 1px solid $border-color;
    border-radius: $border-radius;
    color: $primary-color;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: $transition;
    min-height: 44px;
    box-sizing: border-box;
    margin-left: auto;
    white-space: nowrap;
    line-height: normal;

    &:hover {
      border-color: $primary-color;
      background: rgba(0, 0, 0, 0.02);
    }

    &:focus {
      outline: 2px solid $primary-color;
      outline-offset: 2px;
    }

    svg {
      width: 1em;
      height: 1em;
      flex-shrink: 0;
    }

    @media (max-width: 480px) {
      width: 100%;
      justify-content: center;
      padding: 0.6rem 0.75rem;
      font-size: 0.9rem;
    }
  }
}