.lbaic-settings-leads {
  &-filter {
    background: var(--lbaic-settings-white);
    border: 1px solid #eaebf0;
    border-radius: 8px;
    box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.05);
    padding: 4px;
    margin-bottom: 16px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;

    &-button {
      flex: 1;
      padding: 10px 16px;
      border-radius: 6px;
      font-size: var(--lbaic-settings-fs-13);
      line-height: var(--lbaic-settings-lh-16);
      transition: all 0.2s ease;
      border: none;
      background: transparent;
      cursor: pointer;
      color: #666666;

      &:hover:not(.active) {
        background: #f5f7fa;
      }

      &.active {
        background: var(--lbaic-settings-primary);
        color: var(--lbaic-settings-white);
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);

        .lbaic-settings-leads-filter-badge {
          background: rgba(var(--lbaic-settings-white-rgb), 0.2);
          color: var(--lbaic-settings-white);
        }
      }

      &-content {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
      }
    }

    &-icon {
      width: 16px;
      height: 16px;
      stroke: currentColor;
      fill: none;
    }

    &-badge {
      padding: 2px 6px;
      border-radius: 10px;
      font-size: var(--lbaic-settings-fs-10);
      line-height: var(--lbaic-settings-lh-14);
      background: #f5f7fa;
      color: #666666;
    }
  }

  &-filters-bar {
    background: var(--lbaic-settings-white);
    border: 1px solid #eaebf0;
    border-radius: 8px;
    box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.05);
    padding: 16px;
    margin-bottom: 16px;

    &-in {
      display: flex;
      align-items: center;
      gap: 12px;

      @include max-width($lbaic-settings-wp-xl-breakpoint) {
        flex-direction: column;
      }
    }

    &-search {
      flex: 1;
      min-width: 160px;

      &-icon {
        width: 18px;
        height: 18px;
        fill: currentColor;
      }
    }

    &-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-block-end: 16px;

      button:first-child {
        margin-left: auto;
      }
    }
  }

  &-table-container {
    display: grid;
    background: var(--lbaic-settings-white);
    border: 1px solid #eaebf0;
    border-radius: 8px;
    box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
  }

  &-table-wrapper {
    overflow-x: auto;
  }

  &-table {
    width: 100%;
    border-collapse: collapse;

    thead {
      background: #f5f7fa;
      border-bottom: 1px solid #eaebf0;
      position: sticky;
      top: 0;
      z-index: 10;
    }

    tbody {
      tr {
        background: var(--lbaic-settings-white);
        transition: background-color 0.2s ease;
        cursor: pointer;

        &:not(:last-child) {
          border-bottom: 1px solid #eaebf0;
        }

        &:hover {
          background: #f5f7fa;
        }
      }
    }

    &-th {
      padding: 12px 16px;
      text-align: left;
      font-weight: var(--lbaic-settings-fw-600);
      font-size: var(--lbaic-settings-fs-12);
      color: #666666;
      white-space: nowrap;

      &-checkbox {
        width: 48px;
      }
    }

    &-td {
      padding: 12px 16px;
      vertical-align: middle;
    }

    &-cell {
      display: flex;
      align-items: center;
      gap: 8px;

      &-with-icon {
        display: flex;
        align-items: center;
        gap: 8px;
      }
    }

    &-icon {
      font-size: 16px;
      line-height: 1;
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;

      &-svg {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
        display: block;

        &.unknown {
          stroke: currentColor;
        }
      }
    }

    &-checkbox-wrapper {
      .lbaic-settings-checkbox {
        margin: 0;
      }
    }

    &-name {
      &-text {
        font-size: var(--lbaic-settings-fs-13);
        line-height: var(--lbaic-settings-fs-18);
        color: #232323;
      }
    }

    &-avatar {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      background: #e0e7ff;
      color: #6366f1;
      overflow: hidden;

      &-initials {
        font-weight: var(--lbaic-settings-fw-500);
        font-size: var(--lbaic-settings-fs-11);
      }

      &-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
      }
    }

    &-text {
      font-size: var(--lbaic-settings-fs-13);
      line-height: var(--lbaic-settings-lh-18);
      color: #666666;
    }

    &-status {
      display: flex;
      align-items: center;
      gap: 8px;

      &-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;

        &--new {
          background-color: #458cf6;
        }

        &--contacted {
          background-color: #f59e0b;
        }

        &--qualified {
          background-color: #8b5cf6;
        }
      }

      &-badge {
        display: inline-flex;
        align-items: center;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: var(--lbaic-settings-fs-11);
        line-height: var(--lbaic-settings-lh-16);
        font-weight: var(--lbaic-settings-fw-500);

        &--new {
          color: #458cf6;
          background-color: rgba(69, 140, 246, 0.1);
        }

        &--contacted {
          color: #f59e0b;
          background-color: rgba(245, 158, 11, 0.1);
        }

        &--qualified {
          color: #8b5cf6;
          background-color: rgba(139, 92, 246, 0.1);
        }
      }
    }

    &-source {
      font-size: var(--lbaic-settings-fs-12);
      color: #666666;

      &-name {
        color: #666666;
      }

      &-form {
        color: #999999;
        margin-top: 2px;
      }
    }

    &-null {
      color: #999999;
    }
  }

  &-drawer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    display: flex;

    &-overlay {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background-color: var(--lbaic-settings-popup-overlay);
    }

    &-content {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      width: 600px;
      background: #ffffff;
      box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
      display: flex;
      flex-direction: column;
      animation: slideInRight 0.3s ease;

      @include max-width($lbaic-settings-wp-breakpoint) {
        width: 100%;
      }
    }

    &-header {
      padding: 16px 36px 16px 24px;
      border-bottom: 1px solid #eaebf0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;

      @include max-width($lbaic-settings-wp-breakpoint) {
        padding: 16px 24px;
      }

      .lbaic-settings-section-header {
        margin-bottom: 0;
      }

      &-close {
        padding: 8px;
        background: transparent;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: background-color 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;

        &:hover {
          background: #f5f7fa;
        }

        &-icon {
          width: 20px;
          height: 20px;
          fill: #666666;
        }
      }
    }

    &-body {
      flex: 1;
      overflow-y: auto;

      &-in {
        padding: 24px 36px 24px 24px;
        display: flex;
        flex-direction: column;
        gap: 24px;

        @include max-width($lbaic-settings-wp-breakpoint) {
          padding: 24px;
        }
      }
    }

    &-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;

      &-delete {
        margin-left: auto;
      }
    }

    &-section {
      &-title {
        font-weight: var(--lbaic-settings-fw-400);
        font-size: var(--lbaic-settings-fs-14);
        color: #232323;
        margin: 0 0 12px 0;
      }
    }

    &-card {
      background: #f5f7fa;
      border-radius: 8px;
      padding: 16px;

      &-title {
        font-weight: var(--lbaic-settings-fw-400);
        font-size: var(--lbaic-settings-fs-14);
        line-height: var(--lbaic-settings-lh-24);
        color: #232323;
        margin: 0 0 12px 0;
      }

      &-row {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 12px;

        &:last-child {
          margin-bottom: 0;
        }

        &-label {
          width: 96px;
          flex-shrink: 0;
          font-size: var(--lbaic-settings-fs-12);
          line-height: var(--lbaic-settings-lh-24);
          color: #666666;
        }

        &-value {
          flex: 1;
          font-size: var(--lbaic-settings-fs-13);
          line-height: var(--lbaic-settings-lh-24);
          color: #232323;
        }
      }
    }

    &-source {
      display: flex;
      flex-direction: column;
      gap: 8px;

      &-item {
        display: flex;
        align-items: center;
        gap: 8px;
      }

      &-icon {
        width: 16px;
        height: 16px;
        color: #666666;
        flex-shrink: 0;
        stroke: currentColor;
      }

      &-label {
        font-size: var(--lbaic-settings-fs-13);
        line-height: var(--lbaic-settings-lh-20);
        color: #666666;
      }

      &-value {
        font-size: var(--lbaic-settings-fs-13);
        line-height: var(--lbaic-settings-lh-20);
        color: #232323;
      }

      &-link {
        font-size: var(--lbaic-settings-fs-13);
        color: #458cf6;
        text-decoration: none;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

        &:hover {
          text-decoration: underline;
        }
      }
    }

    &-conversation {
      background: #f5f7fa;
      border-radius: 8px;
      padding: 16px;
      max-height: 300px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 12px;

      &-message {
        display: flex;
        justify-content: flex-start;

        &-user {
          justify-content: flex-end;
        }

        &-bubble {
          max-width: 80%;
          border-radius: 8px;
          padding: 12px;
          background: #ffffff;
          border: 1px solid #eaebf0;
          color: #232323;

          &-user {
            background: var(--lbaic-settings-primary);
            border-color: var(--lbaic-settings-primary);
            color: #ffffff;
          }
        }

        &-content {
          font-size: var(--lbaic-settings-fs-13);
          line-height: var(--lbaic-settings-lh-20);
          margin: 0;
        }

        &-time {
          font-size: var(--lbaic-settings-fs-11);
          line-height: var(--lbaic-settings-lh-16);
          color: #999999;
          margin-top: 4px;

          &-user {
            color: rgba(255, 255, 255, 0.7);
          }
        }
      }
    }

    &-timeline {
      display: flex;
      flex-direction: column;
      gap: 12px;

      &-item {
        display: flex;
        gap: 12px;
      }

      &-icon {
        flex-shrink: 0;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #f5f7fa;
        display: flex;
        align-items: center;
        justify-content: center;

        &-active {
          box-shadow: 0 0 0 2px #458cf6, 0 0 0 4px rgba(69, 140, 246, 0.1);
        }

        &-svg {
          width: 16px;
          height: 16px;
          fill: #666666;
        }
      }

      &-content {
        flex: 1;
        padding-bottom: 12px;
      }

      &-description {
        font-weight: var(--lbaic-settings-fw-500);
        font-size: var(--lbaic-settings-fs-13);
        color: #232323;
        margin: 0;
      }

      &-time {
        font-size: var(--lbaic-settings-fs-12);
        color: #999999;
        margin-top: 2px;
      }
    }

    &-notes {
      &-add {
        margin-bottom: 16px;
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      &-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      &-item {
        background: #f5f7fa;
        border-radius: 8px;
        padding: 12px;

        &-content {
          font-size: var(--lbaic-settings-fs-13);
          color: #232323;
          margin: 0;
        }

        &-meta {
          font-size: var(--lbaic-settings-fs-12);
          color: #999999;
          margin-top: 8px;
        }
      }

      &-empty {
        font-size: var(--lbaic-settings-fs-13);
        color: #999999;
        text-align: center;
        padding: 16px 0;
        margin: 0;
      }
    }

    &-copy {
      &-tooltip {
        &-content {
          --lbaic-settings-tooltip-width: max-content;

          .lbaic-settings-tooltip-content-in {
            gap: 5px;
          }
        }
      }
    }
  }

  &-configure-columns {
    display: flex;
    flex-direction: column;
    gap: 8px;

    &-item {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px;
      border-radius: 8px;
      border: 1px solid #eaebf0;
      background-color: var(--lbaic-settings-white);
      cursor: pointer;
      transition: border-color 0.2s ease;

      &:hover {
        border-color: var(--lbaic-settings-primary);
      }

      &:focus {
        outline: none;
      }

      &-label {
        font-size: var(--lbaic-settings-fs-14);
        line-height: var(--lbaic-settings-lh-18);
        color: #232323;
      }

      &-toggle {
        width: 16px;
        height: 16px;
        color: #999999;
        flex-shrink: 0;
        stroke: currentColor;
        fill: none;
        transition: color 0.2s ease;

        &--visible {
          color: var(--lbaic-settings-primary);
        }
      }
    }
  }
}

.lbaic-settings-filters-bar {
  display: flex;
  gap: 24px;

  @include max-width($lbaic-settings-wp-xl-breakpoint) {
    flex-direction: column;

    .lbaic-settings-column {
      padding-block-end: 0;
    }
  }

  &-in {
    padding-block-end: 24px;

    button {
      margin-inline-start: auto;
    }
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}