@use "../global/assets/styles/abstracts" as *;
@forward "./TrelloExample/index";
@forward "./ClickUpExample/index";

// Clean page layout
.#{$demo-prefix}-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;

  &-header {
    padding: var(--space-5) var(--space-5) var(--space-5);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.08);
    position: relative;
    z-index: 1;

    @include media-down(md) {
      padding: var(--space-6) var(--space-6) var(--space-4);
    }

    @include media-down(sm) {
      padding: var(--space-4) var(--space-4) var(--space-3);
    }

    h1 {
      @include text-gradient;
      margin-bottom: var(--space-1);
      font-size: 1.3rem;
      font-weight: 700;
      letter-spacing: var(--tracking-tight);
      line-height: var(--leading-tight);

      @include media-down(md) {
        font-size: 1.75rem;
      }

      @include media-down(sm) {
        font-size: 1.5rem;
      }
    }

    p {
      color: var(--gray-600);
      font-size: 1rem;
      font-weight: 400;
      line-height: var(--leading-relaxed);
      max-width: 600px;
      white-space: nowrap;

      @include media-down(md) {
        font-size: 0.9375rem;
      }

      @include media-down(sm) {
        font-size: 0.875rem;
      }
    }
  }

  &-content {
    overflow: hidden;
    padding: var(--space-3);
    position: relative;
    z-index: 1;
    height: calc(100vh - 155px);

    @include media-down(md) {
      padding: var(--space-4);
    }

    @include media-down(sm) {
      padding: var(--space-3);
    }
  }
}

// Professional demo task cards - simplified
.demo-task-card {
  @include card;
  padding: var(--space-3);
  background: white;
  border: 1px solid var(--gray-200);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  min-height: 80px;
  display: flex;
  flex-direction: column;

  &:hover {
    box-shadow: var(--shadow-md);
    // transform: translateY(-1px);
    border-color: var(--primary-200);
  }

  &-header {
    @include flex-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
    gap: var(--space-2);
  }

  &-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-900);
    line-height: var(--leading-snug);
    margin: 0;
    flex: 1;
    @include text-truncate-lines(2);
  }

  &-footer {
    @include flex-start;
    align-items: center;
    gap: var(--space-2);
    margin-top: auto;
    padding-top: var(--space-2);
  }

  &-assignee {
    @include flex-start;
    gap: var(--space-1-5);
    font-size: var(--text-xs);
    color: var(--gray-600);
    font-weight: 500;

    svg {
      color: var(--gray-400);
    }

    span {
      @include text-truncate;
      max-width: 100px;
    }
  }
}

.demo-list-footer {
  @include flex-between;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-600);
  line-height: var(--leading-snug);
  margin: 0;
  flex: 1;
  @include text-truncate-lines(2);
  cursor: pointer;
}

// Trello Card Adder Styling
.trello-example-new-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(
    --ds-shadow-raised,
    0px 1px 1px #091e4240,
    0px 0px 1px #091e424f
  );
  padding: 8px 12px;
  margin-bottom: 8px;

  input[type="text"] {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 2px solid #0c66e4;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 400;
    color: #172b4d;
    background: #fff;
    outline: none;
    resize: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
      "Noto Sans", "Ubuntu", "Droid Sans", "Helvetica Neue", sans-serif;
    //box-shadow: inset 0 0 0 2px #0c66e4;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    -o-border-radius: 5px;
    &::placeholder {
      color: #626f86;
    }
  }

  &-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;

    button {
      border: none;
      border-radius: 3px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 500;
      line-height: 20px;
      padding: 6px 12px;
      transition: all 0.2s ease;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
        "Noto Sans", "Ubuntu", "Droid Sans", "Helvetica Neue", sans-serif;

      &:first-child {
        background: #0c66e4;
        color: #fff;

        &:hover {
          background: #0055cc;
        }

        &:active {
          background: #09326c;
        }
      }

      &:last-child {
        background: transparent;
        color: #44546f;
        padding: 6px 8px;

        &:hover {
          background: #091e4224;
        }

        &:active {
          background: #091e424f;
        }
      }
    }
  }
}

// Priority badges
.demo-priority-badge {
  @include badge-base;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;

  &.priority-high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
    border-color: rgba(239, 68, 68, 0.2);
  }

  &.priority-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-warning);
    border-color: rgba(245, 158, 11, 0.2);
  }

  &.priority-low {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-success);
    border-color: rgba(16, 185, 129, 0.2);
  }
}

// Clean placeholder styles
.#{$demo-prefix}-placeholder {
  @include flex-col-center;
  height: 100%;
  text-align: center;
  padding: var(--space-16);
  position: relative;

  > * {
    position: relative;
    z-index: 1;
  }

  &-icon {
    font-size: 4rem;
    margin-bottom: var(--space-6);
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.8;
  }

  h3 {
    margin-bottom: var(--space-4);
    color: var(--gray-900);
    font-size: 1.5rem;
    font-weight: 700;
    @include text-gradient;
  }

  p {
    color: var(--gray-600);
    margin-bottom: var(--space-6);
    max-width: 500px;
    font-size: 1rem;
    line-height: var(--leading-relaxed);
  }

  ul {
    text-align: left;
    color: var(--gray-700);
    margin-bottom: var(--space-6);
    max-width: 500px;

    li {
      padding: var(--space-2) 0;
      position: relative;
      padding-left: var(--space-6);
      font-size: 0.9375rem;
      line-height: var(--leading-relaxed);

      &::before {
        content: "✓";
        position: absolute;
        left: 0;
        color: var(--primary-600);
        font-weight: 600;
        top: var(--space-2);
      }
    }
  }

  &-note {
    @include card-elevated;
    padding: var(--space-4);
    background: linear-gradient(
      135deg,
      var(--primary-50),
      rgba(59, 130, 246, 0.08)
    );
    border: 1px solid var(--primary-200);
    color: var(--primary-700);
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 500px;
    line-height: var(--leading-relaxed);
    box-shadow: var(--shadow-md);

    &::before {
      content: "💡";
      font-size: 1.125rem;
      margin-right: var(--space-2);
    }
  }
}

// Feature cards for placeholder content
.#{$demo-prefix}-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);

  @include media-down(md) {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

.#{$demo-prefix}-feature-card {
  @include card-hover;
  padding: var(--space-4);
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);

  &-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xl);
    background: var(--gradient-primary);
    @include flex-center;
    margin: 0 auto var(--space-3);
    font-size: 1.25rem;
    box-shadow: var(--shadow-primary);
  }

  &-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
  }

  &-description {
    font-size: 0.8125rem;
    color: var(--gray-600);
    line-height: var(--leading-relaxed);
  }
}

// Loading states
.#{$demo-prefix}-loading {
  &-spinner {
    @include flex-center;
    width: 32px;
    height: 32px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-3);
  }

  &-text {
    color: var(--gray-500);
    font-size: 0.8125rem;
    text-align: center;
  }
}

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