.job-opening-container {
  min-height: 100vh;
  background: #f5f7fa;
  padding: 4px 8px;

  // Header
  .header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 6px;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

    .back-button {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      border: none;
      background: transparent;
      cursor: pointer;
      font-size: 14px;
      color: #333;
      transition: background 0.2s;

      &:hover {
        background: #f5f7fa;
        border-radius: 6px;
      }

      .back-icon {
        font-size: 18px;
      }
    }

    .header-content {
      flex: 1;

      h1 {
        margin: 0 0 8px 0;
        font-size: 20px;
        font-weight: 600;
        color: #1a1a1a;
      }

      .subtitle {
        margin: 0;
        color: #666;
        font-size: 14px;
      }
    }

    .mode-toggle {
      display: flex;
      gap: 0;
      border: 1px solid #e0e0e0;
      border-radius: 6px;
      overflow: hidden;

      .toggle-btn {
        padding: 8px 20px;
        border: none;
        background: white;
        cursor: pointer;
        font-size: 14px;
        color: #666;
        transition: all 0.2s;

        &.active {
          background: var(--action-primary-default);
          color: white;
        }

        &:hover:not(.active) {
          background: #f5f7fa;
        }
      }
    }
  }

  // Wizard Container
  .wizard-container {
    .step-indicator {
      display: flex;
      align-items: center; // ← was flex-start, this centers everything
      justify-content: space-between;
      margin-bottom: 10px;
      background: white;
      padding: 10px 16px;
      border-radius: 8px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

      .step-item {
        display: flex;
        flex-direction: row; // circle left, text right
        align-items: center; // vertically centered
        gap: 8px;
        flex-shrink: 0;
        position: relative;
        cursor: pointer;
        min-width: 0;
        user-select: none;

        &.clickable {
          cursor: pointer;
        }

        &:not(.clickable) {
          cursor: not-allowed;
          opacity: 0.6;
        }

        .step-circle {
          width: 32px;
          height: 32px;
          min-width: 32px; // prevent flex from shrinking it
          border-radius: 50%;
          background: #e0e0e0;
          color: #999;
          display: flex;
          align-items: center;
          justify-content: center;
          font-weight: 600;
          font-size: 13px;
          flex-shrink: 0;
          transition: all 0.3s;
          pointer-events: none;

          mat-icon {
            font-size: 16px;
            width: 16px;
            height: 16px;
          }
        }

        .step-info {
          display: flex;
          flex-direction: column;
          gap: 1px;
          pointer-events: none;
          min-width: 0;

          .step-title {
            font-weight: 600;
            font-size: 13px;
            color: #333;
            white-space: normal; // ← was nowrap
            word-break: break-word; // ← added
            overflow: visible; // ← was hidden
            text-overflow: unset; // ← was ellipsis
          }

          .step-subtitle {
            font-size: 11px;
            color: #999;
            line-height: 1.3;
            white-space: normal; // ← was nowrap
            word-break: break-word; // ← added
            overflow: visible; // ← was hidden
            text-overflow: unset; // ← was ellipsis
            max-width: unset; // ← remove the 130px cap
          }
        }

        .step-connector {
          position: absolute;
          top: 50%; // ← was 24px, now truly centered
          left: calc(100% + 4px);
          width: 40px;
          height: 2px;
          transform: translateY(-50%);
          background: #e0e0e0;
          z-index: 1;
          pointer-events: none;
          transition: background 0.3s;

          &.completed {
            background: var(--action-primary-default);
          }
        }

        &:last-child .step-connector {
          display: none;
        }

        &.active {
          .step-circle {
            background: var(--action-primary-default);
            color: white;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
          }

          .step-info .step-title {
            color: var(--action-primary-default);
          }

          .step-info .step-subtitle {
            color: #666;
          }
        }

        &.completed {
          .step-circle {
            background: var(--action-primary-default);
            color: white;
          }

          .step-info .step-title {
            color: #1a1a1a;
          }
        }
      }
    }

    // Wizard Content - Side by Side Layout
    .wizard-content {
      display: flex;
      gap: 10px;

      .form-section {
        flex: 1;
        background: white;
        padding: 14px;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        max-height: 450px;
        height: 450px;
        overflow-y: auto;

        .step-content {
          h2 {
            margin: 0 0 14px 0;
            font-size: 20px;
            font-weight: 600;
            color: #1a1a1a;
          }

          .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 14px;

            h2 {
              margin: 0;
              font-size: 20px;
              font-weight: 600;
              color: #1a1a1a;
            }

            .btn-generate {
              display: flex;
              align-items: center;
              gap: 8px;
              padding: 8px 16px;
              border: 1px solid var(--action-primary-default);
              background: white;
              border-radius: 6px;
              cursor: pointer;
              font-size: 14px;
              color: var(--action-primary-default);
              transition: all 0.2s;
              white-space: nowrap;
              flex-shrink: 0;

              .sparkle-icon {
                font-size: 16px;
              }

              &:hover:not(:disabled) {
                background: var(--action-primary-default);
                color: white;
              }

              &:disabled {
                opacity: 0.6;
                cursor: not-allowed;
              }
            }
          }

          .form-field {
            label {
              display: block;
              margin-bottom: 8px;
              font-size: 14px;
              font-weight: 500;
              color: #333;
            }

            input,
            select,
            textarea {
              width: 100%;
              padding: 10px 12px;
              border: 1px solid #e0e0e0;
              border-radius: 6px;
              font-size: 14px;
              transition: border-color 0.2s;

              &:focus {
                outline: none;
                border-color: var(--action-primary-default);
              }

              &::placeholder {
                color: #999;
              }
            }

            textarea {
              resize: vertical;
              font-family: inherit;
            }
          }

          .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 10px;
          }

          .form-row-three {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 10px;
          }
        }
      }

      // Right Sidebar - Cards Stacked Vertically
      .right-sidebar {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 320px;
        flex-shrink: 0;

        .actions-card,
        .step-info-card {
          background: white;
          padding: 14px;
          border-radius: 8px;
          box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

        .actions-card {
          h3 {
            margin: 0 0 12px 0;
            font-size: 16px;
            font-weight: 600;
            color: #1a1a1a;
          }

          .btn {
            width: 100%;
            padding: 10px 16px;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;

            mat-icon,
            .mat-icon,
            svg {
              width: 18px;
              height: 18px;
              font-size: 18px;
            }

            &.btn-primary {
              background: var(--action-primary-default);
              color: white;

              mat-icon,
              .mat-icon,
              svg {
                color: white;
                fill: white;
              }

              &:hover {
                background: var(--action-primary-default);
              }
            }

            &.btn-secondary {
              background: #f5f7fa;
              color: #333;

              mat-icon,
              .mat-icon,
              svg {
                color: #333;
                fill: #333;
              }

              &:hover {
                background: #e8ecf0;
              }
            }

            &.btn-text {
              background: transparent;
              color: #666;

              mat-icon,
              .mat-icon,
              svg {
                color: #666;
                fill: #666;
              }

              &:hover {
                background: #f5f7fa;
                color: #333;

                mat-icon,
                .mat-icon,
                svg {
                  color: #333;
                  fill: #333;
                }
              }
            }
          }
        }

        .step-info-card {
          h3 {
            margin: 0 0 8px 0;
            font-size: 14px;
            font-weight: 600;
            color: #1a1a1a;
          }

          .step-description {
            font-size: 13px;
            color: #666;
            line-height: 1.5;
          }
        }
      }
    }
  }

  // Form Mode
  .form-mode {
    .tab-navigation {
      display: flex;
      gap: 0;
      background: white;
      padding: 0 24px;
      border-radius: 8px 8px 0 0;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      overflow-x: auto;

      .tab-button {
        padding: 16px 24px;
        border: none;
        background: transparent;
        cursor: pointer;
        font-size: 14px;
        color: #666;
        border-bottom: 2px solid transparent;
        transition: all 0.2s;
        white-space: nowrap;

        &.active {
          color: var(--action-primary-default);
          border-bottom-color: var(--action-primary-default);
        }

        &:hover:not(.active) {
          color: #333;
        }
      }
    }

    .form-mode-content {
      display: flex;
      gap: 24px;

      .form-section-full {
        flex: 1;
        background: white;
        padding: 32px;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        width: 980px;
        max-width: 980px;
        max-height: 350px;
        height: 350px;
        overflow-y: scroll;

        .step-content {
          h2 {
            margin: 0 0 24px 0;
            font-size: 20px;
            font-weight: 600;
            color: #1a1a1a;
          }

          .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;

            h2 {
              margin: 0;
              font-size: 20px;
              font-weight: 600;
              color: #1a1a1a;
            }

            .btn-generate {
              display: flex;
              align-items: center;
              gap: 8px;
              padding: 8px 16px;
              border: 1px solid var(--action-primary-default);
              background: white;
              border-radius: 6px;
              cursor: pointer;
              font-size: 14px;
              color: var(--action-primary-default);
              transition: all 0.2s;
              white-space: nowrap;
              flex-shrink: 0;

              .sparkle-icon {
                font-size: 16px;
              }

              &:hover:not(:disabled) {
                background: var(--action-primary-default);
                color: white;
              }

              &:disabled {
                opacity: 0.6;
                cursor: not-allowed;
              }
            }
          }
        }
      }

      .actions-sidebar {
        width: 320px;
        background: white;
        padding: 24px;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        height: fit-content;

        h3 {
          margin: 0 0 16px 0;
          font-size: 16px;
          font-weight: 600;
          color: #1a1a1a;
        }

        .btn {
          width: 100%;
          padding: 12px 16px;
          border: none;
          border-radius: 6px;
          font-size: 14px;
          font-weight: 500;
          cursor: pointer;
          transition: all 0.2s;
          margin-bottom: 12px;
          display: flex;
          align-items: center;
          justify-content: center;
          gap: 8px;

          &.btn-primary {
            background: var(--action-primary-default);
            color: white;
          }

          &.btn-secondary {
            background: #f5f7fa;
            color: #333;

            &:hover {
              background: #e8ecf0;
            }
          }

          &.btn-text {
            background: transparent;
            color: #666;

            &:hover {
              background: #f5f7fa;
              color: #333;
            }
          }
        }
      }
    }
  }
}

.automanual {
  margin-top: -22px;
  margin-left: 310px;

  .defineType {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    display: inline-block;
  }

  .auto-tag {
    color: var(--action-primary-default);

  }

  .manual-tag {
    color: var(--action-primary-default);

  }
}

// LIST VIEW STYLES
.list-view-container {
  padding: 24px;
  background: white;
  min-height: 100vh;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;

  .header-left {
    h1 {
      font-size: 32px;
      font-weight: 700;
      color: #1a1a1a;
      margin: 0 0 4px 0;
    }

    .subtitle {
      font-size: 14px;
      color: #666;
      margin: 0;
    }
  }

  .header-actions {
    display: flex;
    gap: 12px;
    align-items: center;

    .view-switcher {
      display: flex;
      gap: 0;
      border-radius: 6px;
      overflow: hidden;
      background: white;

      .view-btn {
        padding: 8px 12px;
        border: none;
        background: white;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;

        mat-icon {
          font-size: 20px;
          width: 20px;
          height: 20px;
          color: #666;
        }

        &:hover {
          background: #f8f9fa;
        }

        &.active {
          background: var(--action-primary-default);
          border-radius: 13px;

          mat-icon {
            color: white;
          }
        }
      }
    }

    .btn-export {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 20px;
      background: white;
      border: 1px solid #ddd;
      border-radius: 6px;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;

      &:hover {
        background: #f8f9fa;
        border-color: #bbb;
      }

      mat-icon {
        font-size: 20px;
        width: 20px;
        height: 20px;
      }
    }

    .btn-new-job {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 20px;
      background: var(--action-primary-default);
      color: white;
      border: none;
      border-radius: 6px;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;

      &:hover {
        background: var(--action-primary-default);
      }

      mat-icon {
        font-size: 20px;
        width: 20px;
        height: 20px;
      }
    }
  }
}

.filters-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;

  .search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 16px;

    mat-icon {
      color: #999;
      font-size: 20px;
      width: 20px;
      height: 20px;
    }

    input {
      flex: 1;
      border: none;
      outline: none;
      font-size: 14px;

      &::placeholder {
        color: #999;
      }
    }
  }

  .filter-dropdown {
    padding: 10px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    outline: none;


    &:hover {
      border-color: #bbb;
    }
  }
}

// CARD VIEW - FIXED SCROLLING
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  max-height: calc(100vh - 280px); // Adjust based on header and filters height
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  padding-bottom: 20px;

  // Custom scrollbar styling
  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;

    &:hover {
      background: #555;
    }
  }
}

.job-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.50);
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;

  &:hover {
    // box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);

  }

  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;

    .card-title-section {
      flex: 1;

      .card-title {
        font-size: 18px;
        font-weight: 600;
        color: #1a1a1a;
        margin: 0 0 4px 0;
      }

      .card-code {
        font-size: 13px;
        color: var(--action-primary-default);
        margin: 0;
        font-weight: 500;
      }
    }
  }

  .card-body {
    margin-bottom: 16px;

    .info-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 8px 0;

      .info-label {
        font-size: 13px;
        color: #666;
      }

      .info-value {
        font-size: 14px;
        color: #1a1a1a;
        font-weight: 500;
      }
    }
  }

  .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    margin-bottom: 16px;

    .footer-stat {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      color: #666;

      mat-icon {
        font-size: 18px;
        width: 18px;
        height: 18px;
        color: #999;
      }
    }
  }

  .card-action-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--action-primary-default);
    color: var(--action-primary-default);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      background: var(--action-primary-default);
      color: white;
    }
  }
}

// COMPACT VIEW - FIXED SCROLLING
.compact-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 280px); // Adjust based on header and filters height
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  padding-bottom: 20px;

  // Custom scrollbar styling
  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;

    &:hover {
      background: #555;
    }
  }
}

.compact-item {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;

  &:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    // border-color: var(--action-primary-default);
  }

  .compact-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;

    .compact-left {
      flex: 1;

      .compact-title {
        font-size: 16px;
        font-weight: 600;
        color: #1a1a1a;
        margin: 0 0 6px 0;
      }

      .compact-meta {
        font-size: 13px;
        color: #666;
        margin: 0;
      }
    }

    .compact-right {
      display: flex;
      align-items: center;
      gap: 16px;

      .compact-stat {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 16px;
        background: #f8f9fa;
        border-radius: 6px;

        .stat-number {
          font-size: 24px;
          font-weight: 700;
          color: var(--action-primary-default);
        }

        .stat-label {
          font-size: 11px;
          color: #666;
          text-transform: uppercase;
          letter-spacing: 0.5px;
        }
      }

      .compact-view-btn {
        padding: 8px 20px;
        background: transparent;
        border: 1px solid var(--action-primary-default);
        color: var(--action-primary-default);
        border-radius: 6px;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
        white-space: nowrap;

        &:hover {
          background: var(--action-primary-default);
          color: white;
        }
      }
    }
  }
}

// TABLE VIEW - FIXED SCROLLING
.table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  max-height: calc(100vh - 280px); // Adjust based on header and filters height
  overflow-y: auto;
  overflow-x: hidden;

  // Custom scrollbar styling
  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;

    &:hover {
      background: #555;
    }
  }
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;

  thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;

    th {
      padding: 16px;
      text-align: left;
      font-size: 13px;
      font-weight: 600;
      font-family: Arial, Helvetica, sans-serif;
      color: #666;
      // text-transform: uppercase;
      letter-spacing: 0.5px;
      border-bottom: 2px solid #e5e7eb;
    }
  }

  tbody {
    .job-row {
      border-bottom: 1px solid #e5e7eb;
      transition: background-color 0.2s;

      &:hover {
        background: #f9fafb;
      }

      td {
        padding: 16px;
        font-size: 14px;
        color: #1a1a1a;

        &.job-code {
          font-weight: 600;
          color: var(--action-primary-default);
        }

        &.job-title {
          font-weight: 500;
        }

        &.applications-count {
          font-weight: 600;
          color: var(--action-primary-default);
        }
      }
    }

    .loading-row,
    .empty-row {
      td {
        padding: 40px;
        text-align: center;
        color: #999;
        font-size: 14px;
      }
    }
  }
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--action-primary-default);
  color: white;

  &.status-active {
    background: #d1fae5;
    color: #065f46;
  }
}

.actions-cell {
  .btn-view {
    padding: 6px 16px;
    background: transparent;
    color: var(--action-primary-default);
    border: 1px solid var(--action-primary-default);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      background: var(--action-primary-default);
      color: white;
    }
  }
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    background: #f8f9fa;
    border-color: #bbb;
  }

  mat-icon {
    font-size: 20px;
    width: 20px;
    height: 20px;
  }
}

.loading-container,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: white;
  border-radius: 8px;
  grid-column: 1 / -1;

  mat-icon {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #cbd5e1;
    margin-bottom: 12px;
  }

  p {
    font-size: 16px;
    color: #64748b;
    margin: 0;
  }
}

.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  color: #666;
}

// Responsive
@media (max-width: 1200px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .wizard-container .wizard-content {
    flex-direction: column;

    .right-sidebar {
      width: 100%;
      flex-direction: row;

      .actions-card,
      .step-info-card {
        flex: 1;
      }
    }
  }

  .form-mode-content {
    flex-direction: column;

    .actions-sidebar {
      width: 100%;
    }
  }
}

@media (max-width: 768px) {
  .list-view-container {
    padding: 16px;
  }

  .list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;

    .header-actions {
      width: 100%;
      flex-wrap: wrap;
    }
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .compact-item .compact-main {
    flex-direction: column;
    align-items: flex-start;

    .compact-right {
      width: 100%;
      justify-content: space-between;
    }
  }

  .table-container {
    overflow-x: auto;
  }
}